====== {-# LANGUAGE TypeApplications #-} ====== * allows to specify types to apply * example, without type application * code: module Main where main :: IO () main = print (read "123") * 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 * code: module Main where main :: IO () main = print ((read "123") :: Integer) * example, with type application * code: {-# LANGUAGE TypeApplications #-} module Main where main :: IO () main = print (read @Integer "123") ===== ✎ ===== ~~DISCUSSION~~