What does apostrophe mean in Haskell?

haskell

Solution

`'` is simply another identifier character like any other. `foldl'` is a completely separate function from `foldl`; it could just as well be called `strictFold`. It's called that because it's closely related to `foldl`: it's a `foldl` where the accumulator is evaluated at every step, so that large thunks don't build up. For instance, `foldl (+) 0` will overflow the stack on a large list, but `foldl' (+) 0` won't.

In general, the suffixing of a `'` means one of three things: `foo'` is either a helper definition made for the purpose of defining `foo`, a modified version of `foo` (that is, `state`, `state'`, and `state''` could be an initial state and two updated versions), or a strict version of `foo`.

Problem

Sometimes I see code with the following expression: ``` example = example' [] ``` Or what is the different between these functions? ``` foldl foldl' ```

Original source

Related problems