The latest version of data-forced is 0.3.0.0-1.
data-forced
Version 0.3.0.0 revision 0 uploaded by RubenAstudillo.
Package meta
- Synopsis
- Specify that lifted values were forced to WHNF or NF.
- Description
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
- Author
- Ruben Astudillo
- Bug reports
- https://github.com/RubenAstudillo/data-forced/issues
- Category
- Data
- Copyright
- 2023
- Homepage
- https://github.com/RubenAstudillo/data-forced
- Maintainer
- ruben.astud@gmail.com
- Package URL
- n/a
- Stability
- n/a