[Haskell-cafe] Basic question concerning data constructors
webmaster at h-labahn.de
Sun Dec 30 09:24:59 EST 2007
perhaps i will make a wishlist of topics not dealt in the tutorials. Here is
something i miss in each of them: notes at the semantics of data constructors.
data Pair a b = Pair a b
in YetAnotherHaskellTutorial. And that is all ! If we omit "data" here, this
would be a silly pleonasm. And no single word about this strange behavior of
"data" in every tutorial i read.
A similar point: The tutorials teach, that "=" has a similar meaning than "=" in
mathematics. But there is a big difference: it is not reflexive. The
the right side is the definition of the left. Thus "x=y" has still some kind of
temporality, which mathematics doesn't have. Wadler himself describes bunches
of lazily computed equations as "dataflows" somewhere.
Ok, so much on theory. Here a concrete question:
For adapting hws (one of the reasons for me to be here, not many languages have
a native web server) to Windows i must work on time. In System.Time i found
data ClockTime = TOD Integer Integer
2 questions arise here: Does this define "TOD" (which i do not find elsewhere)
together with ClockTime also ? And: Why is this not:
data ClockTime Integer Integer = TOD Integer Integer ?
Is it just an abbreviation for the first? Or is there a connection to
ClockTime as an "abstract data type" (a notion, which would have a subtle
different meaning than in OOP - since "instance" is such different thing
Thanks for your attention, Joost
More information about the Haskell-Cafe