codesnippets:typeapplications
{-# LANGUAGE TypeApplications #-}
- allows to specify types to apply
- example, without type application
- compiles with error:
app\Main.hs:4:15: error: * Ambiguous type variable `a0' arising from a use of `read' prevents the constraint `(Read a0)' from being solved. Probable fix: use a type annotation to specify what `a0' should be. These potential instances exist: instance Read Ordering -- Defined in `GHC.Read' instance Read Integer -- Defined in `GHC.Read' instance Read a => Read (Maybe a) -- Defined in `GHC.Read' ...plus 22 others ...plus 12 instances involving out-of-scope types (use -fprint-potential-instances to see them all) * In the first argument of `print', namely `(read "123")' In the expression: print (read "123") In an equation for `main': main = print (read "123") | 4 | main = print (read "123") | ^^^^^^^^^^
- example, without type application
- example, with type application
✎
You could leave a comment if you were logged in.
codesnippets/typeapplications.txt · Last modified: by 127.0.0.1
