name:                  bencoding
version:               0.4.5.1
license:               BSD3
license-file:          LICENSE
author:                Sam Truzjan
maintainer:            Sergey Vinokurov <serg.foo@gmail.com>
copyright:             (c) 2013-2018, Sam Truzjan
                       (c) 2018 Sergey Vinokurov
category:              Data
build-type:            Simple
stability:             Experimental
cabal-version:         >= 1.10
tested-with:           GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.3
homepage:              https://github.com/sergv/bencoding
bug-reports:           https://github.com/sergv/bencoding/issues
synopsis:              A library for encoding and decoding of BEncode data.
description:
  A library for fast and easy encoding and decoding of BEncode data.

extra-source-files:    README.md
                     , ChangeLog

source-repository head
  type:                git
  location:            https://github.com/sergv/bencoding.git
  branch:              master

source-repository this
  type:                git
  location:            https://github.com/sergv/bencoding.git
  branch:              master
  tag:                 v0.4.5.1

flag dev
  description:
    Enable development options
  default:
    False
  manual:
    True

flag benchmark-atto-bencode
  description:
    Compare performance of this package against AttoBencode in benchmarks
  default:
    False
  manual:
    True

library
  default-language:    Haskell2010
  hs-source-dirs:      src
  exposed-modules:     Data.BEncode
                     , Data.BEncode.BDict
                     , Data.BEncode.Internal
                     , Data.BEncode.Types
  build-depends:       base       >= 4.4 && < 5
                     , ghc-prim
                     , integer-gmp
                     , deepseq    >= 1.3

                     , mtl

                     , attoparsec >= 0.10
                     , bytestring >= 0.10
                     , text       >= 0.11
                     , pretty
  ghc-options:         -Wall -O2
  if !impl(ghc >= 8.0.0)
    build-depends:     semigroups >= 0.9 && < 0.19

  if flag(dev)
    ghc-options:
      -fwarn-name-shadowing
      -Werror
    if impl(ghc >= 8.0)
      ghc-options:
        -Wcompat
        -Whi-shadowing
        -Widentities
        -Wincomplete-record-updates
        -Wincomplete-uni-patterns
        -Wmissing-exported-signatures
    if impl(ghc >= 8.2)
      ghc-options:
        -Wcpp-undef
        -Wmissing-home-modules
        -Wunbanged-strict-patterns

test-suite properties
  type:                exitcode-stdio-1.0
  default-language:    Haskell2010
  hs-source-dirs:      tests
  main-is:             properties.hs
  build-depends:       base       == 4.*
                     , ghc-prim

                     , containers >= 0.4
                     , bytestring >= 0.10
                     , attoparsec >= 0.10

                     , bencoding
                     , hspec
                     , QuickCheck

  ghc-options:         -Wall

  if flag(dev)
    ghc-options:
      -fwarn-name-shadowing
      -Werror
    if impl(ghc >= 8.0)
      ghc-options:
        -Wcompat
        -Whi-shadowing
        -Widentities
        -Wincomplete-record-updates
        -Wincomplete-uni-patterns
        -Wmissing-exported-signatures
    if impl(ghc >= 8.2)
      ghc-options:
        -Wcpp-undef
        -Wmissing-home-modules
        -Wunbanged-strict-patterns


benchmark bench-comparison
  type:                exitcode-stdio-1.0
  default-language:    Haskell2010
  hs-source-dirs:      bench
  main-is:             Main.hs
  build-depends:       base == 4.*
                     , ghc-prim
                     , deepseq

                     , attoparsec >= 0.10
                     , bytestring >= 0.10

                     , criterion

                     , bencoding
                     , bencode     >= 0.5

  if flag(benchmark-atto-bencode)
    build-depends: AttoBencode >= 0.2
    cpp-options:   -DBENCHMARK_ATTOBENCODE

  ghc-options:         -O2 -Wall

  if flag(dev)
    ghc-options:
      -fwarn-name-shadowing
      -Werror
    if impl(ghc >= 8.0)
      ghc-options:
        -Wcompat
        -Whi-shadowing
        -Widentities
        -Wincomplete-record-updates
        -Wincomplete-uni-patterns
        -Wmissing-exported-signatures
    if impl(ghc >= 8.2)
      ghc-options:
        -Wcpp-undef
        -Wmissing-home-modules
        -Wunbanged-strict-patterns