R J <[email protected]> writes:

> Say I've got a type "Month" declared as an instance of the "Enum"
> class, and a type "MonthPair" declared as a pair of months:
> data Month = January | February | March | April | May | June | July |
> August | September | October | November | December deriving (Eq, Enum,
> Ord, Show)
> type MonthPair = (Month, Month) deriving (Enum)
> The "deriving" on "MonthPair" gives me the error "parse error on input
> deriving'".

You can't derive instances for type aliases (as its mainly there for
documentation reasons, etc.).  However, pairs don't have Enum instances
by default so you still can't use its instance.

If you define "data MonthPair = MonthPair Month Month" then you should
be able to derive Enum.

-- 
Ivan Lazar Miljenovic
[email protected]
IvanMiljenovic.wordpress.com
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to