[Haskell] boilerplate boilerplate

Neil Mitchell ndmitchell at gmail.com
Tue May 22 19:50:03 EDT 2007


Hi

>    {-# OPTIONS -fglasgow-exts #-}
>    module Blog.Types where
>    import Data.Typeable
>    import Data.Generics
>
>    data BlogEntry = Entry EpochSeconds Name Email Title Body
>                     deriving (Eq,Ord,Read,Show,Typeable)
>
>    newtype Name = Name String deriving (Eq,Ord,Read,Show,Typeable)
>    newtype Title = Title String deriving (Eq,Ord,Read,Show,Typeable)
>    newtype Body = Body String deriving (Eq,Ord,Read,Show,Typeable)

First off, never use OPTIONS, use OPTIONS_GHC instead. OPTIONS is the
old way of doing it.

Secondly, if you add {-# OPTIONS_DERIVE
--derive=Eq,Ord,Read,Show,Typeable #-} then running your code through
with Derive should give you the magic that you require. Plus it will
also work on Hugs, and not require your OPTIONS_GHC anyway.

Derive: http://www-users.cs.york.ac.uk/~ndm/derive/

Thanks

Neil


More information about the Haskell mailing list