
#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