[Haskell-cafe] Re: ANN: First Monad Tutorial of the Season
Hans van Thiel
hthiel.char at zonnet.nl
Mon Aug 25 08:33:08 EDT 2008
On Mon, 2008-08-25 at 00:33 +0200, Ben Franksen wrote:
> Hans van Thiel wrote:
> > so 'The Greenhorn's Guide to becoming a Monad Cowboy' is on
> > http://www.muitovar.com/monad/moncow.xhtml
> Forgot to say: nicely written!
> Some more comments:
> You can declare a fixity (infixr) for flop instead of using parentheses
> (yes, this is allowed; see 'elem' in the Prelude). Would make the code more
> "(Recall that a type definition is just like a data definition, but with no
> choice operator (|).)" First, you mean to say 'newtype', not 'type' (as in
> the code).
Thanks for the feedback. If and when I get some more comments and error
reports, I'll try to fix them.
> Second, a newtype may also contain only one data element (i.e.
> one type expression after the constructor), not many, as in a data type
Yes, that's what I thought too, but then I got confused by State s a,
which looks to have two. Could you explain?
> Third, newtype is unlifted.
The books I use for reference, the Craft and SOE, don't seem to mention
this. I have to confess, I don't really understand the difference
between newtype and data. Again, an explanation would be appreciated.
As a general comment on the teaching of Haskell, all books and
tutorials, which I've seen, appear to treat this aspect of Haskell as if
it were self explanatory. This while the better known imperative
languages don't have anything like it. Only Real World Haskell explains
algebraic data types to some satisfaction (IMHO, of course).
More information about the Haskell-Cafe