Unable to coerce with flipped Coercible context
coerce' :: Coercible a b => b -> a
coerce' = coerce
doesn't compile, forcing workarounds like:
coerce' :: forall a b. Coercible a b => b -> a
coerce' = coerce (id :: a -> a)
This arises in practice in several places in the profunctors
package and lens
.
http://hackage.haskell.org/package/lens-4.8/docs/src/Control-Lens-Internal-Coerce.html#coerce%27
Ideally we'd be able to retire coerce'
entirely and just use coerce
in those contexts.
The tricky part is of course avoiding infinite loops once you add symmetry.
Trac metadata
Trac field | Value |
---|---|
Version | 7.10.1-rc2 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler (Type checker) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |