Reputation: 45295
import Data.Map as Map
test :: Int -> Int -> Map -> Map
test key value cache = Map.insert key value cache
Error:
`Map' is not applied to enough type arguments
Expected kind `??', but `Map' has kind `* -> * -> *'
In the type signature for `test': test :: Int -> Int -> Map -> Map
How can I declare the function to pass Data.Map as parameter?
Upvotes: 1
Views: 1079
Reputation: 47052
You have to say what it is a map of.
test :: Int -> Int -> Map Int Int -> Map Int Int
test key value cache = Map.insert key value cache
Your keys are Int
s and the values you're storing are also Int
s, so your map has type Map Int Int
.
If the keys were String
s and the values were Bool
s, the map would have type Map String Bool
.
Upvotes: 8