[Haskell-cafe] Definition of List type?
michael rice
nowgate at yahoo.com
Fri Jul 30 15:54:20 EDT 2010
Thanks all,
Now that I have a (very) rudimentary understanding of Haskell, I figured I'd back up and have a closer (conceptual) look at type definitions to see what they have in common, and just happen to pick Maybe and List.
I also noticed Maybe has a list of "Instances"
Monad Maybe
Functor Maybe
Typeable1 Maybe
MonadFix Maybe
MonadPlus Maybe
etc.
while List has none, at least I don't see any in Data.List. Same reason?
>From "Learn You A Haskell:"
"If a type is a part of a typeclass, that means it supports and implements the behavior the typeclass describes."
I'm way out on a limb here, but isn't Monad a typeclass? and if, as we say above, that Maybe is an instance of Monad, wouldn't there have to be
instance Monad Maybe where
return = ... -- return for Maybe
>>= = ... -- bind for Maybe
etc.
somewhere? Where? It's not in Data.Maybe. Is there some kind of scheme for defining this stuff, i.e., this goes here, that goes there?
Michael
--- On Fri, 7/30/10, Edward Z. Yang <ezyang at MIT.EDU> wrote:
From: Edward Z. Yang <ezyang at MIT.EDU>
Subject: Re: [Haskell-cafe] Definition of List type?
To: "michael rice" <nowgate at yahoo.com>, "haskell-cafe" <haskell-cafe at haskell.org>
Date: Friday, July 30, 2010, 3:01 PM
Excerpts from Edward Z. Yang's message of Fri Jul 30 14:48:34 -0400 2010:
> Const x xs is x:xs (constructor)
That should be a Cons, not Const. :o)
Cheers,
Edward
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100730/7dce684e/attachment.html
More information about the Haskell-Cafe
mailing list