[GHC] #10971: ExtendedDefaultRules defaults to [] for Foldable/Traversable

#10971: ExtendedDefaultRules defaults to [] for Foldable/Traversable -------------------------------------+------------------------------------- Reporter: kanetw | Owner: Type: feature | Status: new request | Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: 10963 Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- From goldfire:
Extend -XExtendedDefaultRules to allow defaulting when one of the classes involved is Foldable or Traversable. (See the current rules here.) This will mean, essentially, that there will be two lists of default types, one list at kind * and one at kind * -> *. Both lists should be settable by the user by the default directive. (GHC can figure out which list is being set quite easily.) The default default list for * -> * will be [].
-- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10971 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10971: ExtendedDefaultRules defaults to [] for Foldable/Traversable -------------------------------------+------------------------------------- Reporter: kanetw | Owner: kanetw Type: feature request | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10963 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by kanetw): * owner: => kanetw * related: 10963 => #10963 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10971#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10971: ExtendedDefaultRules defaults to [] for Foldable/Traversable -------------------------------------+------------------------------------- Reporter: kanetw | Owner: kanetw Type: feature request | Status: patch Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10963 | Differential Rev(s): phab:D1329 Wiki Page: | -------------------------------------+------------------------------------- Changes (by kanetw): * status: new => patch * differential: => phab:D1329 Comment: I implemented this a bit differently from what goldfire lined out. There's still just a single default list, but it accepts any kind now instead of only OpenKind. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10971#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10971: ExtendedDefaultRules defaults to [] for Foldable/Traversable -------------------------------------+------------------------------------- Reporter: kanetw | Owner: kanetw Type: feature request | Status: patch Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10963 | Differential Rev(s): phab:D1329 Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): I find it a little counterintuitive to have one defaulting list have types of several different kinds in it. For example, `default (), []` is accepted, and has the exact same meaning as `default [], ()`. I'd much prefer separating these out. But I won't make a big deal of it. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10971#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10971: ExtendedDefaultRules defaults to [] for Foldable/Traversable -------------------------------------+------------------------------------- Reporter: kanetw | Owner: kanetw Type: feature request | Status: patch Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10963 | Differential Rev(s): phab:D1329 Wiki Page: | -------------------------------------+------------------------------------- Comment (by kanetw): The reason for having one list is because if we ever implement something like #8171 it'd be much more effort to make it polykinded when using multiple defaulting lists. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10971#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10971: ExtendedDefaultRules defaults to [] for Foldable/Traversable -------------------------------------+------------------------------------- Reporter: kanetw | Owner: kanetw Type: feature request | Status: patch Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10963 | Differential Rev(s): phab:D1329 Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): I really don't want two lists! I think it's ok as-is; but it might help to add a bit more explanatory text in the user manual. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10971#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10971: ExtendedDefaultRules defaults to [] for Foldable/Traversable -------------------------------------+------------------------------------- Reporter: kanetw | Owner: kanetw Type: feature request | Status: patch Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10963 | Differential Rev(s): phab:D1329 Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj):
Also, this implementation would seem to accept `default Either`, which is utterly meaningless, as `Either` has a non-defaultable kind. This is also utterly harmless, but it makes me suspicious of the design.
It would not be utterly meaningless if we added some new type class of kind `(* -> * -> *) -> Constraint`, and wanted defaulting to work on it. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10971#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10971: ExtendedDefaultRules defaults to [] for Foldable/Traversable -------------------------------------+------------------------------------- Reporter: kanetw | Owner: kanetw Type: feature request | Status: patch Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10963 | Differential Rev(s): phab:D1329 Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): Replying to [comment:6 simonpj]:
Also, this implementation would seem to accept `default Either`, which is utterly meaningless, as `Either` has a non-defaultable kind. This is also utterly harmless, but it makes me suspicious of the design.
It would not be utterly meaningless if we added some new type class of kind `(* -> * -> *) -> Constraint`, and wanted defaulting to work on it.
Simon
That's true. But we have no such classes with defaulting yet, and it would take a change to the compiler to make it so. But, I've heard a loud enough chorus of voices asking for just one list (including some on IRC). And I think KaneTW's argument in comment:4 is convincing. I stand down. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10971#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10971: ExtendedDefaultRules defaults to [] for Foldable/Traversable
-------------------------------------+-------------------------------------
Reporter: kanetw | Owner: kanetw
Type: feature request | Status: patch
Priority: normal | Milestone: 8.0.1
Component: Compiler | Version: 7.10.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #10963 | Differential Rev(s): phab:D1329
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Thomas Miedema

#10971: ExtendedDefaultRules defaults to [] for Foldable/Traversable -------------------------------------+------------------------------------- Reporter: kanetw | Owner: kanetw Type: feature request | Status: closed Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | typecheck/should_compile/T10971a | typecheck/should_fail/T10971b | T10971d Blocked By: | Blocking: Related Tickets: #10963 | Differential Rev(s): phab:D1329 Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * testcase: => typecheck/should_compile/T10971a typecheck/should_fail/T10971b T10971d * status: patch => closed * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10971#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC