[Haskell-beginners] data, records and functions

Darren Grant therealkludgy at gmail.com
Wed Feb 20 23:00:03 CET 2013


This is just saying that the type of less is any function that takes two
a's as parameters and returns a Bool result. This appears to be a
formalization of the Ord (ordered) data type, where less would be used to
compare two ordered values and return a Bool result, either True or False.

Just a note that the data declaration above is missing a constructor name.
It should probably be something like:

data Ord a = *Ord* { less :: a -> a -> Bool }


Cheers,
Darren



On Wed, Feb 20, 2013 at 1:18 PM, Emanuel Koczwara <poczta at emanuelkoczwara.pl
> wrote:

> Hi,
>
> I'm watching Philip Wadler "Faith, Evolution, and Programming
> Languages" (very cool by the way):
> http://www.youtube.com/watch?v=8frGknO8rIg
>
> At 00:24:14 there is strange thing on the slide:
>
> data Ord a = { less :: a -> a -> Bool }
>
> It's first time I see function type (and where is definition?) in record
> syntax. Can somebody explain this?
>
> Emanuel
>
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130220/4824f6ed/attachment.htm>


More information about the Beginners mailing list