Skip to content

Core Lint error while compiling text-builder-linear with GHC 9.4

Summary

text-builder-linear-0.1.1 fails to compile with -dcore-lint

Steps to reproduce

$ cabal get text-builder-linear-0.1.1
$ cd text-builder-linear-0.1.1
$ cat > cabal.project << EOF
packages: .
package servant-conduit
  ghc-options: -dcore-lint
EOF
$ cabal build
Building library for text-builder-linear-0.1.1..
[1 of 7] Compiling Data.Text.Builder.Linear.Core ( src/Data/Text/Builder/Linear/Core.hs, dist/build/Data/Text/Builder/Linear/Core.o, dist/build/Data/Text/Builder/Linear/Core.dyn_o )
[2 of 7] Compiling Data.Text.Builder.Linear.Char ( src/Data/Text/Builder/Linear/Char.hs, dist/build/Data/Text/Builder/Linear/Char.o, dist/build/Data/Text/Builder/Linear/Char.dyn_o )
[3 of 7] Compiling Data.Text.Builder.Linear.Dec ( src/Data/Text/Builder/Linear/Dec.hs, dist/build/Data/Text/Builder/Linear/Dec.o, dist/build/Data/Text/Builder/Linear/Dec.dyn_o )
[4 of 7] Compiling Data.Text.Builder.Linear.Double ( src/Data/Text/Builder/Linear/Double.hs, dist/build/Data/Text/Builder/Linear/Double.o, dist/build/Data/Text/Builder/Linear/Double.dyn_o )
[5 of 7] Compiling Data.Text.Builder.Linear.Hex ( src/Data/Text/Builder/Linear/Hex.hs, dist/build/Data/Text/Builder/Linear/Hex.o, dist/build/Data/Text/Builder/Linear/Hex.dyn_o )
[6 of 7] Compiling Data.Text.Builder.Linear.Buffer ( src/Data/Text/Builder/Linear/Buffer.hs, dist/build/Data/Text/Builder/Linear/Buffer.o, dist/build/Data/Text/Builder/Linear/Buffer.dyn_o )
*** Core Lint errors : in result of Desugar (before optimization) ***
src/Data/Text/Builder/Linear/Buffer.hs:153:9: warning:
    Linearity failure in lambda: acc_abah
    'Many ⊈ 'One
    In the RHS of foldlIntoBuffer :: forall a.
                                     (Buffer %1 -> a -> Buffer) -> Buffer %1 -> [a] -> Buffer
    In the body of lambda with binder a_abbP :: *
    In the body of lambda with binder f_abaf :: Buffer
                                                %1 -> a_abbP -> Buffer
    In the RHS of go_abag :: Buffer %1 -> [a_abbP] -> Buffer
    In the body of lambda with binder acc_abah :: Buffer
    Substitution: [TCvSubst
                     In scope: InScope {a_abbP}
                     Type env: [abbP :-> a_abbP]
                     Co env: []]
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information