[Haskell-cafe] Enum and Bounded in generic type

raeck at msn.com raeck at msn.com
Tue Dec 30 12:12:29 EST 2008


Hi, how can I make the following code work? (show all the possible values of 
a type 'a')

> showAll :: (Eq a, Bounded a, Enum a) => a -> [a]
> showAll a = [minBound..maxBound]::[a]

it keeps saying that I could fix the problem by adding (Enum a) and (Bounded 
a) the the context, but I failed when I try.

anything goes wrong?

Thanks!

Raeck 



More information about the Haskell-Cafe mailing list