cabal-version:       2.4
name:                tomland
version:             1.1.0.0
synopsis:            Bidirectional TOML serialization
description:
    Implementation of bidirectional TOML serialization. Simple codecs look like this:
    .
    @
    __data__ User = User
    \    { userName :: Text
    \    , userAge  :: Int
    \    }
    \
    \userCodec :: TomlCodec User
    \userCodec = User
    \    \<$\> Toml.text "name" .= userName
    \    \<*\> Toml.int  "age"  .= userAge
    @
    .
    The following blog post has more details about library design:
    .
    * [tomland: Bidirectional TOML serialization](https://kowainik.github.io/posts/2019-01-14-tomland)

homepage:            https://github.com/kowainik/tomland
bug-reports:         https://github.com/kowainik/tomland/issues
license:             MPL-2.0
license-file:        LICENSE
author:              Dmitrii Kovanikov, Veronika Romashkina
maintainer:          Kowainik <xrom.xkov@gmail.com>
copyright:           2018-2019 Kowainik
category:            TOML, Text, Configuration
build-type:          Simple
extra-doc-files:     README.md
                   , CHANGELOG.md
extra-source-files:  test/golden/*.golden
tested-with:         GHC == 8.2.2
                   , GHC == 8.4.4
                   , GHC == 8.6.5

source-repository head
  type:                git
  location:            https://github.com/kowainik/tomland.git

common common-options
  build-depends:       base >= 4.10 && < 4.13

  ghc-options:         -Wall
                       -Wincomplete-uni-patterns
                       -Wincomplete-record-updates
                       -Wcompat
                       -Widentities
                       -Wredundant-constraints
                       -Wpartial-fields
                       -fhide-source-paths
                       -freverse-errors

  default-language:    Haskell2010
  default-extensions:  DeriveGeneric
                       InstanceSigs
                       LambdaCase
                       OverloadedStrings
                       RecordWildCards
                       ScopedTypeVariables
                       TypeApplications

library
  import:              common-options
  hs-source-dirs:      src

  exposed-modules:     Toml
                         Toml.Bi
                           Toml.Bi.Code
                           Toml.Bi.Combinators
                           Toml.Bi.Monad
                           Toml.Bi.Map
                         Toml.Edsl
                         Toml.Generic
                         Toml.Parser
                           Toml.Parser.Core
                           Toml.Parser.String
                           Toml.Parser.Value
                           Toml.Parser.TOML
                         Toml.PrefixTree
                         Toml.Printer
                         Toml.Type
                           Toml.Type.AnyValue
                           Toml.Type.TOML
                           Toml.Type.UValue
                           Toml.Type.Value

  build-depends:       bytestring ^>= 0.10
                     , containers >= 0.5.7 && < 0.7
                     , deepseq ^>= 1.4
                     , hashable ^>= 1.2
                     , megaparsec ^>= 7.0.5
                     , mtl ^>= 2.2
                     , parser-combinators ^>= 1.1.0
                     , text ^>= 1.2
                     , time >= 1.8 && < 1.10
                     , transformers ^>= 0.5
                     , unordered-containers ^>= 0.2.7

executable readme
  import:              common-options
  main-is:             README.lhs
  build-depends:       text
                     , tomland

  build-tool-depends:  markdown-unlit:markdown-unlit
  ghc-options:         -pgmL markdown-unlit

executable play-tomland
  import:              common-options
  main-is:             Playground.hs
  build-depends:       tomland
                     , text
                     , time
                     , unordered-containers

  hs-source-dirs:      examples
  ghc-options:         -threaded -Wall

test-suite tomland-test
  import:              common-options
  type:                exitcode-stdio-1.0
  hs-source-dirs:      test
  main-is:             Spec.hs

  other-modules:       Test.Toml.BiMap.Property
                       Test.Toml.BiCode.Property
                       Test.Toml.Gen
                       Test.Toml.Property
                       Test.Toml.Parsing.Property
                       Test.Toml.Parsing.Unit
                       Test.Toml.PrefixTree.Property
                       Test.Toml.PrefixTree.Unit
                       Test.Toml.Printer.Golden
                       Test.Toml.TOML.Property

  build-tool-depends:  tasty-discover:tasty-discover ^>= 4.2.1
  build-depends:       bytestring ^>= 0.10
                     , containers >= 0.5.7 && < 0.7
                     , hashable
                     , hedgehog ^>= 1.0
                     , hspec-megaparsec ^>= 2.0.0
                     , megaparsec
                     , tasty ^>= 1.2
                     , tasty-hedgehog ^>= 1.0.0.0
                     , tasty-hspec ^>= 1.1.5.1
                     , tasty-silver ^>= 3.1.11
                     , text
                     , time
                     , tomland
                     , unordered-containers

  ghc-options:         -threaded -rtsopts -with-rtsopts=-N

benchmark tomland-benchmark
  import:             common-options
  type:               exitcode-stdio-1.0
  main-is:            Main.hs
  hs-source-dirs:     benchmark

  other-modules:      Benchmark.Type
                      Benchmark.Htoml
                      Benchmark.HtomlMegaparsec
                      Benchmark.Tomland
                      Benchmark.TomlParser

  ghc-options:        -threaded
                      -rtsopts
                      -with-rtsopts=-N
                      -O2

  build-depends:      aeson
                    , deepseq ^>= 1.4
                    , gauge ^>= 0.2.4
                    , htoml ^>= 1.0.0.3
                    , htoml-megaparsec ^>= 2.1.0.3
                    , parsec
                    , text
                    , time
                    , toml-parser ^>= 0.1.0.0
                    , tomland