packages feed

number-length-0.2.1.0: number-length.cabal

name:                   number-length
version:                0.2.1.0
synopsis:
  Number of digits in a number in decimal and hexadecimal representation.
description:
  There are situations when it is necessary to know the length of a number in
  decimal or hexadecimal form. In example when allocating buffer while
  serializing a number in to binary or human readable format.
  .
  @
  λ> numberLength (123 :: Int)
  3
  @
  .
  @
  λ> numberLengthHex (123 :: Int)  -- 123 = 7b in hex
  2
  @

homepage:               https://github.com/trskop/number-length
license:                BSD3
license-file:           LICENSE
author:                 Peter Trško
maintainer:             peter.trsko@gmail.com
copyright:              (c) 2015-2016, 2018 Peter Trško
category:               Data
build-type:             Simple
cabal-version:          >=1.10

extra-source-files:     ChangeLog.md, README.md

flag pedantic
  description:          Pass additional warning flags to GHC.
  default:              False
  manual:               True

library
  hs-source-dirs:       src
  exposed-modules:
      Data.NumberLength
    , Data.NumberLength.Int
    , Data.NumberLength.Integer
    , Data.NumberLength.Internal
    , Data.NumberLength.Word
  -- other-modules:

  default-language:     Haskell2010
  other-extensions:     NoImplicitPrelude

  build-depends:        base >=4.5 && <5

  if impl(ghc >=7.10)
    -- Module Numeric.Natural providing new Natural type representing
    -- non-negative arbitrary-precision integers was introduced in base
    -- 4.8.0.0, which was bundled with GHC 7.10.1.
    cpp-options:        -DHAVE_NATURAL
    exposed-modules:    Data.NumberLength.Natural

  ghc-options:          -Wall
  if flag(pedantic)
    if impl(ghc >8)
      ghc-options:
        -Wimplicit-prelude
        -Wmissing-import-lists
        -Werror
    else
      ghc-options:
        -fwarn-implicit-prelude
        -fwarn-missing-import-lists
        -Werror

test-suite unit-tests
  hs-source-dirs:       src, test
  type:                 exitcode-stdio-1.0
  main-is:              unit-tests.hs
  other-modules:
      TestCase
    , TestCase.Data.NumberLength
    , TestCase.Data.NumberLength.Int
    , TestCase.Data.NumberLength.Integer
    , TestCase.Data.NumberLength.Word

    , Data.NumberLength
    , Data.NumberLength.Int
    , Data.NumberLength.Integer
    , Data.NumberLength.Internal
    , Data.NumberLength.Word

  default-language:     Haskell2010
  other-extensions:     DefaultSignatures, NoImplicitPrelude

  -- {{{ Dependencies of the library ------------------------------------------
  if impl(ghc <7.8)
    -- Data.Proxy was introduced in base ==4.7, which was bundled with GHC 7.8.
    build-depends:      tagged >=0.6 && <0.9

  if impl(ghc >=7.10)
    -- Module Numeric.Natural providing new Natural type representing
    -- non-negative arbitrary-precision integers was introduced in base
    -- 4.8.0.0, which was bundled with GHC 7.10.1.
    cpp-options:        -DHAVE_NATURAL
    other-modules:
        TestCase.Data.NumberLength.Natural
      , Data.NumberLength.Natural
    build-depends:
        quickcheck-instances >=0.3.15 && <1
        -- ^ Version 0.3.15 is the first that contains instances for Natural.

  build-depends:
      base >=4.5 && <5
  -- }}} Dependencies of the library ------------------------------------------

  -- {{{ Test-suite dependencies ----------------------------------------------
    , HUnit >=1.2 && <2
      -- ^ Same constraints as test-framework-hunit
    , QuickCheck >=2.6 && <3
      -- ^ Same constraints as test-framework-quickcheck2==0.3.0.3.
    , test-framework >=0.8 && <1
      -- ^ Same constraint as test-framework-skip, other packages that
      -- depend on it have less restrictive bounds.
    , test-framework-hunit >=0.2.6 && <1
      -- ^ Lower versions have more restrictive bounds on test-framework.
    , test-framework-quickcheck2 >=0.3 && <1
      -- ^ There were changes in QuickCheck bounds in 0.2 branch and last one
      -- on it had a compilation failure on Hackage.
  -- }}} Test-suite dependencies ----------------------------------------------

  ghc-options:          -Wall
  if flag(pedantic)
    if impl(ghc >8)
      ghc-options:
        -Wimplicit-prelude
        -Wmissing-import-lists
        -Werror
    else
      ghc-options:
        -fwarn-implicit-prelude
        -fwarn-missing-import-lists
        -Werror

benchmark benchmark
  hs-source-dirs:       src, test
  type:                 exitcode-stdio-1.0
  main-is:              benchmark.hs
  other-modules:
      Data.NumberLength.Int
    , Data.NumberLength.Internal
    , Data.NumberLength.Integer
    , Data.NumberLength.Natural
    , Data.NumberLength.Word

  default-language:     Haskell2010
  other-extensions:     NoImplicitPrelude

  -- {{{ Dependencies of the library ------------------------------------------
  if impl(ghc >=7.10)
    -- Module Numeric.Natural providing new Natural type representing
    -- non-negative arbitrary-precision integers was introduced in base
    -- 4.8.0.0, which was bundled with GHC 7.10.1.
    cpp-options:        -DHAVE_NATURAL
    other-modules:      Data.NumberLength.Natural

  build-depends:
      base >=4.5 && <5
  -- }}} Dependencies of the library ------------------------------------------

    , criterion >=1.0.0.0 && <2
    , number-length

  ghc-options:          -Wall
  if flag(pedantic)
    if impl(ghc >8)
      ghc-options:
        -Wimplicit-prelude
        -Wmissing-import-lists
        -Werror
    else
      ghc-options:
        -fwarn-implicit-prelude
        -fwarn-missing-import-lists
        -Werror

source-repository head
  type:                 git
  location:             git://github.com/trskop/number-length.git

source-repository this
  type:                 git
  location:             git://github.com/trskop/number-length.git
  tag:                  v0.2.1.0