2012-02-24 17 views
1
import Data.Map as Map 

test :: Int -> Int -> Map -> Map 
test key value cache = Map.insert key value cache 

エラー:Data.Map型宣言

`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 

は、どのように私は、パラメータとしてData.Map渡す関数を宣言することができますか?

答えて

6

のマップである必要があります。

test :: Int -> Int -> Map Int Int -> Map Int Int 
test key value cache = Map.insert key value cache 

あなたの鍵はInt秒であり、あなたのマップがMap Int Intを入力しているので、あなたが保存している値は、またInt秒です。

キーがStringで、値がBoolの場合、マップのタイプはMap String Boolです。