How do we officially state that a function is not strict in an argument?

We say that a function is strict in its argument if

f ⊥ = ⊥ 

but how can we say that a function is not strict in its argument? Can we say that a function is not strict if

 f ⊥ ≠ ⊥ 

?

How does this extend to the functions of many arguments, where we could or could not evaluate the argument depending on the value of some other argument?

I ask for this in the context of better documenting the stringency properties of Haskell functions using the Haddock documentation.

+5
source share
1 answer

There are no standard notations for expressing complex stringency properties. It is also not as simple as being strict, because for data structures you may need to specify exactly how much will be evaluated.

However, for a simple function like

 cond cte = if c then t else e 

you can imagine that the strictness is 1 & (2 | 3) , which means that it will evaluate the first argument and the second or third. These are the stringency properties that a simple stringency analyzer might encounter. (And simple ones, it seems, are the only ones worth it.)

+12
source

Source: https://habr.com/ru/post/1210572/


All Articles