conal / ftree

Depth-typed functor-based trees, both top-down and bottom-up
Other
3 stars 1 forks source link

Could not deduce (Semigroup ((:^) f n m)) #1

Closed jrp2014 closed 5 years ago

jrp2014 commented 5 years ago

Conal, I haven't succeeded in producing a Semigroup instance that ghc will recognise with 8.6.3. The obvious one doesn't make any difference to me. Any suggestions, please? Thanks, John

Preprocessing library for ftree-0.1.4..
Building library for ftree-0.1.4..
[1 of 2] Compiling Data.FTree.BottomUp ( src/Data/FTree/BottomUp.hs, /ftree/dist-newstyle/build/x86_64-linux/ghc-8.6.3/ftree-0.1.4/build/Data/FTree/BottomUp.o )

src/Data/FTree/BottomUp.hs:88:1: warning: [-Woverlapping-patterns]
    Pattern match is redundant
    In an equation for ‘inT2’: inT2 _ _ _ _ = ...
   |
88 | inT2 _ _ _ _ = error "inT2: unhandled case"  -- Possible??
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2 of 2] Compiling Data.FTree.TopDown ( src/Data/FTree/TopDown.hs dist-newstyle/build/x86_64-linux/ghc-8.6.3/ftree-0.1.4/build/Data/FTree/TopDown.o )

src/Data/FTree/TopDown.hs:160:10: error:
    • Could not deduce (Semigroup ((:^) f n m))
        arising from the superclasses of an instance declaration
      from the context: (IsNat n, Applicative f, Monoid m)
        bound by the instance declaration
        at src/Data/FTree/TopDown.hs:160:10-66
    • In the instance declaration for ‘Monoid ((:^) f n m)’
    |
160 | instance (IsNat n, Applicative f, Monoid m) => Monoid ((f :^ n) m) where
jrp2014 commented 5 years ago

I've now created a pull request that gets this to compile. (Mainly by removing an import.) Ready for rerelease.

conal commented 5 years ago

Fixed in PR #2.

jrp2014 commented 5 years ago

I think that if we add semigroups to the build-dependencies, it may be possible for this to build with even older GHCs.

conal commented 5 years ago

Good idea!