Let say I have need to define the following function:
Identity = chr.ord
But the above line won’t work, the correct way would be:
Identity = (chr.ord)
Haskell usually is quite a minimalist language, so using that extra brackets does not seem natural(to me).
Is anyone aware of the need for introducing the brackets. I can’t remember where else we use the dot operator in haskell (other then for decimals).
Editing after comments from Nate/Daniel
Both you are correct. My actual method was:
nextLetter a
| a /= 'z' = chr.ord a
| a == 'z' = 'a'
Now I understand, in this case it will evaluate ord a and then try to evaluate chr.97, hence the error!
Thanks.
You’re mistaken. When I write
in
test.hsand load it inghci, nothing goes wrong.