[GHC] #8767: Add rules involving `coerce` to the libraries
GHC
ghc-devs at haskell.org
Fri Feb 6 02:42:32 UTC 2015
#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 dfeuer):
Replying to [comment:27 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).
I don't know too much about these things either, but I don't think this
will work too well. The problem, as I understand it, is that the
`LawfulFunctor` constraint has to be in place at the ''call site'', which
will generally not be the case even when the functor is actually an
instance of `LawfulFunctor`.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8767#comment:28>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list