Changes between Version 9 and Version 10 of Defaulting


Ignore:
Timestamp:
Feb 19, 2007 11:57:07 AM (8 years ago)
Author:
igloo@…
Comment:

Proposal to remove defaulting

Legend:

Unmodified
Added
Removed
Modified
  • Defaulting

    v9 v10  
    179179=== Cons ===
    180180 * Changes the Haskell'98 behaviour (where defaults are module-local).  Question: Do any real programs actually rely on the Haskell'98 spec here?
     181
     182== Proposal 4 - remove defaulting ==
     183It is generally agreed that defaulting, in its current form at least, is a wart on the language. The main motivation behind it is to make simple calculator-like uses of interactive Haskell environments possible.
     184
     185This proposal, then, is to remove defaulting from the language; we would expect that interactive environments will continue to default as they think best. Note that implementations already go beyond what is stated in the report when defaulting.
     186
     187Most(?) instances of defaulting in Real Programs are due to (!^). If this proposal is adopted then we would recommend changing the type of (!^) and introducing genericPower (or some better name) thus:
     188{{{
     189(^)          :: (Num a) => a -> Int -> a
     190genericPower :: (Num a, Integral b) => a -> b -> a
     191}}}
     192This is similar to the scheme used by, for example, genericIndex.
     193
     194=== Pros ===
     195 * Easy to implement and explain.
     196 * Makes the language smaller.
     197 * Trivially fixes any problems tools like hat have with defaulting.
     198
     199=== Cons ===
     200 * No pretense at trying to remain compatible with Haskell '98, but how many uses of defaulting are there in the wild? And how many not covered by (!^)?