Raeck said:
> 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]
What you are really looking for, I think, is a polymorphic value of type [a],
where a is some enumerable, bounded type.
allValues :: (Enum a, Bounded a) => [a]
allValues = [minBound .. maxBound]
You can omit the type signature, but then you'll run into the monomorphism
restriction (which you'll can turn off with, e.g. -XNoMonomorphismRestriction)
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe