Open ggreif opened 9 years ago
This fails in ghc-7.10.1 too, but this simplifying declaration works:
data At :: * -> k -> k -> * where At :: a -> At a k k
deriving Typeable
deriving instance (Data a, Typeable (At a i j), i ~ j) => Data (At a i j)
I can't tell if the derived instance would be as useful, or if this is a sign of a bug in the Typeable
machinery.
This looks like a bug. It also pulls in
{-# LANGUAGE DeriveDataTypeable, FlexibleContexts, UndecidableInstances #-}
@michaelt to get it compiling I also had to change here:
@@ -21,7 +21,7 @@
module Indexed.Types
(
-- * Natural Transformations
- (~>)()
+ type (~>)()
, (:~>)(Nat,($$))
-- * Limits
, Lim
did you see this too with 7.10.1 ?
All the changes I have together so far:
diff --git a/src/Indexed/Types.hs b/src/Indexed/Types.hs
index 7af5513..bc7fb36 100644
--- a/src/Indexed/Types.hs
+++ b/src/Indexed/Types.hs
@@ -6,7 +6,7 @@
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE ScopedTypeVariables #-}
-{-# LANGUAGE DeriveDataTypeable #-}
+{-# LANGUAGE DeriveDataTypeable, FlexibleContexts, UndecidableInstances #-}
-----------------------------------------------------------------------------
-- |
-- Module : Indexed.Types
@@ -21,7 +21,7 @@
module Indexed.Types
(
-- * Natural Transformations
- (~>)()
+ type (~>)
, (:~>)(Nat,($$))
-- * Limits
, Lim
@@ -139,7 +139,7 @@ instance (Monoid m, i ~ j) => Monoid (At m i j) where
-- | Type alias for indexed monads, functors, etc. in Bob Atkey's style.
type Atkey f i j a = f (At a j) i
-instance (Data a, Typeable i, i ~ j) => Data (At a i j) where
+instance (Data a, Typeable (At a i j), i ~ j) => Data (At a i j) where
gfoldl f z (At a) = z At `f` a
toConstr _ = atConstr
gunfold k z c = case constrIndex c of
@@ -190,7 +190,7 @@ uncoat (Coat a) = a
-- | Type alias for indexed monads, functors, etc. in Bob Atkey's style.
type Coatkey f i j a = f (Coat a j) i
-instance (Data a, Typeable i, i ~ j) => Data (Coat a i j) where
+instance (Data a, Typeable (Coat a i j), i ~ j) => Data (Coat a i j) where
gfoldl f z (Coat a) = z (\x -> Coat x) `f` a
toConstr _ = coatConstr
gunfold k z c = case constrIndex c of
That was with
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE UndecidableInstances #-}
by the way. Elsewhere we run into trouble with Coat
:
imapCoat :: (IFunctor f) => (a -> b) -> f (Coat a i) ~> f (Coat b i)
imapCoat f = imap $ \ c -> Coat $ case c of Coat a -> f a
{-# INLINE imapCoat #-}
Like a number of similar definitions, this yields:
Couldn't match type ‘i’ with ‘x1’
‘i’ is a rigid type variable bound by
the type signature for
imapCoat :: IFunctor f => (a -> b) -> f (Coat a i) ~> f (Coat b i)
at src/Indexed/Functor.hs:65:13
‘x1’ is a rigid type variable bound by
a type expected by the context: Coat a i x1 -> Coat b i x1
at src/Indexed/Functor.hs:66:14
Expected type: Coat b i x1
Actual type: Coat b x1 x1
Relevant bindings include
c :: Coat a i x1 (bound at src/Indexed/Functor.hs:66:23)
imapCoat :: (a -> b) -> f (Coat a i) ~> f (Coat b i)
(bound at src/Indexed/Functor.hs:66:1)
In the expression: Coat $ case c of { Coat a -> f a }
In the second argument of ‘($)’, namely
‘\ c -> Coat $ case c of { Coat a -> f a }’
In the expression: imap $ \ c -> Coat $ case c of { Coat a -> f a }
@ggreif Sorry, I missed those intervening messages, I think I had the text box open for the above. If you make the changes you mentioned, does the rest of the package compile with HEAD? As I said, it seems still to break when it gets to Index.Functor with ghc-7.10.1
Hi! any update on this build issue on ghc 7.10?
It looks like the diff by @ggreif works for me with ghc 7.10.2. (at least compilable, haven't tested it yet)
Ah. I have this error now.
[16 of 16] Compiling Indexed.Comonad.Store ( src/Indexed/Comonad/Store.hs, dist/build/Indexed/Comonad/Store.o )
src/Indexed/Comonad/Store.hs:18:21:
The second argument of ‘~>’ should have kind ‘u1 -> *’,
but ‘s’ has kind ‘v1 -> *’
In the type ‘w a ~> s’
In the class declaration for ‘IComonadStore’
I get below errors when building with HEAD GHC
I did not analyse why this happens.