How to find out if GHC is really strict?

I am new to haskell and recently I read about haskell wiki rigor analysis. GHC User Guide :

The strictness analyzer calculates when arguments and variables in a function can be processed β€œstrictly” (that is, they are always evaluated in a function at some point).

I also read about when rigor can be inferred as a whole. However, as a beginner, I'm not always sure if ghc really handles my piece of code, which I intended to be strict as strict.

Currently, I have no other way to find out if a rigorous analysis is going on than how to feed the program big data.

Is there any way to ask ghc if it can do strict code?

+7
haskell ghc
source share
1 answer

The only way I've actually seen is to verify that the GHC has deduced rigor is to read an intermediate view of the compiled Core program.

Some resources for learning to read Core output:

However, another approach is to simply tell the GHC which expressions should be evaluated strictly, for example, using the BangPatterns or seq language BangPatterns .

+8
source share

All Articles