[Haskell-beginners] applicative default structure
imantc at gmail.com
Thu Dec 22 15:38:09 UTC 2016
> what is the "default" structure if you don't specify any
display::Show a => a -> String
display = show
fa::(Applicative f, Num a) => f a
fa = pure 1
f and a are *bounded* by Applicative and Num, so to say. No default. Or, it
is typed however type is a bit broader than *
> In this case it defaults f to IO and a to Int,
does it though?
Prelude> let a1 = pure 1
Prelude> let a2 = pure 1
Prelude> a1 == a2
• Ambiguous type variable ‘a0’ arising from a use of ‘a1’
prevents the constraint ‘(Num a0)’ from being solved.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners