[Haskell-beginners] Type question
Brandon S. Allbery KF8NH
allbery at ece.cmu.edu
Mon Jan 5 17:53:21 EST 2009
On 2009 Jan 5, at 15:40, Paul Johnston wrote:
> Hi, I was playing around after getting the new O'Reilly book with
> lists and their operators!
> Not sure what the below actually means?
> Prelude>  : 
> it :: [[a]]
> (Got :set +t on )
> I thought the first argument of ':' must be an element, so is the
> empty list an element of the same type of the contents of the empty
(:) :: a -> [a] -> [a]
In this case the first argument is an empty list (type forall a. [a])
and the second must therefore be an empty list of lists (type forall
a. [[a]]). Hence the result is also of type forall a. [[a]] (with all
the `a's unified).
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university KF8NH
More information about the Beginners