quchen / prettyprinter

A modern, extensible and well-documented prettyprinter.
BSD 2-Clause "Simplified" License
293 stars 34 forks source link

prettyprinter-ansi-terminal is not compatible with -text option #250

Open BinderDavid opened 6 months ago

BinderDavid commented 6 months ago

Here is a minimal counterexample:

Cabal file:

counterexample.cabal:

cabal-version:      3.0
name:               counterexample
version:            0.1.0.0
license:            BSD-3-Clause
license-file:       LICENSE
author:             David Binder
maintainer:         david.binder@uni-tuebingen.de
build-type:         Simple
extra-doc-files:    CHANGELOG.md

common warnings
    ghc-options: -Wall

executable counterexample
    import:           warnings
    main-is:          Main.hs
    build-depends:    base ^>=4.18.0.0,
                      prettyprinter-ansi-terminal
    hs-source-dirs:   app
    default-language: Haskell2010

Cabal.project file

cabal.project

packages: counterexample.cabal
constraints: prettyprinter -text

Build errors

[1 of 4] Compiling Prettyprinter.Render.Terminal.Internal ( src/Prettyprinter/Render/Terminal/Internal.hs, dist/build/Prettyprinter/Render/Terminal/Internal.o, dist/build/Prettyprinter/Render/Terminal/Internal.dyn_o )

src/Prettyprinter/Render/Terminal/Internal.hs:158:44: error: [GHC-83865]
    • Couldn't match type ‘[Char]’ with ‘Text’
      Expected: Text
        Actual: prettyprinter-1.7.1:Data.Text.Text
    • In the first argument of ‘TLB.fromText’, namely ‘t’
      In the first argument of ‘(<>)’, namely ‘TLB.fromText t’
      In the expression: TLB.fromText t <> go s rest
    |
158 |             SText _ t rest -> TLB.fromText t <> go s rest
    |                                            ^

src/Prettyprinter/Render/Terminal/Internal.hs:211:29: error: [GHC-83865]
    • Couldn't match type ‘[Char]’ with ‘Text’
      Expected: Text
        Actual: prettyprinter-1.7.1:Data.Text.Text
    • In the second argument of ‘T.hPutStr’, namely ‘t’
      In a stmt of a 'do' block: T.hPutStr h t
      In the expression:
        do T.hPutStr h t
           go rest
    |
211 |                 T.hPutStr h t
    |                             ^
Error: cabal: Failed to build prettyprinter-ansi-terminal-1.1.3 (which is
required by exe:counterexample from counterexample-0.1.0.0). See the build log
above for details.
BinderDavid commented 6 months ago

207 and #208 are related