cabal-version:   2.4
name:            text-builder-linear
version:         0.1.2
license:         BSD-3-Clause
license-file:    LICENSE
copyright:       2022 Andrew Lelechenko
maintainer:      Andrew Lelechenko <andrew.lelechenko@gmail.com>
author:          Andrew Lelechenko
tested-with:     ghc ==9.2.8 ghc ==9.4.7 ghc ==9.6.3 ghc ==9.8.1
homepage:        https://github.com/Bodigrim/linear-builder
synopsis:        Builder for Text and ByteString based on linear types
description:
    Strict Text and ByteString builder, which hides mutable buffer behind linear types
    and takes amortized linear time.

category:        Text
extra-doc-files:
    changelog.md
    README.md

source-repository head
    type:     git
    location: git://github.com/Bodigrim/linear-builder.git

library
    exposed-modules:
        Data.Text.Builder.Linear
        Data.Text.Builder.Linear.Buffer
        Data.Text.Builder.Linear.Core

    hs-source-dirs:     src
    other-modules:
        Data.Text.Builder.Linear.Array
        Data.Text.Builder.Linear.Char
        Data.Text.Builder.Linear.Dec
        Data.Text.Builder.Linear.Double
        Data.Text.Builder.Linear.Hex

    default-language:   GHC2021
    default-extensions:
        LinearTypes MagicHash NumDecimals UnboxedTuples UnicodeSyntax
        UnliftedDatatypes ViewPatterns

    ghc-options:        -Wall -O2 -fexpose-all-unfoldings
    build-depends:
        base >=4.16 && <5,
        text >=2.0 && <2.2,
        bytestring >=0.11 && <0.13,
        quote-quot >=0.2.1 && <0.3

test-suite linear-builder-tests
    type:               exitcode-stdio-1.0
    main-is:            Main.hs
    hs-source-dirs:     test
    default-language:   GHC2021
    default-extensions:
        DerivingStrategies LinearTypes MagicHash PatternSynonyms
        UnboxedTuples UnicodeSyntax

    ghc-options:
        -Wall -Wno-orphans -threaded -rtsopts "-with-rtsopts -N"

    build-depends:
        base,
        text,
        text-builder-linear,
        tasty >=1.4 && <1.6,
        tasty-quickcheck >=0.10 && <0.11

benchmark linear-builder-bench
    type:               exitcode-stdio-1.0
    main-is:            Main.hs
    hs-source-dirs:     bench
    other-modules:
        BenchChar
        BenchDecimal
        BenchDouble
        BenchHexadecimal
        BenchText

    default-language:   GHC2021
    default-extensions: CPP LinearTypes NumDecimals UnicodeSyntax
    ghc-options:        -Wall -rtsopts -O2 -fproc-alignment=64
    build-depends:
        base,
        bytestring,
        text,
        text-builder-linear,
        -- NOTE: The following packages are optional, but are not required that
        --       often. While they could be guarded by a flag, we prefer keeping
        --       the Hackage page simple. Just uncomment these lines when needed.
        -- bytestring-strict-builder >= 0.4.5 && < 0.5
        -- text-builder >= 0.6.7 && < 0.7,
        tasty,
        tasty-bench >=0.3.2 && <0.4