
On Fri, 28 Dec 2007 12:03:04 +0200, apfelmus
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.
I didn't know 5 as a number is undecidable :-)
Similarly, there cannot be functions
print :: (Int -> Int) -> String compile :: String -> (Int -> Int)
with
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.
Ok. I understand that there cannot be pairs like (print,compile) above. But I was told that compile (quality number 10), can be defined. About print above, I do not intend to make a Haskell String from a Haskell function. This is why I said something about mixing levels of abstractions.
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.
How can be Clean similar to Haskell and at the same time satisfy 9-12 ? I tryed Clean. I like it very much. I have some silly little problems with it: - its only 32 bit - it doesn't support Unicode - I don't like those type adnotations. Look as ugly as Lisp () to me. - it's not free - the linux version seems abandoned. - there are some issues with # expressions (let before) that I don't fully understand - the IO seems easyer in Haskell than in Clean Otherwise I like it better than Haskell.
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.
In my experience, different people have different "world views", and one cannot get that from books only.
Concerning books, maybe
The Haskell Road to Logic, Maths and Programming http://www.cwi.nl/~jve/HR
is for you.
Thank you.
More books on
You don't have to buy them, borrow them from a library.
I'l try borrow them when I'll be visiting Munich next year, but I don't think I'll have enough time to read them. ________ Information from NOD32 ________ This message was checked by NOD32 Antivirus System for Linux Mail Servers. part000.txt - is OK http://www.eset.com