美文网首页Haskell
Haskell类构造器和值构造器的区别

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

作者: 三生石上绛珠草 | 来源:发表于2018-02-01 10:33 被阅读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年最大的遗憾。
    原来英文版还是看得懂的,可惜当年疯狂找中文版,翻译的丢三落四的破烂中文版。

    相关文章

      网友评论

        本文标题:Haskell类构造器和值构造器的区别

        本文链接:https://www.haomeiwen.com/subject/mbzrzxtx.html