[GHC] #12888: ‘Identity instance’: Outputable SDoc

#12888: ‘Identity instance’: Outputable SDoc -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: feature | Status: new request | Priority: normal | Milestone: Component: GHC API | 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: -------------------------------------+------------------------------------- Is there reason why there isn't an ‘identity instance’¹ for `Outputable`? {{{#!hs class Outputable a where ppr :: a -> SDoc instance Outputabe SDoc where ppr :: SDoc -> SDoc ppr = id }}} A benefit: lets me always use `pprTraceIt :: Outputable a => String -> a -> a`, I know I can use `pprTrace` but I like not having to think about the type of what I'm tracing and neither functions work to debug something like `Either SDoc Name`. ---- ¹ For lack of a better term, something like {{{#!hs class Foo a where foo :: a -> A instance Foo A where foo :: A -> A foo = id @A }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12888 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12888: ‘Identity instance’: Outputable SDoc -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: GHC API | 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've wondered this, too, thinking that the reason was to support better hygiene. But I think we should just have it. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12888#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12888: ‘Identity instance’: Outputable SDoc -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: feature request | Status: patch Priority: normal | Milestone: Component: GHC API | 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): Phab:D2761 Wiki Page: | -------------------------------------+------------------------------------- Changes (by Iceland_jack): * status: new => patch * differential: => Phab:D2761 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12888#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC