[Haskell-cafe] map (-2) [1..5]
John Meacham
john at repetae.net
Thu Aug 17 21:39:14 EDT 2006
On Fri, Aug 18, 2006 at 12:20:54AM +0100, Brian Hulley wrote:
> data Integer = ... | -1 | 0 | 1 | ...
>
> tells me that the negative and positive integers are on an equal footing.
>
> Ie the language is sending out a "mixed message" about the integers, which
> is confusing.
Not only that but there is a run-time penalty for every polymorphic
negattive literal!
-3 desugars to negate (fromInteger 3) rather than (fromInteger -3) so
you end up having to do 2 dictionary lookups (one for fromInteger, one
for negate) and indirect function calls rather than just the one.
John
--
John Meacham - ⑆repetae.net⑆john⑈
More information about the Haskell-Cafe
mailing list