foundation icon indicating copy to clipboard operation
foundation copied to clipboard

basement 0.0.13 fails to build with GHC 8.0.2

Open IamfromSpace opened this issue 3 years ago • 3 comments

Hello, I've run into an issue found by our build pipelines, where the newly released version of basement does not appear to build against GHC 8.0.2: https://github.com/Nike-Inc/hal/runs/5365017586?check_suite_focus=true

Compiling results in the following error:

Basement/String.hs:[240](https://github.com/Nike-Inc/hal/runs/5365017586?check_suite_focus=true#step:6:240):5: error:
Error:     • Pattern bindings containing unlifted types should use an outermost bang pattern:
        b@(W8# b#) = getter off
    • In an equation for ‘nextWithIndexer’:
          nextWithIndexer getter off
            = case getNbBytes# b# of {
                0# -> (toChar h, off + 1)
                1# -> (toChar (decode2 (getter $ off + 1)), off + 2)
                2#
                  -> (toChar (decode3 (getter $ off + 1) (getter $ off + 2)), 
                      off + 3)
                3#
                  -> (toChar
                        (decode4
                           (getter $ off + 1) (getter $ off + 2) (getter $ off + 3)), 
                      off + 4)
                r -> error
                       ("next: internal error: invalid input: "
                        <> show (I# r) <> " " <> show (W# h)) }
            where
                b@(W8# b#) = getter off
                !(W# h) = integralUpsize b
                toChar :: Word# -> Char
                toChar w = C# (chr# (word2Int# w))
                ....

Basement/String.hs:[241](https://github.com/Nike-Inc/hal/runs/5365017586?check_suite_focus=true#step:6:241):15: error:
Error:     • Ambiguous type variable ‘a0’ arising from a use of ‘integralUpsize’
      prevents the constraint ‘(IntegralUpsize
                                  a0 Word)’ from being solved.
      Probable fix: use a type annotation to specify what ‘a0’ should be.
      These potential instances exist:
        instance IntegralUpsize Word16 Word
          -- Defined at Basement/IntegralConv.hs:106:10
        instance IntegralUpsize Word32 Word
          -- Defined at Basement/IntegralConv.hs:111:10
        instance IntegralUpsize Word8 Word
          -- Defined at Basement/IntegralConv.hs:91:10
    • In the expression: integralUpsize b
      In a pattern binding: !(W# h) = integralUpsize b
      In an equation for ‘nextWithIndexer’:
          nextWithIndexer getter off
            = case getNbBytes# b# of {
                0# -> (toChar h, off + 1)
                1# -> (toChar (decode2 (getter $ off + 1)), off + 2)
                2#
                  -> (toChar (decode3 (getter $ off + 1) (getter $ off + 2)), 
                      off + 3)
                3#
                  -> (toChar
                        (decode4
                           (getter $ off + 1) (getter $ off + 2) (getter $ off + 3)), 
                      off + 4)
                r -> error
                       ("next: internal error: invalid input: "
                        <> show (I# r) <> " " <> show (W# h)) }
            where
                b@(W8# b#) = getter off
                !(W# h) = integralUpsize b
                toChar :: Word# -> Char
                toChar w = C# (chr# (word2Int# w))
                ....

If dropping support is intentional, it would make sense to simply tighten down the bounds with a new revision. In the mean time, this is not an immediate concern as I'll drop 8.0.2 support for the moment. Just wanted to get this visible to folks, cheers!

IamfromSpace avatar Feb 28 '22 22:02 IamfromSpace

It would indeed be nice to have a revision for this

juhp avatar Mar 13 '22 17:03 juhp

Me too.

Revision to base >= 4.10 here: https://hackage.haskell.org/package/basement-0.0.13/revisions/

Ideally, one would have revised the if impl(ghc < 8.0) buildable: False to ...8.2..., but Hackage doesn't allow revision of if-conditions.

andreasabel avatar Mar 30 '22 17:03 andreasabel

@vincenthz : This issue is fixed now and can be closed.

andreasabel avatar Mar 31 '22 05:03 andreasabel