user2820579
user2820579

Reputation: 3451

use ord function in haskell is not is scope

Pretty simple, I want to convert a character to integer using the function ord, however it is not loaded automatically in the prelude because it says:

*Main> ord 'a'

<interactive>:55:1:
Not in scope: ‘ord’
Perhaps you meant one of these:
  ‘odd’ (imported from Prelude), ‘or’ (imported from Prelude)

How, for heaven's sake, I can use it??

Upvotes: 8

Views: 6013

Answers (1)

Lee
Lee

Reputation: 144196

You need to import Data.Char first:

import Data.Char

Upvotes: 21

Related Questions