[Haskell] Converting to Foreign types
ROBERT DOUGLAS HOELZ
hoelz at wisc.edu
Sat Feb 17 18:58:49 EST 2007
Hello,
I want to convert a Haskell Integer (Data.Int.Int32) to a C long (Foreign.C.Types.CLong), but it seems this code here doesn't work:
intToLong :: Int32 -> Clong
intToLong num =
let maybelong = cast num
in if isNothing maybelong
then
0
else
fromJust maybeLong
(It always returns 0)
Could anyone give me a hint as to what the problem is?
Thanks!
More information about the Haskell
mailing list