[Haskell-beginners] applicative default structure

Imants Cekusins imantc at gmail.com
Thu Dec 22 15:38:09 UTC 2016


> what is the "default" structure if you don't specify any

similar to:

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

<interactive>:20:1: error:
    • 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...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20161222/52dc05c1/attachment.html>


More information about the Beginners mailing list