[Haskell-cafe] [] == []

Derek Elkins derek.a.elkins at gmail.com
Sat May 30 20:05:27 EDT 2009


On Fri, May 29, 2009 at 5:36 AM, Max Rabkin <max.rabkin at gmail.com> wrote:
> On Fri, May 29, 2009 at 12:29 PM, Paul Keir <pkeir at dcs.gla.ac.uk> wrote:
>> f''' = ([]::[()]) == ([]::[()])
>>
>> (Very pretty.)
>>
>> So why doesn't ghc have 'default' instances?
>
> It does. I believe Num defaults to Integer and then to Double.
>
> Generally, though, defaults are convenient in exploratory usage but
> confusing in compiled code. In compiled code, you don't want arbitrary
> choices of defaults to affect performance and correctness.
>
> I've had programs run much slower than expected because the types
> defaulted to Integer rather than Int.

http://www.haskell.org/ghc/docs/latest/html/users_guide/interactive-evaluation.html#extended-default-rules


More information about the Haskell-Cafe mailing list