[Haskell-cafe] Re: Wikipedia on first-class object
cristi at ot.onrc.ro
Fri Dec 28 07:58:53 EST 2007
Here is how I want print to be in Haskell
print :: (a->b) -> (a->b)
with print = id, but the following "side effect":
- I want to call the print function today, and get the value tomorrow.
On Fri, 28 Dec 2007 12:03:04 +0200, apfelmus <apfelmus at quantentunnel.de>
> Cristian Baboi wrote:
>> The term was coined by Christopher Strachey in the context of
>> “functions as first-class citizens” in the mid-1960's.
>> 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.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> ________ Information from NOD32 ________
> This message was checked by NOD32 Antivirus System for Linux Mail
> part000.txt - is OK
________ Information from NOD32 ________
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
part000.txt - is OK
More information about the Haskell-Cafe