[Haskell-cafe] Re: Wikipedia on first-class object

apfelmus apfelmus at quantentunnel.de
Fri Dec 28 05:03:04 EST 2007

Cristian Baboi wrote:
>  http://en.wikipedia.org/wiki/First-class_object
> The term was coined by Christopher Strachey in the context of “functions 
> as first-class citizens” in the mid-1960's.[1]
> Depending on the language, this can imply:
> 1.  being expressible as an anonymous literal value
> 2.  being storable in variables
> 3.  being storable in data structures
> 4.  having an intrinsic identity (independent of any given name)
> 5.  being comparable for equality with other entities
> 6.  being passable as a parameter to a procedure/function
> 7.  being returnable as the result of a procedure/function
> 8.  being constructable at runtime
> 9.  being printable
> 10. being readable
> 11. being transmissible among distributed processes
> 12. being storable outside running processes
> I'll guess that 5,9,12 does not apply to Haskell functions.

Exactly, together with 10 and 11 (when the distributed processes are on 
different machines).

But there is good reason that those things can't be done in Haskell. 
With extensional equality (two functions are considered equal if they 
yield the same result on every possible argument) number 5 is 
undecidable. Similarly, there cannot be functions

   print   :: (Int -> Int) -> String
   compile :: String -> (Int -> Int)


   compile . print = id

A  print  function based on an intensional representation (assembly, 
byte code, etc.) would have to distinguish extensionally equal functions

   print f ≠ print g   although   f = g

which is not allowed.

More importantly, I don't quite understand your question. If you 
definitively need 9-12 for a practical problem at hand, then you may 
want to take a look at the functional language Clean


which is similar to Haskell but offers 9-12 in some form.

In all other cases, an email thread is not a good (often not even 
successful) way to get a coherent "world view" on Haskell (or on 
something  else) since this necessarily involves nitpicking 
philosophical questions. In my experience, interrogating one person in 
real-time in audio and "interrogating" books are the best ways to do 
that. Concerning books, maybe

   The Haskell Road to Logic, Maths and Programming

is for you. More books on


You don't have to buy them, borrow them from a library.


More information about the Haskell-Cafe mailing list