当我运行这段代码时,有一个问题让我很困惑
data Tree a = Nil | Node a (Tree a) (Tree a)
type IntTree = Tree Int
type Counter = State Int
withCounter::Int -> Counter a -> a
withCounter init f = fst(runState f init)
nextCount::Counter Int
nextCount = do
    n <- get
    put (n+1)
    return n
incTree::IntTree -> IntTree
incTree tree = withCounter 1 (IncTree' tree)
incTree' Nil = return 0
incTree' (Node l e r) = do
    newl <- incTree' l
    n <- nextCount
    newr <- incTree' r
    return (Node newl (e+n) newr)
错误如下:
parse error on input '<-'
它似乎在第 27 行提出,即 'n <- nextCount'
有谁知道我为什么会收到这个错误?谢谢 !