[Haskell-cafe] data type declaration
Andrew Coppin
andrewcoppin at btinternet.com
Sun Jul 25 12:21:11 EDT 2010
Vo Minh Thu wrote:
> 2010/7/25 Andrew Coppin <andrewcoppin at btinternet.com>:
>
>> Since you're interested in comparisons... A method is simply a way of giving
>> the same name to several different functions, and have the compiler pick the
>> correct one based on the argument types.
>> [snip]
>>
>
> Actually in Haskell, the choice of the correct definition is not only
> based on the argument types. It could be based on the result type:
>
Yes, quite right.
It's also possible to use "phantom types" to make the program do
different things even thought the run-time representation of data hasn't
changed at all. Haskell is like that. ;-)
More information about the Haskell-Cafe
mailing list