On 22-Feb-2002, Cagdas Ozgenc <[EMAIL PROTECTED]> wrote:
> If (->) is a type constructor, what does its definition look like, what data
> constructors does it have? How does it differ from other type constructors,
> or maybe it doesn't?

It is an abstract data type.
The representation is implementation-dependent.
The data constructor(s) for (->) are not accessible to programs,
so you can't e.g. pattern-match against them.

Implementations are likely to use a specialized representation for (->).
For example, they might use something similar to the following C structure.
(This is from the Mercury implementation. I hope this example doesn't raise
more questions than it answers ;-)

/*
** A closure is a vector of words containing:
**
**      one word pointing to the closure layout structure of the procedure
**      one word pointing to the code of the procedure
**      one word giving the number of arguments hidden in the closure (N)
**      N words representing the N hidden arguments
...
*/

typedef struct MR_Closure_Struct {
        MR_Closure_Layout       *MR_closure_layout;
        MR_Code                 *MR_closure_code;
        MR_Unsigned             MR_closure_num_hidden_args;
        MR_Word                 MR_closure_hidden_args[MR_VARIABLE_SIZED];
} MR_Closure;

-- 
Fergus Henderson <[EMAIL PROTECTED]>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to