> Haskell 98 libraries
>
>   * Make each module export all the relevant types and functions that the
>     Prelude defines, so that a programmer who does not import the Prelude
>     can get access to all the (say) list types and functions by saying
>     import List. This involves extra exports from modules List, Monad, IO,
>     Maybe, Char.

That's a jolly good idea!

In the light of this change we possibly should also add a library
module for Either (a type which is currently a bit neglected).

> instance Functor (Either a) where
>     fmap f (Left  a)  =  Left  a
>     fmap f (Right a)  =  Right (f a)

> instance Monad (Either String) where
>     Left  a >>= k     =  Left a
>     Right a >>= k     =  k a
>     return            =  Right
>     mfail s           =  Left s

Many of the functions contained in the library Maybe make sense for
Either as well.

Cheers, Ralf


Reply via email to