Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

cannot derive instance #263

Closed
paolino opened this Issue · 5 comments

3 participants

@paolino

trying to compile with ghc 7.8

had to remove deriving instances for Num (Sum a) and Num (Product a)
had to lift HCodec <0.4 (unsafeThaw undefined)

I couldn't resolve the deriving instance Distributive Behavior
[30 of 71] Compiling Music.Time.Behavior ( src/Music/Time/Behavior.hs, dist/build/Music/Time/Behavior.o )

src/Music/Time/Behavior.hs:146:1:
Could not coerce from ‘f1 (Time -> a1)’ to ‘f1 (Behavior a1)’
because ‘f1 (Time -> a1)’ and ‘f1 (Behavior
a1)’ are different types.
arising from a use of ‘ghc-prim:GHC.Prim.coerce’
from the context (Functor f)
bound by the type signature for
distribute :: Functor f => f (Behavior a) -> Behavior (f a)
at src/Music/Time/Behavior.hs:146:1-39
or from (Functor f1)
bound by an expression type signature:
Functor f1 => f1 (Behavior a1) -> Behavior (f1 a1)
at src/Music/Time/Behavior.hs:146:1-39
In the expression:
ghc-prim:GHC.Prim.coerce
(distribute :: f (Time -> a) -> Time -> f a) ::
forall (f :: * -> *) (a :: *). Functor f =>
f (Behavior a) -> Behavior (f a)
In an equation for ‘distribute’:
distribute
= ghc-prim:GHC.Prim.coerce
(distribute :: f (Time -> a) -> Time -> f a) ::
forall (f :: * -> *) (a :: *). Functor f =>
f (Behavior a) -> Behavior (f a)
When typechecking the code for ‘distribute’
in a standalone derived instance for ‘Distributive Behavior’:
To see the code I am typechecking, use -ddump-deriv
In the instance declaration for ‘Distributive Behavior’

src/Music/Time/Behavior.hs:146:1:
Could not coerce from ‘m1 (Time -> a1)’ to ‘m1 (Behavior a1)’
because ‘m1 (Time -> a1)’ and ‘m1 (Behavior
a1)’ are different types.
arising from a use of ‘ghc-prim:GHC.Prim.coerce’
from the context (Monad m)
bound by the type signature for
distributeM :: Monad m => m (Behavior a) -> Behavior (m a)
at src/Music/Time/Behavior.hs:146:1-39
or from (Monad m1)
bound by an expression type signature:
Monad m1 => m1 (Behavior a1) -> Behavior (m1 a1)
at src/Music/Time/Behavior.hs:146:1-39
In the expression:
ghc-prim:GHC.Prim.coerce
(distributeM :: m (Time -> a) -> Time -> m a) ::
forall (m :: * -> *) (a :: *). Monad m =>
m (Behavior a) -> Behavior (m a)
In an equation for ‘distributeM’:
distributeM
= ghc-prim:GHC.Prim.coerce
(distributeM :: m (Time -> a) -> Time -> m a) ::
forall (m :: * -> *) (a :: *). Monad m =>
m (Behavior a) -> Behavior (m a)
When typechecking the code for ‘distributeM’
in a standalone derived instance for ‘Distributive Behavior’:
To see the code I am typechecking, use -ddump-deriv
In the instance declaration for ‘Distributive Behavior’

@hanshoglund hanshoglund modified the milestone: v1.8, v1.7.1
@hanshoglund
Owner

Related issue: #267

@hanshoglund hanshoglund modified the milestone: v1.8, v1.7.1
@ScrambledEggsOnToast
Collaborator

Any updates on this bug?

@hanshoglund hanshoglund referenced this issue from a commit
@hanshoglund hanshoglund Manually provide 'Distribute' instances
For some reason, GHC >= 7.8 can not derive these

See #263
fbb4734
@hanshoglund
Owner

Try the latest code. I don't have a GHC 7.8 around to test unfortunately...

@hanshoglund hanshoglund modified the milestone: v1.7.1, v1.8
@paolino
@hanshoglund
Owner

The dependency is fixed in master, I will do a new release today so you can try it from Hackage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.