Skip to content

Instantly share code, notes, and snippets.



Created Apr 13, 2014
What would you like to do?
{-# LANGUAGE OverloadedLists #-}
{-# LANGUAGE OverloadedStrings #-}
import Data.Map
import Data.Text
main :: IO ()
main = do
let m = [("foo", 1), ("bar", 2)]
:: Map Text Int
putStrLn "My map looks like this:"
print m
root@b575c8a9c84b:~/overloaded_lists# cabal build
Building overloaded-lists-
Preprocessing executable 'overloaded-lists' for overloaded-lists-
[1 of 1] Compiling Main ( src/Main.hs, dist/build/overloaded-lists/overloaded-lists-tmp/Main.o )
Couldn't match type `GHC.Exts.Item (Map Text Int)' with `(t0, t1)'
The type variables `t0', `t1' are ambiguous
Expected type: Int -> [(t0, t1)] -> Map Text Int
Actual type: Int
-> [GHC.Exts.Item (Map Text Int)] -> Map Text Int
In the expression: [("foo", 1), ("bar", 2)] :: Map Text Int
In an equation for `m':
m = [("foo", 1), ("bar", 2)] :: Map Text Int
In the expression:
do { let m = ...;
putStrLn "My map looks like this:";
print m }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.