As Travis Brown indicated in a comment, you have to import the ord function from the module Data.Char:
import Data.Char (ord)
main = print (ord 'a')
Only the Prelude module is loaded by default, all other modules have to be imported explicitly.