Re: [Haskell] Converting to Foreign types

2007-02-17 Thread Stefan O'Rear
On Sat, Feb 17, 2007 at 05:58:49PM -0600, ROBERT DOUGLAS HOELZ wrote: > 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 nu

[Haskell] Converting to Foreign types

2007-02-17 Thread ROBERT DOUGLAS HOELZ
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 els