[GHC] #14694: Can't coerce given assumptions
GHC
ghc-devs at haskell.org
Tue Jan 23 19:47:46 UTC 2018
#14694: Can't coerce given assumptions
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.2.2
Resolution: | Keywords: Roles
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Iceland_jack):
I don't remember a place where we collect them, we can make one & I can go
through my old tickets in search for examples.
Here is another one maybe:
{{{#!hs
{-# Language FlexibleContexts #-}
import Data.Coerce
class Exp repr where
int :: Int -> repr Int
newtype Coerce f a = Coerce (f a)
-- /tmp/Test.hs:13:9: error:
-- • Couldn't match representation of type ‘f Int’ with that of ‘Int’
-- arising from a use of ‘coerce’
-- • In the expression: coerce
-- In an equation for ‘int’: int = coerce
-- In the instance declaration for ‘Exp (Coerce f)’
-- • Relevant bindings include
-- int :: Int -> Coerce f Int (bound at /tmp/Test.hs:13:3)
-- |
-- 13 | int = coerce
-- | ^^^^^^
instance Coercible Int (f Int) => Exp (Coerce f) where
int = coerce
}}}
but it works with `int = Coerce . coerce`.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14694#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list