
30 Dec
2008
30 Dec
'08
12:22 p.m.
On Tue, 2008-12-30 at 17:12 +0000, raeck@msn.com wrote:
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]
The bottom 'a' has nothing to do with the 'a' in the type signature. Your code is equivalent to
showAll :: (Eq a, Bounded a, Enum a) => a -> [a] showAll a = [minBound..maxBound]::[b]
Which is not type correct as [minBound..maxBound] :: (Bounded a, Enum a) => [a] You don't need that type annotation (or the type signature for that matter), so just omit it.