[Haskell-cafe] Wikipedia on first-class object
cristi at ot.onrc.ro
Thu Dec 27 07:51:16 EST 2007
On Thu, 27 Dec 2007 14:37:51 +0200, Yitzchak Gale <gale at sefer.org> wrote:
> I wrote:
>>>>> Like any type, only certain operations make
>>>>> sense on functions...
>>>> Yes, but one can store the result of an operation to disk except in
>>>> particular case the result happen to be a function.
>>> No, you can only store the result of an operation to
>>> disk in the particular case that the result type represents
>>> a list of bytes. Otherwise, you have to serialize it first...
>>> But it is not clear at all how you could define a general
>>> serialization method for functions.
>> Isn't that confusing levels of abstractions ?
>> Of course functions are bytes, 'cause they are already stored as bytes
> That is just the point. A function in Haskell is an abstraction,
> not bytes in RAM.
> The compiler might IMPLEMENT the same function in several places,
> with different bytes in each place. Or it might decide to combine it
> into other functions, and not store any bytes in RAM at all for this
> The function itself represents a way of doing a calculation. It is not an
> object that can do the calculation.
Then trees of functions are ...
>>>> I'm not sure that in Haskell one can say that storing a value
>>>> of some type to disk is an operation defined on that type.
>>> It is. For example:
>>> hPutStr :: Handle -> String -> IO ()
>> And this is a property of the type String ?
>> The function hPutStr appears in the definition of the type String ?
> Ah, you are thinking of "operation on a type" in the OOP sense.
> Sorry, I wasn't clear. When I said "only certain operations make
> sense" on each type, I just meant that there are only certain
> things you can do with the type. In Haskell, the things you can
> do with a type are the functions you can define that mention that
> type in their signature.
How can one define in the language STORAGE of "things" ?
Storage of numbers for example ?
You said that the TYPE of a function forbids me somehow to store it in a
Now I understand that not the type forbids me, but the lack of a function
with apropriate types.
________ 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