Skip to content

Incompleteness in the Coercible constraint solver

$ ghci -ignore-dot-ghci
GHCi, version 8.5.20180105: http://www.haskell.org/ghc/  :? for help
Prelude> newtype WF f a = WF (f a)
Prelude> import Data.Coerce
Prelude Data.Coerce> :set -XFlexibleContexts 
Prelude Data.Coerce> :t coerce :: Coercible (cat a b) (a -> f b) => cat a b -> (a -> WF f b)

<interactive>:1:1: error:
    • Couldn't match representation of type ‘cat1 a1 b1’
                               with that of ‘a1 -> WF f1 b1’
        arising from a use of ‘coerce’
    • In the expression:
          coerce ::
            Coercible (cat a b) (a -> f b) => cat a b -> (a -> WF f b)

I'm not sure if I've filed this before or if it's even a bug.

But we know that Coercible (a -> f b) (a -> WF f b) so why doesn't this work?

Trac metadata
Trac field Value
Version 8.2.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Edited by Simon Peyton Jones
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information