[Haskell-cafe] represent data sturcture using function
raeck at msn.com
Mon Dec 29 00:04:28 EST 2008
Hope everybody is enjoying the Christmas!
I am doing some readings and I found something seems to be interesting.
People sometime will try to represent a quantity-regard-only data structure
(such a order-regadless List) using functions instead of ta concrete data
structure (like the haskell build-in ), any particular reason for this?
> data Sex = Male | Female
> classA :: Sex -> Int
> classA Male = 100
> classA Female = 200
when I should prefer the above solution instead of using a concrete data structure
such as  to represent the classA members?
It seems to be very difficult to change the number of Male or Female if a concrete data
structure is not used. Is it possible change the number of Male in classA when represent
classA using function?
Thank you very much!
It’s the same Hotmail®. If by “same” you mean up to 70% faster.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe