data-forced: Specify that lifted values were forced to WHNF or NF.
Alternative to bang patterns using CBV functions and unlifted data types. Tag your values to maintain the invariant that they were forced. Avoid liveness leaks on long running data structures.
import Data.Map.Lazy as ML -- Spine strict -- No references on added leafs even though it is a lazy map. basicEvent :: ML.Map Char (ForcedWHNF Int) -> IO (ML.Map Char (ForcedWHNF Int)) basicEvent map0 = do let val0 :: Strict (ForcedWHNF Int) -- val0 = strictlyWHNF (error "argument evaluated") -- would fail val0 = strictlyWHNF (2 + 2) -- CBV function, 2 + 2 reduced before val0 is bound. Strict val1 = val0 -- De-structure map1 = ML.insert 'a' val1 map0 pure map1
Downloads
- data-forced-0.1.0.0.tar.gz [browse] (Cabal source package)
- Package description (revised from the package)
Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
Versions [RSS] | 0.1.0.0, 0.2.0.0, 0.3.0.0 |
---|---|
Change log | CHANGELOG.md |
Dependencies | base (>=4.16.4.0 && <4.17), data-elevator (>=0.1.0.0), deepseq (>=1.4.6.0) [details] |
License | MIT |
Copyright | 2023 |
Author | Ruben Astudillo |
Maintainer | ruben.astud@gmail.com |
Revised | Revision 1 made by RubenAstudillo at 2023-04-11T20:18:14Z |
Category | Data |
Home page | https://github.com/RubenAstudillo/data-forced |
Bug tracker | https://github.com/RubenAstudillo/data-forced/issues |
Uploaded | by RubenAstudillo at 2023-04-11T20:13:38Z |
Distributions | |
Downloads | 165 total (2 in the last 30 days) |
Rating | (no votes yet) [estimated by Bayesian average] |
Your Rating | |
Status | Docs not available [build log] All reported builds failed as of 2023-04-11 [all 2 reports] |