on master help sign in
Add some todo notes for strict-data modules
commita8102433cd225c6ef62758dc67af530951f0abcc authorHarendra Kumar <harendra@composewell.com> dateTue 25 Oct 2022, 10:03 (4 years ago) parent9e57f5f
3 files changed+13
core/src/Streamly/Internal/Data/Either/Strict.hs+2 core/src/Streamly/Internal/Data/Maybe/Strict.hs+9 core/src/Streamly/Internal/Data/Tuple/Strict.hs+2
core/src/Streamly/Internal/Data/Either/Strict.hs+2
@@ -19,6 +19,8 @@
1919--
2020module Streamly.Internal.Data.Either.Strict
2121 ( Either' (..)
22+ -- XXX Remove these and add lazyEither/strictEither to convert to and from
23+ -- lazy Either type.
2224 , isLeft'
2325 , isRight'
2426 , fromLeft'
core/src/Streamly/Internal/Data/Maybe/Strict.hs+9
@@ -16,10 +16,19 @@
1616-- One major advantage of strict data structures as accumulators in folds and
1717-- scans is that it helps the compiler optimize the code much better by
1818-- unboxing. In a big tight loop the difference could be huge.
19+
20+-- Notes: The purpose of the strict Maybe type is to force storing an evaluated
21+-- value instead of a lazy thunk. To enforce that we use a strict Maybe type in
22+-- a data structure. If we need to operate on such strict values, the simplest
23+-- way to do that is to convert it to a lazy type and operate on that.
24+-- Therefore, we do not provide any other operations other than ways to
25+-- construct a strict type and convert it to a lazy type.
1926--
2027module Streamly.Internal.Data.Maybe.Strict
2128 ( Maybe' (..)
29+ -- XXX rename to lazyMaybe, also supply a strictMaybe function.
2230 , toMaybe
31+ -- XXX Remove these, use isJust . toMaybe etc instead.
2332 , isJust'
2433 , fromJust'
2534 )
core/src/Streamly/Internal/Data/Tuple/Strict.hs+2
@@ -21,6 +21,8 @@ module Streamly.Internal.Data.Tuple.Strict
2121 (
2222 Tuple' (..)
2323 , Tuple3' (..)
24+ -- XXX Remove this type, use a fuse annotation in Tuple3' itself or use a
25+ -- custom type where fuse annotation is needed.
2426 , Tuple3Fused' (..)
2527 , Tuple4' (..)
2628 )