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 lived data structures.
Main tutorial on the only module. Here is a taste of how it will look like.
{-# Language QualifiedDo #-} import qualified Data.Forced as DF import Data.Forced hiding (pure, fmap, (\<*\>), return, (>>=), (>>)) import Data.Map.Lazy qualified as ML noThunksForWHNF :: IO () noThunksForWHNF = do -- map0 actually evaluated on here. let map0 :: Demand (ML.Map Char (ForcedWHNF Int)) map0 = DF.do v <- demandWHNF (const (2 + 2) 'a') DF.pure $ ML.insert 'a' v ML.empty map1 <- extractDemand map0 go (ML.lookup 'a' map1) -- pattern matching for de-structuring, no construction allowed. go :: ForcedWHNF Int -> IO () go (ForcedWHNF i) = print i
Downloads
- data-forced-0.3.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.20.0), 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 2024-01-31T01:02:51Z |
Category | Data |
Home page | https://github.com/RubenAstudillo/data-forced |
Bug tracker | https://github.com/RubenAstudillo/data-forced/issues |
Source repo | head: git clone https://github.com/RubenAstudillo/data-forced |
Uploaded | by RubenAstudillo at 2023-04-25T02:47:44Z |
Distributions | |
Downloads | 154 total (12 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] |