ekmett / profunctors

Haskell 98 Profunctors
http://hackage.haskell.org/package/profunctors
Other
70 stars 43 forks source link

Fails to compile with GHC 7.0.4 #22

Closed hvr closed 9 years ago

hvr commented 9 years ago

TLDR: either fix w/ GHC 7.0 or set base >= 4.5 to declare it only works with GHC 7.4 and later :-)

fails with

src/Data/Profunctor/Tambara.hs:53:30:
    Couldn't match type `t7' with `c'
      because type variable `c' would escape its scope
    This (rigid, skolem) type variable is bound by
      a type expected by the context: Tambara p (a, c) (b, c)
    The following variables have types that mention t7
      yon :: (b, (t7, t6)) -> ((b, t7), t6)
        (bound at src/Data/Profunctor/Tambara.hs:55:5)
    In the first argument of `Tambara', namely
      `(Tambara $ dimap hither yon p)'
    In the expression: Tambara (Tambara $ dimap hither yon p)
    In an equation for `produplicate':
        produplicate (Tambara p)
          = Tambara (Tambara $ dimap hither yon p)
          where
              hither ~(~(x, y), z) = (x, (y, z))
              yon ~(x, ~(y, z)) = ((x, y), z)

src/Data/Profunctor/Tambara.hs:53:30:
    Couldn't match type `t8' with `c'
      because type variable `c' would escape its scope
    This (rigid, skolem) type variable is bound by
      a type expected by the context: Tambara p (a, c) (b, c)
    The following variables have types that mention t8
      hither :: ((a, t8), t9) -> (a, (t8, t9))
        (bound at src/Data/Profunctor/Tambara.hs:54:5)
    In the first argument of `Tambara', namely
      `(Tambara $ dimap hither yon p)'
    In the expression: Tambara (Tambara $ dimap hither yon p)
    In an equation for `produplicate':
        produplicate (Tambara p)
          = Tambara (Tambara $ dimap hither yon p)
          where
              hither ~(~(x, y), z) = (x, (y, z))
              yon ~(x, ~(y, z)) = ((x, y), z)

src/Data/Profunctor/Tambara.hs:53:39:
    Couldn't match type `t9' with `c1'
      because type variable `c1' would escape its scope
    This (rigid, skolem) type variable is bound by
      a type expected by the context: p ((a, c), c1) ((b, c), c1)
    The following variables have types that mention t9
      hither :: ((a, t8), t9) -> (a, (t8, t9))
        (bound at src/Data/Profunctor/Tambara.hs:54:5)
    In the second argument of `($)', namely `dimap hither yon p'
    In the first argument of `Tambara', namely
      `(Tambara $ dimap hither yon p)'
    In the expression: Tambara (Tambara $ dimap hither yon p)

src/Data/Profunctor/Tambara.hs:53:39:
    Couldn't match type `t6' with `c1'
      because type variable `c1' would escape its scope
    This (rigid, skolem) type variable is bound by
      a type expected by the context: p ((a, c), c1) ((b, c), c1)
    The following variables have types that mention t6
      yon :: (b, (t7, t6)) -> ((b, t7), t6)
        (bound at src/Data/Profunctor/Tambara.hs:55:5)
    In the second argument of `($)', namely `dimap hither yon p'
    In the first argument of `Tambara', namely
      `(Tambara $ dimap hither yon p)'
    In the expression: Tambara (Tambara $ dimap hither yon p)

src/Data/Profunctor/Tambara.hs:62:23:
    Couldn't match type `t4' with `c1'
      because type variable `c1' would escape its scope
    This (rigid, skolem) type variable is bound by
      a type expected by the context: p (Either a c, c1) (Either b c, c1)
    The following variables have types that mention t4
      yon :: Either (b, t4) (c, t4) -> (Either b c, t4)
        (bound at src/Data/Profunctor/Tambara.hs:65:5)
    In the second argument of `($)', namely
      `dimap hither yon $ left' f'
    In the expression: Tambara $ dimap hither yon $ left' f
    In an equation for `left'':
        left' (Tambara f)
          = Tambara $ dimap hither yon $ left' f
          where
              hither (Left y, s) = Left (y, s)
              hither (Right z, s) = Right (z, s)
              yon (Left (y, s)) = (Left y, s)
              yon (Right (z, s)) = (Right z, s)

src/Data/Profunctor/Tambara.hs:62:23:
    Couldn't match type `t5' with `c1'
      because type variable `c1' would escape its scope
    This (rigid, skolem) type variable is bound by
      a type expected by the context: p (Either a c, c1) (Either b c, c1)
    The following variables have types that mention t5
      hither :: (Either a c, t5) -> Either (a, t5) (c, t5)
        (bound at src/Data/Profunctor/Tambara.hs:63:5)
    In the second argument of `($)', namely
      `dimap hither yon $ left' f'
    In the expression: Tambara $ dimap hither yon $ left' f
    In an equation for `left'':
        left' (Tambara f)
          = Tambara $ dimap hither yon $ left' f
          where
              hither (Left y, s) = Left (y, s)
              hither (Right z, s) = Right (z, s)
              yon (Left (y, s)) = (Left y, s)
              yon (Right (z, s)) = (Right z, s)

src/Data/Profunctor/Tambara.hs:74:23:
    Couldn't match type `t3' with `c1'
      because type variable `c1' would escape its scope
    This (rigid, skolem) type variable is bound by
      a type expected by the context: p ((b, d), c1) ((c, d), c1)
    The following variables have types that mention t3
      go :: ((b, t2), t3) -> ((b, t3), t2)
        (bound at src/Data/Profunctor/Tambara.hs:75:5)
    In the first argument of `Tambara', namely
      `(arr go . first f . arr go)'
    In the expression: Tambara (arr go . first f . arr go)
    In an equation for `first':
        first (Tambara f)
          = Tambara (arr go . first f . arr go)
          where
              go ~(~(x, y), z) = ((x, z), y)

src/Data/Profunctor/Tambara.hs:74:23:
    Couldn't match type `t2' with `c1'
      because type variable `c1' would escape its scope
    This (rigid, skolem) type variable is bound by
      a type expected by the context: p ((b, d), c1) ((c, d), c1)
    The following variables have types that mention t2
      go :: ((b, t2), t3) -> ((b, t3), t2)
        (bound at src/Data/Profunctor/Tambara.hs:75:5)
    In the first argument of `Tambara', namely
      `(arr go . first f . arr go)'
    In the expression: Tambara (arr go . first f . arr go)
    In an equation for `first':
        first (Tambara f)
          = Tambara (arr go . first f . arr go)
          where
              go ~(~(x, y), z) = ((x, z), y)

src/Data/Profunctor/Tambara.hs:74:47:
    Could not deduce (c ~ b)
    from the context (Arrow p)
      bound by the instance declaration
      at src/Data/Profunctor/Tambara.hs:72:10-37
      `c' is a rigid type variable bound by
          the type signature for
            first :: Tambara p b c -> Tambara p (b, d) (c, d)
          at src/Data/Profunctor/Tambara.hs:74:3
      `b' is a rigid type variable bound by
          the type signature for
            first :: Tambara p b c -> Tambara p (b, d) (c, d)
          at src/Data/Profunctor/Tambara.hs:74:3
    Expected type: p (b, t2) (b, t2)
      Actual type: p (b, t2) (c, t2)
    In the first argument of `first', namely `f'
    In the first argument of `(.)', namely `first f'

src/Data/Profunctor/Tambara.hs:74:55:
    Could not deduce (d ~ c1)
    from the context (Arrow p)
      bound by the instance declaration
      at src/Data/Profunctor/Tambara.hs:72:10-37
      `d' is a rigid type variable bound by
          the type signature for
            first :: Tambara p b c -> Tambara p (b, d) (c, d)
          at src/Data/Profunctor/Tambara.hs:74:3
      `c1' is a rigid type variable bound by
           a type expected by the context: p ((b, d), c1) ((c, d), c1)
           at src/Data/Profunctor/Tambara.hs:74:23
    Expected type: d
      Actual type: t2
    Expected type: ((b, d), c) -> ((b, t2), t3)
      Actual type: ((b, t2), t3) -> ((b, t3), t2)
    In the first argument of `arr', namely `go'
    In the second argument of `(.)', namely `arr go'

src/Data/Profunctor/Tambara.hs:78:22:
    Couldn't match type `t0' with `c1'
      because type variable `c1' would escape its scope
    This (rigid, skolem) type variable is bound by
      a type expected by the context: p (Either b d, c1) (Either c d, c1)
    The following variables have types that mention t0
      yon :: Either (c, t0) (d, t0) -> (Either c d, t0)
        (bound at src/Data/Profunctor/Tambara.hs:81:5)
    In the first argument of `Tambara', namely
      `(arr yon . left f . arr hither)'
    In the expression: Tambara (arr yon . left f . arr hither)
    In an equation for `left':
        left (Tambara f)
          = Tambara (arr yon . left f . arr hither)
          where
              hither (Left y, s) = Left (y, s)
              hither (Right z, s) = Right (z, s)
              yon (Left (y, s)) = (Left y, s)
              yon (Right (z, s)) = (Right z, s)

src/Data/Profunctor/Tambara.hs:78:22:
    Couldn't match type `t1' with `c1'
      because type variable `c1' would escape its scope
    This (rigid, skolem) type variable is bound by
      a type expected by the context: p (Either b d, c1) (Either c d, c1)
    The following variables have types that mention t1
      hither :: (Either b d, t1) -> Either (b, t1) (d, t1)
        (bound at src/Data/Profunctor/Tambara.hs:79:5)
    In the first argument of `Tambara', namely
      `(arr yon . left f . arr hither)'
    In the expression: Tambara (arr yon . left f . arr hither)
    In an equation for `left':
        left (Tambara f)
          = Tambara (arr yon . left f . arr hither)
          where
              hither (Left y, s) = Left (y, s)
              hither (Right z, s) = Right (z, s)
              yon (Left (y, s)) = (Left y, s)
              yon (Right (z, s)) = (Right z, s)

src/Data/Profunctor/Tambara.hs:88:46:
    Could not deduce (c ~ b)
    from the context (ArrowLoop p)
      bound by the instance declaration
      at src/Data/Profunctor/Tambara.hs:87:10-45
      `c' is a rigid type variable bound by
          the type signature for
            loop :: Tambara p (b, d) (c, d) -> Tambara p b c
          at src/Data/Profunctor/Tambara.hs:88:3
      `b' is a rigid type variable bound by
          the type signature for
            loop :: Tambara p (b, d) (c, d) -> Tambara p b c
          at src/Data/Profunctor/Tambara.hs:88:3
    Expected type: p ((b, d), d) ((b, d), d)
      Actual type: p ((b, d), d) ((c, d), d)
    In the first argument of `(.)', namely `f'
    In the second argument of `(.)', namely `f . arr go'

src/Data/Profunctor/Tambara.hs:88:54:
    Could not deduce (c1 ~ d)
    from the context (ArrowLoop p)
      bound by the instance declaration
      at src/Data/Profunctor/Tambara.hs:87:10-45
      `c1' is a rigid type variable bound by
           a type expected by the context: p (b, c1) (c, c1)
           at src/Data/Profunctor/Tambara.hs:88:22
      `d' is a rigid type variable bound by
          the type signature for
            loop :: Tambara p (b, d) (c, d) -> Tambara p b c
          at src/Data/Profunctor/Tambara.hs:88:3
    Expected type: ((b, c), d) -> ((b, d), d)
      Actual type: ((b, d), d) -> ((b, d), d)
    In the first argument of `arr', namely `go'
    In the second argument of `(.)', namely `arr go'

src/Data/Profunctor/Tambara.hs:170:32:
    Couldn't match type `b1' with `c'
      because type variable `c' would escape its scope
    This (rigid, skolem) type variable is bound by
      a type expected by the context:
        Cotambara p (Either a c) (Either b c)
    The following variables have types that mention b1
      yon :: Either b (Either b1 b0) -> Either (Either b b1) b0
        (bound at src/Data/Profunctor/Tambara.hs:174:5)
    In the first argument of `Cotambara', namely
      `(Cotambara $ dimap hither yon p)'
    In the expression: Cotambara (Cotambara $ dimap hither yon p)
    In an equation for `produplicate':
        produplicate (Cotambara p)
          = Cotambara (Cotambara $ dimap hither yon p)
          where
              hither (Left (Left x)) = Left x
              hither (Left (Right y)) = Right (Left y)
              hither (Right z) = Right (Right z)
              yon (Left x) = Left (Left x)
              yon (Right (Left y)) = Left (Right y)
              yon (Right (Right z)) = Right z

src/Data/Profunctor/Tambara.hs:170:32:
    Couldn't match type `a0' with `c'
      because type variable `c' would escape its scope
    This (rigid, skolem) type variable is bound by
      a type expected by the context:
        Cotambara p (Either a c) (Either b c)
    The following variables have types that mention a0
      hither :: Either (Either a a0) b2 -> Either a (Either a0 b2)
        (bound at src/Data/Profunctor/Tambara.hs:171:5)
    In the first argument of `Cotambara', namely
      `(Cotambara $ dimap hither yon p)'
    In the expression: Cotambara (Cotambara $ dimap hither yon p)
    In an equation for `produplicate':
        produplicate (Cotambara p)
          = Cotambara (Cotambara $ dimap hither yon p)
          where
              hither (Left (Left x)) = Left x
              hither (Left (Right y)) = Right (Left y)
              hither (Right z) = Right (Right z)
              yon (Left x) = Left (Left x)
              yon (Right (Left y)) = Left (Right y)
              yon (Right (Right z)) = Right z

src/Data/Profunctor/Tambara.hs:170:43:
    Couldn't match type `b2' with `c1'
      because type variable `c1' would escape its scope
    This (rigid, skolem) type variable is bound by
      a type expected by the context:
        p (Either (Either a c) c1) (Either (Either b c) c1)
    The following variables have types that mention b2
      hither :: Either (Either a a0) b2 -> Either a (Either a0 b2)
        (bound at src/Data/Profunctor/Tambara.hs:171:5)
    In the second argument of `($)', namely `dimap hither yon p'
    In the first argument of `Cotambara', namely
      `(Cotambara $ dimap hither yon p)'
    In the expression: Cotambara (Cotambara $ dimap hither yon p)

src/Data/Profunctor/Tambara.hs:170:43:
    Couldn't match type `b0' with `c1'
      because type variable `c1' would escape its scope
    This (rigid, skolem) type variable is bound by
      a type expected by the context:
        p (Either (Either a c) c1) (Either (Either b c) c1)
    The following variables have types that mention b0
      yon :: Either b (Either b1 b0) -> Either (Either b b1) b0
        (bound at src/Data/Profunctor/Tambara.hs:174:5)
    In the second argument of `($)', namely `dimap hither yon p'
    In the first argument of `Cotambara', namely
      `(Cotambara $ dimap hither yon p)'
    In the expression: Cotambara (Cotambara $ dimap hither yon p)
cabal: Error: some packages failed to install:
profunctors-4.4.1 failed during the building phase. The exception was:
ExitFailure 1
ekmett commented 9 years ago

base bounds were set, but we never closed this issue. Fixing that now.

RyanGlScott commented 9 years ago

This issue still persists when installing profunctors-5.1 on GHC 7.0.4, but it specifies base >= 4 && < 5. Should this be changed?

ekmett commented 9 years ago

I widened the bounds when I removed the obvious dependencies on 7.4, but I wasn't able to test on ghc 7.2 or 7.0 because of limitations in the multi-ghc travis configuration. Do you have an ability to test with 7.2 to see if it is just a 7.0 thing? I can then set the bound accordingly.

RyanGlScott commented 9 years ago

I can replicate the error on GHC 7.2, so it's probably caused by this issue. Luckily, it can be fixed by adding explicit type signatures, so I submitted a pull request to fix this.

I've encountered the same issue you're having with GHC 7.0/7.2 on Travis, and unforunately, it looks like it's due to a nasty regression in cabal. Requiring all of my Travis builds to use cabal 1.18 or higher seems to make the problem go away.