packages feed

o-clock-1.3.0: o-clock.cabal

cabal-version: 2.2
-- SPDX-FileCopyrightText: 2020-2021 Serokell <https://serokell.io>
--
-- SPDX-License-Identifier: MPL-2.0

name:                o-clock
version:             1.3.0
synopsis:            Type-safe time library.
description:         See README.md for details.
homepage:            https://github.com/serokell/o-clock
bug-reports:         https://github.com/serokell/o-clock/issues
license:             MPL-2.0
license-file:        LICENSE
author:              @serokell
maintainer:          Serokell <hi@serokell.io>
copyright:           2020 Serokell
category:            Time
build-type:          Simple
stability:           stable
extra-doc-files:     CHANGELOG.md
                   , README.md
                   , README.lhs
tested-with:         GHC == 8.6.5
                   , GHC == 8.8.3
                   , GHC == 8.10.4
                   , GHC == 9.0.2
                   , GHC == 9.2.4

source-repository head
  type:     git
  location: https://github.com/serokell/o-clock

common common-options
  build-depends:
      base >=4.12 && <5
  ghc-options: -Wall
  default-language: Haskell2010

library
  import:              common-options
  hs-source-dirs:      src
  exposed-modules:     Time
                         Time.Rational
                         Time.Series
                         Time.Timestamp
                         Time.Units
  default-extensions:  OverloadedStrings
                       RecordWildCards
                       ScopedTypeVariables
                       TypeApplications
                       TypeFamilies
  if flag(aeson)
    build-depends:     aeson    >= 1.2.4 && < 2.1
                     , text
    cpp-options:       -DHAS_aeson

executable play-o-clock
  import:              common-options
  main-is:             Playground.hs
  build-depends:       o-clock
  hs-source-dirs:      examples
  ghc-options:         -threaded
                       -fno-warn-orphans

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

  other-modules:       Test.Time.Property
                       Test.Time.Timestamp
                       Test.Time.TypeSpec
                       Test.Time.Units

  build-depends:       o-clock
                     , hedgehog       >= 0.6 && < 1.3
                     , hspec-expectations ^>= 0.8
                     , tasty          >= 0.12 && < 1.5
                     , tasty-hedgehog >= 0.1 && < 1.3.2
                     , tasty-hunit-compat ^>= 0.2
                     , type-spec      >= 0.3.0.1 && < 0.5

  ghc-options:         -threaded -rtsopts -with-rtsopts=-N
  default-extensions:  OverloadedStrings
                       RecordWildCards

test-suite o-clock-doctest
  import:              common-options
  if os(windows)
     buildable: False

  type:                exitcode-stdio-1.0
  hs-source-dirs:      test
  main-is:             Doctest.hs

  build-tool-depends:  doctest:doctest
  build-depends:       doctest >= 0.16 && < 0.21
                     , Glob    >= 0.9 && < 0.11
  ghc-options:         -threaded -rtsopts -with-rtsopts=-N

test-suite readme-test
  import:              common-options
  if os(windows)
     buildable: False

  type:                exitcode-stdio-1.0
  main-is:             README.lhs

  build-tool-depends:  markdown-unlit:markdown-unlit
  build-depends:       o-clock
                     , markdown-unlit ^>= 0.5
  ghc-options:         -threaded -rtsopts -with-rtsopts=-N -pgmL markdown-unlit

benchmark o-clock-benchmark
  import:              common-options
  type:                exitcode-stdio-1.0
  ghc-options:         -O2 -threaded -rtsopts -with-rtsopts=-N
  hs-source-dirs:      benchmark
  main-is:             Main.hs
  build-depends:       deepseq    >= 1.4
                     , o-clock
                     , gauge      >= 0.2.1 && < 1
                     , tiempo     >= 0.0.1.1
                     , time-units == 1.0.0
  -- ghc 9.2 is not supported by gauge (due to basement)
  if !flag(bench-buildable) || impl(ghc >= 9.2)
    buildable:         False

  default-extensions:  OverloadedStrings
                       RecordWildCards

-- Flags

flag aeson
  description:         Provide instances for @aeson@
  default:             False

flag bench-buildable
  description:         Make benchmarks buildable
  default:             False