What's the difference between type and data type in Haskell?

前端 未结 2 859
醉梦人生
醉梦人生 2021-02-05 00:35

I\'m a little confused as to the difference between a type and a data type in Haskell.

From the literature I have enc

2条回答
  •  臣服心动
    2021-02-05 01:27

    The terms are sometimes mixed, but usually a "data type" refers to a type introduced using the data keyword, which has constructors you can pattern match on. These are also called algebraic data types".

    Just "type" is a more general term which also includes types created using newtype, function types and so on.

提交回复
热议问题