I read another question on stackoverflow About first-,second- and third-class value saying that something that is first-class means it has more privileges than second-class things. Since functions are first-class, what privileges do they have over other things in Haskell? I am not sure why I was marked down. Any ideas?
Thanks.
From wikipedia
In programming language design, a first-class citizen (also object, entity, or value) in a given programming language is an entity which supports all the operations generally available to other entities. These operations typically include being passed as a parameter, returned from a function, and assigned to a variable.
This means that in Haskell, functions can be passed as parameters, returned as values, and assigned to variables. The language has built-in mechanics for handling, manipulating, and working with functions in general, such as the compose function (.), the function map, and more.
A second class construct in Haskell is record syntax, as Fixnum has pointed out. You can't construct an anonymous record and pass it into a function, it has to be an instance of a particular data type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With