th-lock-0.0.4: th-lock.cabal
cabal-version: 3.0
name: th-lock
version: 0.0.4
license: BSD-3-Clause
license-file: LICENSE
category: Development
author: Daniil Iaitskov <dyaitskov@gmail.com>
maintainer: Daniil Iaitskov <dyaitskov@gmail.com>
stability: experimental
synopsis: Serialize compilation of modules with TH code modifing shared state
homepage: https://github.com/yaitskov/th-lock
bug-reports: https://github.com/yaitskov/th-lock/issues
build-type: Simple
description:
Recent GHC versions with option @-j\<N>@ where @N@ greater than 1 can
build modules concurrently. Usually it is cool thing, because build time
drops, but there is a drawback in form of problems with TH code
maintaining a shared state.
I encountered such issue while running tests for
<https://hackage.haskell.org/package/trace-embrace trace-embrace>
package. Package TH code has a shared state (immutable configuration
file loaded once), which is not supposed to change after loading, but
tests require to cover all cases\/branches and achieving this in the
scope of a single cabal test-suit leads to inconsistencies.
Spreading tests among multiple test suits cause code duplication and
looks less elegant.
Compilation of conflicting modules can be serialized with
<https://hackage.haskell.org/package/th-lock/docs/Language-Haskell-TH-Lock.html#v:ensureSerialCompilationVerbose ensureSerialCompilationVerbose>.
> {-# LANGUAGE TemplateHaskell #-}
> module ModuleA where
>
> import Language.Haskell.TH.Lock
>
> ensureSerialCompilationVerbose
________________________________________________________________________
> {-# LANGUAGE TemplateHaskell #-}
> module ModuleB where
>
> import Language.Haskell.TH.Lock
>
> ensureSerialCompilationVerbose
tested-with:
GHC == 9.10.1
extra-doc-files:
changelog.md
library
build-depends:
base < 5,
template-haskell < 2.24.0.0,
exposed-modules:
Language.Haskell.TH.Lock
ghc-options: -Wall
hs-source-dirs: src
default-language: Haskell2010
default-extensions:
FlexibleContexts
FlexibleInstances
ImportQualifiedPost
LambdaCase
TemplateHaskell
test-suite test
type: exitcode-stdio-1.0
main-is: Driver.hs
other-modules:
Discovery
Paths_th_lock
Tests.Language.Haskell.TH.Lock.State
Tests.Language.Haskell.TH.Lock.ModuleA
Tests.Language.Haskell.TH.Lock.ModuleB
Tests.Language.Haskell.TH.Lock.ModuleC
Tests.Language.Haskell.TH.Lock.ModuleD
Tests.Language.Haskell.TH.Lock.ModuleE
Tests.Language.Haskell.TH.Lock.ModuleF
Tests.Language.Haskell.TH.Lock.ModuleG
Tests.Language.Haskell.TH.Lock.ModuleH
Tests.Language.Haskell.TH.Lock.ModuleI
Tests.Language.Haskell.TH.Lock.ModuleJ
Tests.Language.Haskell.TH.Lock.ModuleX
Tests.Language.Haskell.TH.Lock.ModuleY
Tests.Language.Haskell.TH.Lock.ModuleZ
autogen-modules:
Paths_th_lock
hs-source-dirs:
test
default-extensions:
FlexibleContexts
ImportQualifiedPost
LambdaCase
OverloadedLabels
RecordWildCards
ScopedTypeVariables
TemplateHaskell
ghc-options: -Wall -rtsopts -threaded -main-is Driver
build-depends:
base
, tasty
, tasty-discover
, tasty-hunit
, tasty-quickcheck
, template-haskell
, th-lock
default-language: Haskell2010
source-repository head
type: git
location: https://github.com/yaitskov/th-lock.git