[GHC] #8171: Extending ExtendedDefaultRules
GHC
ghc-devs at haskell.org
Tue Aug 27 08:54:22 UTC 2013
#8171: Extending ExtendedDefaultRules
-------------------------------------+------------------------------------
Reporter: ekmett | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.6.3
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
-------------------------------------+------------------------------------
Description changed by simonpj:
Old description:
> The current `ExtendedDefaultRules` is set up in a way that largely
> prevents it from being used for scenarios beyond what they get used for
> in GHCi today.
>
> It would be great if there was an extra class that could be included in
> the list of acceptable classes for Rule 3.
>
> {{{
> class Defaulting a
> }}}
>
> The proposed change would be that Rule 3 under EDR can be be relaxed to:
> At least one of the classes Ci is numeric, or is `Show`, `Eq`, `Ord` or
> `Defaulting`.
>
> I went with `Defaulting` rather than `Default`, because `Default` is a
> common class in use across the ecosystem from the `data-default` package,
> and I wanted to avoid gratuitous fallout.
>
> This would permit projects like Shae Erisson's `ghclive` from last year
> that need to use defaulting to not have to shoe-horn unnecessary `Show`
> constraints onto functions.
>
> Even better would be for that class to be polykinded!
>
> That opens up possibilities for expert users to get defaulting to fire on
> arguments of other kinds, which is impossible under the current EDR.
New description:
The current `ExtendedDefaultRules` (see
[http://www.haskell.org/ghc/docs/latest/html/users_guide/interactive-
evaluation.html#extended-default-rules manual page]) is set up in a way
that largely prevents it from being used for scenarios beyond what they
get used for in GHCi today.
It would be great if there was an extra class that could be included in
the list of acceptable classes for Rule 3.
{{{
class Defaulting a
}}}
The proposed change would be that Rule 3 under EDR can be be relaxed to:
At least one of the classes Ci is numeric, or is `Show`, `Eq`, `Ord` or
`Defaulting`.
I went with `Defaulting` rather than `Default`, because `Default` is a
common class in use across the ecosystem from the `data-default` package,
and I wanted to avoid gratuitous fallout.
This would permit projects like Shae Erisson's `ghclive` from last year
that need to use defaulting to not have to shoe-horn unnecessary `Show`
constraints onto functions.
Even better would be for that class to be polykinded!
That opens up possibilities for expert users to get defaulting to fire on
arguments of other kinds, which is impossible under the current EDR.
--
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8171#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list