2013-08-17 47 views
1

分配在GHCI提示,不能在Haskell提示

我能夠做到的,

Prelude Text.Parsec> :t (oneOf "aeiou")

,並得到(oneOf "aeiou") :: Stream s m Char => ParsecT s u m Char

但是,當我這樣做,

let s = oneOf "aeiou"

I得到以下錯誤,

interactive>:36:9: 
    No instance for (Stream s0 m0 Char) 
     arising from a use of `oneOf' 
    Possible fix: add an instance declaration for (Stream s0 m0 Char) 
    In the expression: oneOf "aeiou" 
    In an equation for `m': m = oneOf "aeiou" 

有人能告訴我爲什麼我不能分配給s?

+1

也許是因爲類型違約。當你做'讓s =(oneOf「aeiou」):: Stream s m Char => ParsecT s?m Char'? – Satvik

+0

[單態限制是什麼?](http://stackoverflow.com/questions/32496864/what-is-the-monomorphism-restriction) – Bakuriu

回答