Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
586 views
in Technique[技术] by (71.8m points)

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

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

From the literature I have encountered I got the impression they were different concepts.

question from:https://stackoverflow.com/questions/7916327/whats-the-difference-between-type-and-data-type-in-haskell

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Type and data type refer to exactly the same concept.

The Haskell keywords type and data are different, though: data allows you to introduce a new algebraic data type, while type just makes a type synonym.

See the Haskell wiki for details.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...