[Haskell-cafe] (newbie) instance Enum MyType where, smarter way?

Sven Panne sven.panne at aedion.de
Tue Mar 27 11:42:22 EDT 2007

On Tuesday 27 March 2007 17:15, Adrian Neumann wrote:
> [...]
> Which doesn't work because succ and pred are not (properly?) defined. Is
> there a way to let deriving Enum do *some* of work (i.e. defining succ
> and pred) while manually defining the other functions?

Hmmm, this seems to be a confusing usage of the Enum class, e.g. 'fromEnum . 
toEnum' changes some values (allowed by the report, but confusing 
nevertheless). Using Data.Bits.Bits somehow could be a better option, but one 
has to know more about your use case.


More information about the Haskell-Cafe mailing list