th-lock: Serialize compilation of modules with TH code modifing shared state
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 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 ensureSerialCompilationVerbose.
{-# LANGUAGE TemplateHaskell #-}
module ModuleA where
import Language.Haskell.TH.Lock
ensureSerialCompilationVerbose________________________________________________________________________
{-# LANGUAGE TemplateHaskell #-}
module ModuleB where
import Language.Haskell.TH.Lock
ensureSerialCompilationVerbose
Downloads
- th-lock-0.0.4.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
| Versions [RSS] | 0.0.4 |
|---|---|
| Change log | changelog.md |
| Dependencies | base (<5), template-haskell (<2.24.0.0) [details] |
| Tested with | ghc ==9.10.1 |
| License | BSD-3-Clause |
| Author | Daniil Iaitskov <dyaitskov@gmail.com> |
| Maintainer | Daniil Iaitskov <dyaitskov@gmail.com> |
| Category | Development |
| Home page | https://github.com/yaitskov/th-lock |
| Bug tracker | https://github.com/yaitskov/th-lock/issues |
| Source repo | head: git clone https://github.com/yaitskov/th-lock.git |
| Uploaded | by DaniilIaitskov at 2025-03-14T05:57:06Z |
| Distributions | NixOS:0.0.4 |
| Downloads | 18 total (4 in the last 30 days) |
| Rating | (no votes yet) [estimated by Bayesian average] |
| Your Rating | |
| Status | Docs uploaded by user Build status unknown [no reports yet] |