Apostrophe in identifiers in Haskell

The apostrophe is just part of the name. It is a naming convention (idiom) adopted in Haskell.

The convention in Haskell is that, like in math, the apostrophe on a variable name represents a variable that is somehow related, or similar, to a prior variable.

An example:

let x  = 1
    x' = x * 2
in x'

x' is related to x, and we indicate that with the apostrophe.


You can run this in GHCi, by the way,

Prelude> :{ 
Prelude| let x  = 1
Prelude|     x' = x * 2
Prelude| in x'
Prelude| :}
2

Leave a Comment