一切都在Haskell是一样的功能:数据构造函数是否支持currying?
Prelude> type Subject = String
Prelude> type Verb = String
Prelude> type Object = String
Prelude> data Sentence = Sentence Subject Verb Object deriving (Eq, Show)
Prelude> :t Sentence
Sentence :: Subject -> Verb -> Object -> Sentence
的句子是一个数据类型,但为什么它显示的功能? 即使我用一个值替代,那么它就像一个函数。
s1 = Sentence "dogs" "drool"
数据类型是否也支持currying呢?
如果你已经尝试了':t s1',你会发现它的类型是'Object - > Sentence'。 – chepner