Skip to content

Commit

Permalink
project: use the latest stackage lts
Browse files Browse the repository at this point in the history
  • Loading branch information
etorreborre committed Dec 2, 2023
1 parent 8a6661e commit 142b343
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 26 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
stack: ["2.7.3"]
stack: ["2.9.1"]
ghc:
- "8.10.7"
- "9.0.2"
- "9.2.2"
- "9.2.8"
- "9.4.8"
- "9.6.3"

steps:
- uses: actions/checkout@v2
Expand Down
8 changes: 4 additions & 4 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ dependencies:
- semigroupoids >= 5.0 && < 5.4
- semigroups >= 0.15 && < 0.30
- template-haskell >= 2.13 && < 3.0
- text >= 1.1 && < 2
- text >= 1.1 && < 3
- transformers-base >= 0.4 && < 0.5
- unliftio >= 0.2 && < 1

Expand All @@ -80,15 +80,15 @@ tests:
- hedgehog >= 1.0 && < 3.0
- generic-lens >= 1.0 && < 3.0
- io-memoize < 1.2
- MonadRandom < 0.6
- MonadRandom < 1
- multimap < 2
- semigroups < 0.30
- random < 2.0
- tasty < 1.5
- tasty-discover < 4.3
- tasty-discover < 6
- tasty-hedgehog >= 1.2 && < 2.0
- tasty-th < 0.2
- text < 2
- text < 3
- universum < 2

ghc-options:
Expand Down
12 changes: 6 additions & 6 deletions registry.cabal
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.35.0.
-- This file has been generated from package.yaml by hpack version 0.35.2.
--
-- see: https://github.com/sol/hpack
--
-- hash: eba4b73d85a7c3fbee86501abdf3870e4af595503b7879280fad3c2baecbb4c1
-- hash: 62a78d871e414b366ac28e6f56ac9f60559a7efc9b6165b3d0c3e3087a7a21b1

name: registry
version: 0.6.0.0
Expand Down Expand Up @@ -75,7 +75,7 @@ library
, semigroupoids >=5.0 && <5.4
, semigroups >=0.15 && <0.30
, template-haskell >=2.13 && <3.0
, text >=1.1 && <2
, text >=1.1 && <3
, transformers-base ==0.4.*
, unliftio >=0.2 && <1
default-language: GHC2021
Expand Down Expand Up @@ -131,7 +131,7 @@ test-suite spec
TypeFamilyDependencies
ghc-options: -Wall -Wcompat -Wincomplete-record-updates -fhide-source-paths -fprint-potential-instances -optP-Wno-nonportable-include-path -threaded -rtsopts -with-rtsopts=-N -fno-warn-orphans -fno-warn-missing-signatures -fno-warn-incomplete-uni-patterns -optP-Wno-nonportable-include-path
build-depends:
MonadRandom <0.6
MonadRandom <1
, async <2.3
, base >=4.14 && <5
, bytestring <0.12
Expand All @@ -152,11 +152,11 @@ test-suite spec
, semigroupoids >=5.0 && <5.4
, semigroups <0.30
, tasty <1.5
, tasty-discover <4.3
, tasty-discover <6
, tasty-hedgehog >=1.2 && <2.0
, tasty-th <0.2
, template-haskell >=2.13 && <3.0
, text <2
, text <3
, transformers-base ==0.4.*
, universum <2
, unliftio >=0.2 && <1
Expand Down
1 change: 1 addition & 0 deletions src/Data/Registry/Lift.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
module Data.Registry.Lift where

import Protolude hiding (Nat)
import Data.Type.Equality

-- | Typeclass for lifting pure functions to effectful arguments and results
class Applicative f => ApplyVariadic f a b where
Expand Down
4 changes: 1 addition & 3 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
resolver: lts-20.1
resolver: lts-21.22

packages:
- '.'

extra-deps:

flags: {}

extra-package-dbs: []
8 changes: 4 additions & 4 deletions stack.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
packages: []
snapshots:
- completed:
sha256: b73b2b116143aea728c70e65c3239188998bac5bc3be56465813dacd74215dc5
size: 648424
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/20/1.yaml
original: lts-20.1
sha256: afd5ba64ab602cabc2d3942d3d7e7dd6311bc626dcb415b901eaf576cb62f0ea
size: 640060
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/21/22.yaml
original: lts-21.22
15 changes: 8 additions & 7 deletions test/Test/Data/Registry/GenSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import Data.Registry
import Hedgehog.Gen as Gen
import Hedgehog.Range as Range
import Protolude as P
import Test.Tasty.Extensions
import Test.Tasty.Extensions hiding (forAll)
import Test.Tasty.Extensions qualified as Tasty

-- * DATA MODEL

Expand Down Expand Up @@ -57,12 +58,12 @@ genDouble = Gen.double (Range.linearFrac 1 100)

setDepartmentWithOneEmployee :: Monad m => RegistryProperty m ()
setDepartmentWithOneEmployee = do
e <- forall @Employee
e <- forAll @Employee
tweakGen @[Employee] (const $ pure [e])

setCompanyWithOneDepartment :: Monad m => RegistryProperty m ()
setCompanyWithOneDepartment = do
d <- forall @Department
d <- forAll @Department
tweakGen @[Department] (const (pure [d]))

setMinimalCompany :: Monad m => RegistryProperty m ()
Expand Down Expand Up @@ -91,7 +92,7 @@ test_company_with_one_employee = noShrink $
prop "generate just one employee" $
runR $ do
setMinimalCompany
company <- forall @Company
company <- forAll @Company
let allEmployees = company & departments >>= (& employees)
length allEmployees === 1

Expand All @@ -110,7 +111,7 @@ salaryGen fixed variable = choice [unTag <$> fixed, unTag <$> variable]
test_with_different_salaries = noShrink $
prop "generate both fixed and variable salaries" $
runWith registry' $ do
salaries <- forall @[Salary]
salaries <- forAll @[Salary]
let (fixed, variables) = partition isFixed salaries

annotate "the choice operator allows us to generate both fixed and variable salaries"
Expand All @@ -121,8 +122,8 @@ test_with_different_salaries = noShrink $

type RegistryProperty m a = forall ins out. StateT (Registry ins out) (PropertyT m) a

forall :: forall a m. (HasCallStack, Typeable a, Show a, Monad m) => RegistryProperty m a
forall = withFrozenCallStack $ get >>= P.lift . forAll . make @(Gen a)
forAll :: forall a m. (HasCallStack, Typeable a, Show a, Monad m) => RegistryProperty m a
forAll = withFrozenCallStack $ get >>= P.lift . Tasty.forAll . make @(Gen a)

tweakGen :: forall a m. (Typeable a, Monad m) => (Gen a -> Gen a) -> RegistryProperty m ()
tweakGen f = modify $ tweak @(Gen a) f
Expand Down
1 change: 1 addition & 0 deletions test/test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ import AutoDiscoveredSpecs (tests)
import Protolude
import Test.Tasty.Extensions

main :: IO ()
main = tests >>= defaultMain . groupByModuleName

0 comments on commit 142b343

Please sign in to comment.