Haskell Type vs Data Constructor

前端 未结 6 1497
清酒与你
清酒与你 2020-12-04 05:04

I am learning Haskell from learnyouahaskell.com. I am having trouble understanding type constructors and data constructors. For example, I don\'t really understand the diffe

6条回答
  •  长情又很酷
    2020-12-04 05:18

    It's about types: In the first case, your set the types String (for company and model) and Int for year. In the second case, your are more generic. a, b, and c may be the very same types as in the first example, or something completely different. E.g., it may be useful to give the year as string instead of integer. And if you want, you may even use your Color type.

提交回复
热议问题