cabal-version:      3.0
name:               jsonifier
version:            0.2.1.3
synopsis:           Fast and simple JSON encoding toolkit
description:
  Minimalistic library for encoding JSON directly to strict bytestring,
  which is up to 3x faster than \"aeson\".
  .
  For introduction, benchmark results and demo please skip to Readme.

category:           JSON
homepage:           https://github.com/nikita-volkov/jsonifier
bug-reports:        https://github.com/nikita-volkov/jsonifier/issues
author:             Nikita Volkov <nikita.y.volkov@mail.ru>
maintainer:         Nikita Volkov <nikita.y.volkov@mail.ru>
copyright:          (c) 2020 Nikita Volkov
license:            MIT
license-file:       LICENSE
extra-source-files:
  README.md
  samples/*.json

source-repository head
  type:     git
  location: git://github.com/nikita-volkov/jsonifier.git

common base-settings
  default-language:   Haskell2010
  default-extensions:
    NoImplicitPrelude
    NoMonomorphismRestriction
    BangPatterns
    ConstraintKinds
    DataKinds
    DefaultSignatures
    DeriveDataTypeable
    DeriveFoldable
    DeriveFunctor
    DeriveGeneric
    DeriveTraversable
    EmptyDataDecls
    FlexibleContexts
    FlexibleInstances
    FunctionalDependencies
    GADTs
    GeneralizedNewtypeDeriving
    InstanceSigs
    LambdaCase
    LiberalTypeSynonyms
    MagicHash
    MultiParamTypeClasses
    MultiWayIf
    OverloadedStrings
    ParallelListComp
    PatternGuards
    QuasiQuotes
    RankNTypes
    RecordWildCards
    ScopedTypeVariables
    StandaloneDeriving
    StrictData
    TemplateHaskell
    TupleSections
    TypeApplications
    TypeFamilies
    TypeOperators
    UnboxedTuples
    ViewPatterns

common executable-settings
  import:      base-settings
  ghc-options: -O2 -threaded "-with-rtsopts=-N -I0 -qg"

library
  import:          base-settings
  hs-source-dirs:  library
  exposed-modules: Jsonifier
  other-modules:
    Jsonifier.Ffi
    Jsonifier.Poke
    Jsonifier.Prelude
    Jsonifier.Size
    Jsonifier.Text
    Jsonifier.Write

  c-sources:
    cbits/json_allocation.c
    cbits/json_encoding.c

  build-depends:
    , base >=4.11 && <5
    , bytestring >=0.10.10 && <0.13
    , ptr-poker ^>=0.1.2.3
    , scientific ^>=0.3.6.2
    , text >=1 && <3

test-suite demo
  import:           base-settings
  type:             exitcode-stdio-1.0
  hs-source-dirs:   demo
  main-is:          Main.hs
  default-language: Haskell2010
  build-depends:
    , jsonifier
    , rerebase

test-suite test
  import:         base-settings
  type:           exitcode-stdio-1.0
  hs-source-dirs: test
  main-is:        Main.hs
  other-modules:  Main.Util.HedgehogGens
  build-depends:
    , aeson >=2 && <3
    , hedgehog >=1.0.3 && <2
    , jsonifier
    , numeric-limits ^>=0.1
    , rerebase >=1.10.0.1 && <2

benchmark bench
  import:         executable-settings
  type:           exitcode-stdio-1.0
  hs-source-dirs: bench
  main-is:        Main.hs
  other-modules:
    Main.Aeson
    Main.Jsonifier
    Main.Model

  build-depends:
    , aeson >=2 && <3
    , criterion >=1.6.3 && <2
    , jsonifier
    , rerebase >=1.10.0.1 && <2
    , text-builder ^>=0.6.6.1