Haskell

Haskell类构造器和值构造器的区别

2018-02-01  本文已影响22人  三生石上绛珠草

IO is a type constructor, not a value constructor. Type constructor is defined in left hand side of data/type/newtype, can be used in right hand side of type signature. Value constructor is defined in right hand side of data/type/newtype, only it can be used in pattern match. Value constructor and type constructor may have same name or not.
i.e.
data Foo a = Bar a | ACG
Foo is type constructor, Bar and ACG are value constructor.

没看real world haskell是我2015,2016年最大的遗憾。
原来英文版还是看得懂的,可惜当年疯狂找中文版,翻译的丢三落四的破烂中文版。

上一篇 下一篇

猜你喜欢

热点阅读