[Haskell-cafe] Definition of List type?

Edward Z. Yang ezyang at MIT.EDU
Fri Jul 30 14:48:34 EDT 2010


Excerpts from michael rice's message of Fri Jul 30 14:41:44 -0400 2010:
> One description has the type and associated operations, the other only has the operations.
> 
> Where can I find the type definition for List, and why isn't it in Data.List? 

Hello Michael,

This is because the List datatype is built into Haskell.  A close approximation
to it would be:

data List a = Nil | Cons a (List a)

where

    List a      is [a] (type)
    Nil         is [] (constructor)
    Const x xs  is x:xs (constructor)

Cheers,
Edward


More information about the Haskell-Cafe mailing list