th-deepstrict is a library for enforcing (at compile time) that datatypes are deep strict. Deep strictness allows us to guarantee that evaluating a structure evaluates all thunks in all subparts of the structure. This gives us strong guarantees that a type cannot cause a space leak through excessive laziness.
Take a look at the announcement post for more details:
Some time ago I suggested adding a primitive hyperstrict-evaluator function to Haskell:
compel :: a -> a
So when I first saw your announcement, I immediately wondered āis that suggestion now redundant?ā (perhaps along with deepseqet al ), hence the questions.
That makes sense!
I think such a thing would still be helpful, but you can get something similar with this library.
If you use assertDeepStrict on a type and then force it to WHNF then you will end up with something in NF. Of course thereās still types that canāt be deepstrict/hyperstrict, so thereās still a use case for things like deepseq/compel
Great to see this available to all. Sadly it doesnāt work with strict-wrapper due to āThe majority of data/type families are currently not supportedā.