[Haskell-cafe] what exactly does "deriving (Functor, Monad,
MonadIO)" do?
Thomas Hartman
tphyahoo at gmail.com
Tue May 1 05:42:37 EDT 2007
I was trying to follow the reasoning in Don's article on using haskell
for shell scripting
http://cgi.cse.unsw.edu.au/~dons/blog/2007/03/10
In the source listing at the end we is
newtype Shell a = Shell { runShell :: ErrorT String IO a }
deriving (Functor, Monad, MonadIO)
and I don't understand it what "deriving" is doing here, nor have I
been able to find documentation on it.
http://en.wikibooks.org/wiki/Haskell/Class_declarations
claims:
"You can only use deriving with a limited set of built-in classes. They are:
Eq Ord Enum Bounded Show Read "
But, here we are deriving classes not in that list. So, is this a
recently added feature? Or something that came in from
{-# OPTIONS -fglasgow-exts #-} ?
I would just like to understand this, and I can't figure out how to begin.
Thanks for any help!
thomas.
More information about the Haskell-Cafe
mailing list