[Haskell-cafe] Rewriting Char.ord

Antoine Latter aslatter at gmail.com
Sat Sep 29 11:19:17 EDT 2007

(sending to the whole list this time ...)

On 9/29/07, PR Stanley <prstanley at ntlworld.com> wrote:
> Okay, a couple of things
> what is fromEnum?

fromEnum :: (Enum a) => a -> Int

fromEnum 'c' :: Int

'fromEnum' converts any member of the "Enum" typeclass to an 'Int'.
It works fine for a Char.

> What's the role of % in length 5 takeWhile (<c) ....

I assume you mean the '$':

($) :: (a -> b) -> a -> b

It's the function application operator, but it has extremely low
precedence, so it applies everything to it's left to everything to its
right.  It's mainly a tool for cutting down on writing paranthesis:

f (1 + 1) = f $ 1 + 1

More information about the Haskell-Cafe mailing list