Closed harendra-kumar closed 2 months ago
Should we expose unsafeToFold
I use it quite often when dealing with parsers.
The use of word unsafe
is not required here. This is a partial function, just like head
.
Making all partial functions unsafe
, removes the credibility of the unsafe
keyword.
This is a partial function as folds are less powerful than parsers, not all parsers can be safely converted to folds. However, folds converted to parsers can be safely converted back to folds.