
Hi, I'm trying to implement unicode support for nhc98, but I'm confused by this code: --------------- module Prelude(Enum(..)) where instance Enum Char where enumFrom n = enumFromTo n (toEnum 255) enumFromThen n n' = enumFromThenTo n n' (toEnum 255) toEnum c = toEnum c -- MAGIC fromEnum c = fromEnum c -- MAGIC --------------- What does this "MAGIC" mean? Do the right hand sides use the prelude functions of the compiler that nhc is built with, or the internal representation of chars is defined in other place? Regards, Antonio Regidor García ______________________________________________ Renovamos el Correo Yahoo! Nuevos servicios, más seguridad http://correo.yahoo.es

Antonio Regidor García
toEnum c = toEnum c -- MAGIC fromEnum c = fromEnum c -- MAGIC
What does this "MAGIC" mean?
MAGIC means that the function is translated internally to a single bytecode instruction. There are quite a few MAGIC comments within the nhc98 implementation of the prelude, mainly for numeric operations.
Do the right hand sides use the prelude functions of the compiler that nhc is built with,
No.
or the internal representation of chars is defined in other place?
The internal representation of a Char is identical to an Int - at least 32 bits. Regards, Malcolm

Thanks, I will look onto that.
Regards,
Antonio
--- Malcolm Wallace
MAGIC means that the function is translated internally to a single bytecode instruction. There are quite a few MAGIC comments within the nhc98 implementation of the prelude, mainly for numeric operations.
The internal representation of a Char is identical to an Int - at least 32 bits.
______________________________________________ Renovamos el Correo Yahoo! Nuevos servicios, más seguridad http://correo.yahoo.es
participants (2)
-
Antonio Regidor García
-
Malcolm Wallace