[Haskell-beginners] Data declarations
Christopher Howard
christopher.howard at frigidcode.com
Fri Jun 3 05:03:49 CEST 2011
I'm trying to understand the Haskell type system, because it is
portrayed as a rather powerful tool when properly harnessed. There are a
few things, however, I could use some clarification on. For starters,
I'm a bit confused about the "data" declarations:
I understand (correctly, I hope) that the purpose of a "data"
declaration is to create a new type. So this makes sense:
data KeyValuePair = KeyValuePair String String
However, this also compiles:
data KeyValuePair a b = KeyValuePair String String
As well as does this:
data KeyValuePair a b = KeyValuePair String
And this:
data KeyValuePair a b = KeyValuePair
So you can see how I'm getting a bit confused?
--
frigidcode.com
theologia.indicium.us
More information about the Beginners
mailing list