Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8047107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:00:04+00:00 2026-06-05T06:00:04+00:00

I have a record type that includes a function: {foo : int; bar :

  • 0

I have a record type that includes a function:

{foo : int; bar : int -> int}

I want this type to have structural equality. Is there some way I can just mark that the bar should be ignored in equality tests? Or is there some other way around this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T06:00:06+00:00Added an answer on June 5, 2026 at 6:00 am

    See Don’s blog post on this topic, specifically the section Custom Equality and Comparison.

    The example he gives is almost identical to the record structure you propose:

    /// A type abbreviation indicating we’re using integers for unique stamps on objects
    type stamp = int
     
    /// A type containing a function that can’t be compared for equality  
     [<CustomEquality; CustomComparison>]
    type MyThing =
        { Stamp: stamp;
          Behaviour: (int -> int) } 
     
        override x.Equals(yobj) =
            match yobj with
            | :? MyThing as y -> (x.Stamp = y.Stamp)
            | _ -> false
     
        override x.GetHashCode() = hash x.Stamp
        interface System.IComparable with
          member x.CompareTo yobj =
              match yobj with
              | :? MyThing as y -> compare x.Stamp y.Stamp
              | _ -> invalidArg "yobj" "cannot compare values of different types"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say have this immutable record type: public class Record { public Record(int x,
I have a F# record type and want one of the fields to be
Given i have the type: type NewsMessage(identifier:string, headline:string) and this record: type NewsMessageParams =
I have some tabular data: Foo Bar ------------- fooes 42 bars 666 ... So,
I am trying to create a function with a variant record-type parameter that allows
Say I have a query that fetches [type][show_name]. For all [type]==5 records, I need
I have a delphi programm which send record: type TMyNetworkPckg = record za: byte;
I have following Delphi code: type RegbusReq2=packed record Funct:char; Device:char; Device1:char; Starting:integer; Quantity:smallint; _CRC:Word;
I have a next code: type THead = packed record znmpc: byte; znmpcch: array
I have an XML document which looks something like this: <meadinkent> <record> <comp_div>MENSWEAR</comp_div> <sty_ret_type>ACCESSORIES</sty_ret_type>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.