>>5He's been bitten by the monomorphism restriction (
Bounded a => a
defaulted to
()
in ghci).
Doesn't happen outside of ghci:
$ cat anus.hs
val = minBound == maxBound
main = print val
$ runghc anus.hs
anus.hs:1:7:
No instance for (Bounded a0) arising from a use of ‘minBound’
The type variable ‘a0’ is ambiguous
Note: there are several potential instances:
instance Bounded () -- Defined in ‘GHC.Enum’
instance (Bounded a, Bounded b) => Bounded (a, b)
-- Defined in ‘GHC.Enum’
instance (Bounded a, Bounded b, Bounded c) => Bounded (a, b, c)
-- Defined in ‘GHC.Enum’
...plus 17 others
In the first argument of ‘(==)’, namely ‘minBound’
In the expression: minBound == maxBound
In an equation for ‘val’: val = minBound == maxBound
anus.hs:1:16:
No instance for (Eq a0) arising from a use of ‘==’
The type variable ‘a0’ is ambiguous
Note: there are several potential instances:
instance Eq a => Eq (GHC.Real.Ratio a) -- Defined in ‘GHC.Real’
instance Eq () -- Defined in ‘GHC.Classes’
instance (Eq a, Eq b) => Eq (a, b) -- Defined in ‘GHC.Classes’
...plus 23 others
In the expression: minBound == maxBound
In an equation for ‘val’: val = minBound == maxBound
$