[Haskell-cafe] newtype deriving Alternative

Martijn van Steenbergen martijn at van.steenbergen.nl
Wed Oct 14 17:16:54 EDT 2009


Hello café,

I've never written an Alternative instance for a newtype yet that 
doesn't look like this:

> instance Alternative T where
>   empty = T empty
>   T x <|> T y = T (x <|> y)

Why does newtype deriving not work for Alternative? (It works fine for 
Monoid.)

Thanks,

Martijn.


More information about the Haskell-Cafe mailing list