If I assign a var to maxBound :
let bInt = maxBound
evaluation of bInt prints ()
but if I type bInt
bInt :: Int
prints : 9223372036854775807
Why does bInt not evaluate until I type
bInt (bInt :: Int) ?
maxBound is a function in the Bounded type class. By default, GHCi appears to choose the instance for (), which returns (). You can force it to use another instance by adding a type signature.
let bInt :: Int; bInt = maxBound
bInt -- 9223372036854775807
let x = maxBound
x :: () -- ()
x :: Bool -- True
x :: Char -- '\1114111'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With