[GHC] #12560: ‘:info TYPE’ mentions any instance that includes ‘Type’

#12560: ‘:info TYPE’ mentions any instance that includes ‘Type’ -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 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: -------------------------------------+------------------------------------- Unexpected behaviour {{{ $ ghci -ignore-dot-ghci GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help Prelude> import GHC.Types Prelude GHC.Types> :i TYPE type role TYPE nominal data TYPE (t1 :: RuntimeRep) -- Defined in ‘GHC.Prim’ }}} Importing `Data.Proxy` gives me some of its instances, {{{ Prelude GHC.Types> import Data.Proxy Prelude GHC.Types Data.Proxy> :i TYPE type role TYPE nominal data TYPE (t1 :: RuntimeRep) -- Defined in ‘GHC.Prim’ instance Monad Proxy -- Defined in ‘Data.Proxy’ instance Functor Proxy -- Defined in ‘Data.Proxy’ instance Applicative Proxy -- Defined in ‘Data.Proxy’ instance Foldable Proxy -- Defined in ‘Data.Foldable’ instance Traversable Proxy -- Defined in ‘Data.Traversable’ Prelude GHC.Types Data.Proxy> }}} because they mention `*` {{{ Prelude GHC.Types Data.Proxy> :set -fprint-explicit-kinds Prelude GHC.Types Data.Proxy> :i TYPE type role TYPE nominal data TYPE (t1 :: RuntimeRep) -- Defined in ‘GHC.Prim’ instance Monad (Proxy *) -- Defined in ‘Data.Proxy’ instance Functor (Proxy *) -- Defined in ‘Data.Proxy’ instance Applicative (Proxy *) -- Defined in ‘Data.Proxy’ instance Foldable (Proxy *) -- Defined in ‘Data.Foldable’ instance Traversable (Proxy *) -- Defined in ‘Data.Traversable’ }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12560 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12560: ‘:info TYPE’ mentions any instance that includes ‘Type’ -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 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 goldfire): I'm sorry: What's the unexpected behavior? What would you expect instead? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12560#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12560: ‘:info TYPE’ mentions any instance that includes ‘Type’ -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 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 Iceland_jack): Maybe this is expected (please close if so), without `print-explicit- kinds` I was surprised to see many pages of seemingly unrelated instances (more than I posted in this minimal example). The information for `*` lists no instances nor does [https://hackage.haskell.org/package/ghc-prim-0.5.0.0/docs/GHC- Types.html#t:TYPE Hackage], I suppose I expected the same. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12560#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12560: ‘:info TYPE’ mentions any instance that includes ‘Type’ -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 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 goldfire): By mentioning `-fprint-explicit-kinds` above, do you mean to suggest `:info T` should print only those instances where the use of `T` is visible? That's plausible, but not what's done now. `:info *` won't list instances because `*` is a type synonym. Hackage doesn't list instances for `*` for the same reason. But it also doesn't list instances for `TYPE`. This last bit is because `TYPE` lives in `ghc-prim` and the instances live in `base`, so Haddock hasn't seen them yet. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12560#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12560: ‘:info TYPE’ mentions any instance that includes ‘Type’ -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 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 Iceland_jack): Yes, it would even be possible to have listed instances depend on whether `print-explicit-kinds` is enabled or not: i.e. we only list the instance if `*` appears in the output (having instances depend on flags is weird, the current behaviour may be preferable). Another idea is to treat `TYPE` as a special case and temporarily show explicit kinds when its instances are printed regardless of flags. The connection between `TYPE` and `*` may also not be obvious to users. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12560#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12560: ‘:info TYPE’ mentions any instance that includes ‘Type’ -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 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 goldfire): OK, so to summarize: * You request that `:info T` print only those instances for which the use of `T` is visible. Naturally, this list is affected by `-fprint-explicit- kinds`. You mention some other ideas, but I don't think we should treat `TYPE` specially here: if a user is asking about it, they are accessing experts- only areas of GHC and can control the output themselves. Do you agree that this ticket is a feature request for my bulleted feature? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12560#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC