haskell - Making a custom datatype ord-able -


Can anyone explain to me how do I enable custom data types?

** I do not have permission to modify myself, such as Deriving (Eq, Ord)

  data suit = club. Diamonds | Heart | Finding the dictation (a)   

Try me:

  Example Ord Suites Where to Compare Suit 1 Suite 2 Compare Suit 1 Suite 2   

but it seems that the constant loop does not go and stop.

Definition of ODD is something like this (but not enough)

  Class Orders Compare: a - & gt; A - & gt; There are three possible values ​​of the order   

and ordering : LT, EQ, GT

Therefore, you have Define what should be of each comparison. For example:

  Example Where the comparison of the club compares diamond = LT diamond club = comparison of GT diamond diamond = EQ diamond = _ lt - except diamond club and diamond   

Your actual order may vary, but this should give you the original idea.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -