jcpetruzza / barbies

BSD 3-Clause "New" or "Revised" License
92 stars 15 forks source link

Does not compile with ghc 8.8.1 #20

Closed alexpeits closed 4 years ago

alexpeits commented 4 years ago

Trying to compile using ghc-8.8.1 gives the following compilation errors:

Preprocessing library for barbies-1.1.2.1..
Building library for barbies-1.1.2.1..
[ 1 of 17] Compiling Data.Barbie.Internal.Dicts
[ 2 of 17] Compiling Data.Barbie.Internal.Wear
[ 3 of 17] Compiling Data.Functor.Prod
[ 4 of 17] Compiling Data.Generics.GenericN
[ 5 of 17] Compiling Data.Barbie.Internal.Functor
[ 6 of 17] Compiling Data.Barbie.Internal.Traversable
[ 7 of 17] Compiling Data.Barbie.Internal.Product

/home/alex/projects/forks/barbies/src/Data/Barbie/Internal/Product.hs:163:19: error:
    • Expecting one more argument to ‘f’
      Expected a type, but ‘f’ has kind ‘k1 -> *’
    • In the type ‘f’
      In the second argument of ‘($)’, namely
        ‘gbprod @f @g (fromN l) (fromN r)’
      In the expression: toN $ gbprod @f @g (fromN l) (fromN r)
    • Relevant bindings include
        r :: b g (bound at src/Data/Barbie/Internal/Product.hs:162:17)
        l :: b f (bound at src/Data/Barbie/Internal/Product.hs:162:15)
        gbprodDefault :: b f -> b g -> b (Product f g)
          (bound at src/Data/Barbie/Internal/Product.hs:162:1)
    |                
163 |   = toN $ gbprod @f @g (fromN l) (fromN r)
    |                   ^

/home/alex/projects/forks/barbies/src/Data/Barbie/Internal/Product.hs:168:18: error:
    • Expecting one more argument to ‘f’
      Expected a type, but ‘f’ has kind ‘k -> *’
    • In the type ‘f’
      In the first argument of ‘toN’, namely
        ‘(gbuniq @f @f @_ @(RepN (b f)) @(RepN (b (f `Product` f))) x)’
      In the expression:
        toN (gbuniq @f @f @_ @(RepN (b f)) @(RepN (b (f `Product` f))) x)
    • Relevant bindings include
        x :: forall (a :: k). f a
          (bound at src/Data/Barbie/Internal/Product.hs:167:15)
        gbuniqDefault :: (forall (a :: k). f a) -> b f
          (bound at src/Data/Barbie/Internal/Product.hs:167:1)
    |                
168 |   = toN (gbuniq @f @f @_ @(RepN (b f)) @(RepN (b (f `Product` f))) x)
    |                  ^

/home/alex/projects/forks/barbies/src/Data/Barbie/Internal/Product.hs:183:38: error:
    • Expecting one more argument to ‘f’
      Expected a type, but ‘f’ has kind ‘k3 -> *’
    • In the type ‘f’
      In the first argument of ‘M1’, namely ‘(gbprod @f @g l r)’
      In the expression: M1 (gbprod @f @g l r)
    |                
183 |   gbprod (M1 l) (M1 r) = M1 (gbprod @f @g l r)
    |                                      ^

/home/alex/projects/forks/barbies/src/Data/Barbie/Internal/Product.hs:210:23: error:
    • Expecting one more argument to ‘f’
      Expected a type, but ‘f’ has kind ‘k2 -> *’
    • In the type ‘f’
      In the first argument of ‘(:*:)’, namely
        ‘gbuniq @f @g @lf @lg @lfg x’
      In the expression:
        (gbuniq @f @g @lf @lg @lfg x :*: gbuniq @f @g @rf @rg @rfg x)
    • Relevant bindings include
        x :: forall (a :: k2). f a
          (bound at src/Data/Barbie/Internal/Product.hs:210:10)
        gbuniq :: (forall (a :: k2). f a) -> (:*:) lf rf x
          (bound at src/Data/Barbie/Internal/Product.hs:210:3)
    |                
210 |   gbuniq x = (gbuniq @f @g @lf @lg @lfg x :*: gbuniq @f @g @rf @rg @rfg x)
    |                       ^

This is probably related to the way ghc >= 8.8 handles MonoLocalBinds, which is enabled implicitly when TypeFamilies is enabled. This blog post describes this in more detail.

To reproduce this issue, change resolver to nightly-2019-10-18 in stack.yaml and run stack build (I can also provide a minimal nix derivation if it makes things easier)

jcpetruzza commented 4 years ago

This is fixed on master already. I haven't made a release yet since I'm planning a major one and waiting on finishing a couple of additional things I'd like in.

alexpeits commented 4 years ago

Indeed, I was working on an old fork and forgot to update from upstream :sweat_smile: