
#8767: Add rules involving `coerce` to the libraries -------------------------------------+------------------------------------- Reporter: nomeata | Owner: ekmett Type: task | Status: new Priority: normal | Milestone: 7.12.1 Component: Core Libraries | Version: 7.9 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: 8718 | Test Case: Related Tickets: #2110 | tests/simplCore/should_run/T2110.hs | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by htebalaka): I'm a little out of my depth with rewrite rules, but is there anything preventing rules being associated with a typeclass? Then you could have zero method typeclasses like {{{ class Functor f => LawfulFunctor f where {-# RULES "fmap/coerce" fmap coerce = coerce #-} }}} and then any datatype that wants the rule just implements the typeclass, which is trivial. It would also address dfeuer's comment about lawfullness in constraints, though it would also generate a lot of noise in documentation (and might inherit the same issue with typeclasses that they can be hard to refactor). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8767#comment:27 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler