packages feed

hid-examples-0.5: package.yaml

name: hid-examples
version: 0.5
synopsis: Examples to accompany the book "Haskell in Depth"
description:
        This package provides source code examples which accompany the book
        "Haskell in Depth" by Vitaly Bragilevsky (Manning Publications 2020).
        You may want to get this package via @cabal get hid-examples@
        and explore its content.

category:            Sample Code
license:             BSD3
author: Vitaly Bragilevsky
maintainer: Vitaly Bragilevsky <vit.bragilevsky@gmail.com>
github: bravit/hid-examples
extra-source-files:
    - ChangeLog.md
    - LICENSE
    - README.md
    - stack.yaml
    - .travis.yml
    - appveyor.yml
    - package.yaml

data-files:
    - data/*.*
    - data/tests/iplookup/*.*
    - data/benchmarks/iplookup/*.*
    - texts/*.*

tested-with: GHC == 8.6.5, GHC == 8.8.3

dependencies: base >=4.12 && <4.15

_paths_workaround: &paths_workaround
  generated-other-modules: Paths_hid_examples  

executables:
    # Chapter 2
    locator:
        main: locator.hs
        <<: *paths_workaround
    vocab1:
        main: vocab1.hs
        <<: *paths_workaround
        dependencies: text >=1.2 && <1.3
    vocab2:
        main: vocab2.hs
        <<: *paths_workaround
        dependencies: text >=1.2 && <1.3
    vocab3:
        main: vocab3.hs
        <<: *paths_workaround
        dependencies: text >=1.2 && <1.3
    showexpr:
        main: expr/showexpr.hs
        <<: *paths_workaround
        dependencies: hint >=0.7 && <0.10
    # Chapter 3
    stockquotes:
        source-dirs: stockquotes
        main: Main.hs
        <<: *paths_workaround
        other-extensions:
          - RecordWildCards
          - OverloadedStrings
          - FlexibleInstances
          - DeriveGeneric
          - DeriveAnyClass
        dependencies:
          - bytestring >=0.10 && <0.11
          - blaze-html >=0.9 && <0.10
          - optparse-applicative >=0.14 && <0.16
          - time >=1.8 && <1.11
          - text >=1.2 && <1.3
          - fmt >=0.5 && <0.7
          - safe >=0.3 && <0.4
          - Chart >=1.8 && <1.10
          - Chart-diagrams >=1.8 && <1.10
          - cassava >=0.5 && <0.6
    # Chapter 5
    maybe:
        main: maybe.hs
        <<: *paths_workaround
        dependencies:
          - safe >=0.3 && <0.4
    reader:
        main: reader.hs
        <<: *paths_workaround
        other-extensions:
          - NamedFieldPuns
        dependencies:
          - mtl >=2.0 && <2.3
    genSQL:
        main: genSQL.hs
        <<: *paths_workaround
        other-extensions:
          - OverloadedStrings
          - ViewPatterns
        dependencies:
          - text >=1.2 && <1.3
          - mtl >=2.0 && <2.3
    gcd:
        main: gcd.hs
        <<: *paths_workaround
        dependencies:
          - mtl >=2.0 && <2.3
    weapons:
        main: weapons.hs
        <<: *paths_workaround
        dependencies:
          - mtl >=2.0 && <2.3
          - random >=1.0 && <1.2
    shunting-yard:
        main: expr/shunting-yard.hs
        <<: *paths_workaround
        dependencies:
          - mtl >=2.0 && <2.3
    dicegame:
        main: dicegame.hs
        <<: *paths_workaround
        dependencies:
          - mtl >=2.0 && <2.3
          - random >=1.0 && <1.2
    ioref:
        main: ioref.hs
        <<: *paths_workaround
    filecount:
        main: filecount.hs
        <<: *paths_workaround
        dependencies:
          - extra >=1.5 && <1.8
    stref:
        main: stref.hs
        <<: *paths_workaround
    # Chapter 6
    du:
        source-dirs: du
        main: du.hs
        <<: *paths_workaround
        dependencies:
          - mtl >=2.0 && <2.3
          - filepath >= 1.4.1 && < 1.5
          - directory >= 1.3 && < 1.4
          - unix-compat >= 0.5 && < 0.6
          - optparse-applicative >= 0.14 && < 0.16
        other-extensions:
          - GeneralizedNewtypeDeriving
          - RecordWildCards
          - FlexibleContexts
    rpnexpr:
        source-dirs: expr
        main: rpnexpr.hs
        <<: *paths_workaround
        dependencies:
          - mtl >= 2.0 && < 2.3
          - transformers >= 0.5 && < 0.6
          - safe >=0.3 && <0.4
        other-extensions:
          - FlexibleInstances
          - MultiParamTypeClasses
          - UndecidableInstances
          - InstanceSigs
          - LambdaCase
    # Chapter 7
    suntimes:
        source-dirs: suntimes
        main: Main.hs
        <<: *paths_workaround
        dependencies:
          - mtl >= 2.0 && < 2.3
          - transformers >= 0.5 && < 0.6
          - time >=1.8 && <1.11
          - text >=1.2 && <1.3
          - safe-exceptions >= 0.1.5 && < 0.2
          - aeson >= 1.2 && < 1.5  
          - req >= 2.0 && < 3.2
          - http-client >= 0.4 && < 0.7
          - optparse-applicative >= 0.14 && < 0.16
          - bytestring >= 0.10 && < 0.11
        default-extensions:
          - OverloadedStrings
        other-extensions:
          - RecordWildCards
          - DeriveGeneric
    # Chapter 8
    iplookup:
        main: iplookup/Main.hs
        <<: *paths_workaround
        dependencies:
          - safe-exceptions >= 0.1.5 && < 0.2
          - optparse-applicative >= 0.14 && < 0.16
          - iplookup-lib
    ipgen:
        main: ipgen/Main.hs
        <<: *paths_workaround
        dependencies:
          - ipgen-lib
          - safe-exceptions >= 0.1.5 && < 0.2
          - optparse-applicative >= 0.14 && < 0.16
          - hedgehog >= 0.5 && < 1.1
    # Chapter 10
    iplookup-simulation:
        main: iplookup-simulation/Main.hs
        <<: *paths_workaround
        dependencies:
          - random >=1.0 && <1.2
          - iplookup-lib
    # Chapter 11
    # 11.1
    weights-phantom:
        main: ch11/weights-phantom/Main.hs
        other-extensions:
          - GeneralizedNewtypeDeriving
        <<: *paths_workaround
    describe-proxies:
        main: ch11/describe-proxies/Main.hs
        other-extensions:
          - PolyKinds
          - InstanceSigs
        <<: *paths_workaround
    describe-type-apps:
        main: ch11/describe-type-apps/Main.hs
        other-extensions:
          - PolyKinds
          - AllowAmbiguousTypes
          - TypeApplications
        <<: *paths_workaround
    type-operators:
        main: ch11/type-operators/Main.hs
        other-extensions:
          - TypeOperators
          - NoStarIsType
        <<: *paths_workaround
    weights-kinds:
        main: ch11/weights-kinds/Main.hs
        other-extensions:
          - DataKinds
          - KindSignatures
          - GeneralizedNewtypeDeriving
        <<: *paths_workaround
    type-lits:
        main: ch11/type-lits/Main.hs
        other-extensions:
          - DataKinds
          - KindSignatures
          - ScopedTypeVariables
        <<: *paths_workaround
    type-families:
        main: ch11/type-families/Main.hs
        other-extensions:
          - TypeFamilies
          - FlexibleInstances
        <<: *paths_workaround
    dynvalues-gadt:
        main: ch11/dynvalues-gadt/Main.hs
        other-extensions:
          - GADTs
        <<: *paths_workaround
    # 11.2
    api-stage0:
        main: ch11/api/Api0.hs
        <<: *paths_workaround
    api-stage1:
        main: ch11/api/Api1.hs
        <<: *paths_workaround
    api-stage2:
        main: ch11/api/Api2.hs
        other-extensions:
          - KindSignatures
          - TypeOperators
          - PolyKinds
          - DataKinds
          - TypeFamilies
        <<: *paths_workaround
    api-stage3:
        main: ch11/api/Api3.hs
        other-extensions:
          - KindSignatures
          - TypeOperators
          - PolyKinds
          - DataKinds
          - TypeFamilies
          - FlexibleInstances
          - InstanceSigs
          - ScopedTypeVariables
        <<: *paths_workaround
    # 11.3
    expr-gadt:
        main: ch11/expr-gadt/Main.hs
        other-extensions:
          - GADTSyntax
          - GADTs
        <<: *paths_workaround
    doors-type-equality:
        main: ch11/doors/TypeEq.hs
        other-extensions:
          - DataKinds
          - GADTs
          - KindSignatures
          - ExplicitForAll
          - TypeOperators
          - StandaloneDeriving
        <<: *paths_workaround
    doors-singletons:
        main: ch11/doors/Sing.hs
        other-extensions:
          - DataKinds
          - GADTs
          - TypeOperators
          - KindSignatures
          - StandaloneDeriving
        <<: *paths_workaround
    # 11.4
    nummod-rank-n:
        source-dirs: ch11/nummod-rank-n/
        main: Main.hs
        other-extensions:
          - RankNTypes
        <<: *paths_workaround
    xlist-data-families:
        source-dirs: ch11/data-families/
        main: Main.hs
        other-extensions:
          - TypeFamilies
        <<: *paths_workaround
    graph-assoc-tf:
        source-dirs: ch11/graph-assoc-tf/
        main: Main.hs
        dependencies:
          - containers >= 0.5 && < 0.7
        other-extensions:
          - TypeFamilies
          - FlexibleContexts
        <<: *paths_workaround
    

internal-libraries:
    # Chapter 8
    iplookup-lib:
        source-dirs: iplookup
        exposed-modules:
          - IPTypes
          - LookupIP
          - ParseIP
          - FastLookup
        other-modules: []
        dependencies:
          - safe >= 0.3 && < 0.4
          - split >= 0.2 && < 0.3
          - safe-exceptions >= 0.1.5 && < 0.2
          - fingertree >= 0.1 && < 0.2
        other-extensions:
          - TypeApplications
    ipgen-lib:
        source-dirs: ipgen
        exposed-modules:
          - GenIP
        other-modules: []
        dependencies:
          - iplookup-lib
          - hedgehog >= 0.5 && < 1.1

tests:
    # Chapter 8
    iplookup-test:
        main: Test.hs
        <<: *paths_workaround
        source-dirs: tests/iplookup
        dependencies:
          - iplookup-lib
          - ipgen-lib
          - tasty >= 0.11 && < 1.3
          - tasty-hspec >= 1.1 && < 1.2
          - tasty-hedgehog >= 0.1 && < 1.1
          - hedgehog >= 0.5 && < 1.1
          - tasty-golden >= 2.3 && < 2.4
          - filepath >= 1.4.1 && < 1.5
    iplookup-doctest:
        main: tests/iplookup-doctest/Doctests.hs
        <<: *paths_workaround
        ghc-options: 
          - -threaded
        dependencies:
          - doctest >= 0.12 && < 0.17

benchmarks:
    # Chapter 10
    primcheck:
        main: Bench.hs
        source-dirs: benchmarks/primcheck
        dependencies:
          - criterion >= 1.4 && < 1.6
    iplookup-bench:
        main: Bench.hs
        <<: *paths_workaround
        source-dirs: benchmarks/iplookup
        dependencies:
          - iplookup-lib
          - criterion >= 1.4 && < 1.6
          - deepseq >= 1.3 && <1.5