[GHC] #16248: ImplicitParams does not imply FlexibleContexts or FlexibleInstances

#16248: ImplicitParams does not imply FlexibleContexts or FlexibleInstances -------------------------------------+------------------------------------- Reporter: NeilMitchell | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Documentation | Version: 8.6.3 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Given: {{{#!hs {-# LANGUAGE ImplicitParams #-} {-# LANGUAGE FlexibleInstances #-} module Test where data X a = X type XI = X Int class Foo a where foo :: (?p :: Int) => a -> Int instance Foo XI where foo = undefined }}} This code compiles. However, the documentation at https://downloads.haskell.org/~ghc/master/users-guide/glasgow_exts.html #language-options says that ImplicitParams implies FlexibleInstances, so we should be able to remove the FlexibleInstances extension. However, doing so makes it stop compiling. My guess is that ImplicitParams doesn't really imply either of the type class extensions, and that the documentation is buggy. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16248 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16248: ImplicitParams does not imply FlexibleContexts or FlexibleInstances -------------------------------------+------------------------------------- Reporter: NeilMitchell | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Documentation | Version: 8.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by AntC): `instance Foo XI ...` in the first case needs `TypeSynonymInstances`. That expands `XI` to `X Int`, then needs `FlexibleInstances`. `FlexibleInstances` is supposed to imply `TypeSynonymInstances`. I wonder if `ImplicitParams` switches on `FlexibleInstances` OK, but fails to also switch on `TypeSynonymInstances`? IOW try the code with `ImplicitParams` and `TypeSynonymInstances`, but not `FlexibleInstances`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16248#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16248: ImplicitParams does not imply FlexibleContexts or FlexibleInstances -------------------------------------+------------------------------------- Reporter: NeilMitchell | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Documentation | Version: 8.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by NeilMitchell): To clarify the logic I'm using here: The above code requires TypeSynonymInstances, FlexibleInstances and ImplicitParams. To successfully compile, the minimum number of extensions I can write is ImplicitParams and FlexibleInstances. TypeSynonymInstances is not required. GHC claims that FlexibleInstances implies TypeSynonymInstances, and ImplicitParams implies FlexibleInstances. As a consequence FlexibleInstances should definitely be unnecessary. But it is required, so the docs are buggy. I had implicitly assumed that implications were transitive. Whether they are or not, the ImplicitParams still doesn't appear to imply FlexibleInstances. It would be good to document this detail in the documentation. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16248#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16248: ImplicitParams does not imply FlexibleContexts or FlexibleInstances -------------------------------------+------------------------------------- Reporter: NeilMitchell | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Documentation | Version: 8.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Looking at `main/DynFlags`, it doesn't look as if `ImplicitParams` implies anything. Why should it? Shall we just remove that claim from the user manual? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16248#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16248: ImplicitParams does not imply FlexibleContexts or FlexibleInstances -------------------------------------+------------------------------------- Reporter: NeilMitchell | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Documentation | Version: 8.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by NeilMitchell): Yep, removing the claim would be my suggestion. Happy to raise a PR, but I wonder how it got in there in the first place, and if there are any other mistakes that entered via the same route? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16248#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16248: ImplicitParams does not imply FlexibleContexts or FlexibleInstances -------------------------------------+------------------------------------- Reporter: NeilMitchell | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Documentation | Version: 8.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): This users' guide entry was introduced in commit cf8ab1ced6f15dad03dd7bcc454ef759cf4d3b3d. Given that this was a very large refactoring of the way the users' guide was formatted, my guess is that this was simply an honest mistake. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16248#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16248: ImplicitParams does not imply FlexibleContexts or FlexibleInstances -------------------------------------+------------------------------------- Reporter: NeilMitchell | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Documentation | Version: 8.6.3 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by NeilMitchell): * status: new => closed * resolution: => fixed Comment: Fixed in https://gitlab.haskell.org/ghc/ghc/merge_requests/282/ -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16248#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16248: ImplicitParams does not imply FlexibleContexts or FlexibleInstances
-------------------------------------+-------------------------------------
Reporter: NeilMitchell | Owner: (none)
Type: bug | Status: closed
Priority: normal | Milestone:
Component: Documentation | Version: 8.6.3
Resolution: fixed | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Marge Bot
participants (1)
-
GHC