Skip to content

Instantly share code, notes, and snippets.

@k-bx
Created April 13, 2014 08:37
Show Gist options
  • Save k-bx/10574806 to your computer and use it in GitHub Desktop.
Save k-bx/10574806 to your computer and use it in GitHub Desktop.
{-# 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-0.1.0.0...
Preprocessing executable 'overloaded-lists' for overloaded-lists-0.1.0.0...
[1 of 1] Compiling Main ( src/Main.hs, dist/build/overloaded-lists/overloaded-lists-tmp/Main.o )
src/Main.hs:9:13:
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