[Haskell-cafe] compilation succeeds -- execution fails
Claude Heiland-Allen
claudiusmaximus at goto10.org
Sun Mar 30 14:22:01 EDT 2008
Jason Dusek wrote:
> Stefan O'Rear <stefanor at cox.net> wrote:
>> The only type that you are allowed to assume corresponds to a C int is
>> CInt, in the Foreign.C.Types module. This probably isn't the problem,
>> but it could make problems of its own on a 64-bit or otherwise weird
>> system.
>
> So say I turn everything back to pointers to CInt, what is the
> accepted way to convert from CInt to Int and CInt to Char?
Type class methods:
-- for numbers like Int, CInt
fromIntegral :: (Num b, Integral a) => a -> b
-- for Char
fromEnum :: (Enum a) => a -> Int
toEnum :: (Enum a) => Int -> a
> Is
> relying on the fact that CInt always wraps a Haskell integer
> an okay way to go?
I don't know what you mean by this.
> I might was well learn these things now,
> before I get into bad habits.
Hope this helps,
Claude
--
http://claudiusmaximus.goto10.org
More information about the Haskell-Cafe
mailing list