Skip to content

Orientation of given `Coercible` constraints

Prelude> :m + GHC.Exts
Prelude GHC.Exts> let f :: Coercible a b => b -> a ; f = coerce

<interactive>:3:40:
    Could not coerce from ‛b’ to ‛a’
      because ‛b’ and ‛a’ are different types.
      arising from a use of ‛coerce’
    from the context (Coercible a b)
      bound by the type signature for f :: Coercible a b => b -> a
      at <interactive>:3:10-32
    In the expression: coerce
    In an equation for ‛f’: f = coerce

Something better could be done here (but its not clear what exactly, and to what general extend).

Trac metadata
Trac field Value
Version 7.6.3
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information