Haskell State Monad Syntax



在haskell中测试这个代码示例的语法是什么?

type Estate1 x = ([Int], Map x Int)
pop :: State (Estate1 Int) Int
pop = do
(liste,key) <- get
return ((Map.!) key 1)
runState pop ([1,2,3], Map.singleton 1 42)
^^^^^^^^^^^^^^^^^^
initial state

在ghci中试试,你会看到它的回报。

最新更新