Friday 3 June 2016

Haskell: chr: Convert integer to character

Data.Char module provides chr function, which takes an integer and give the correspoinding uni code character. Following is the signature of chr function.

chr :: Int -> Char

Prelude> :m Data.Char
Prelude Data.Char> 
Prelude Data.Char> :t chr
chr :: Int -> Char
Prelude Data.Char> 
Prelude Data.Char> chr 123
'{'
Prelude Data.Char> chr 97
'a'



Previous                                                 Next                                                 Home

No comments:

Post a Comment