HuwCampbell / grenade

Deep Learning in Haskell
BSD 2-Clause "Simplified" License
1.45k stars 84 forks source link

bug: foreign import type mismatch #80

Open claudeha opened 5 years ago

claudeha commented 5 years ago

There is:

void descend_cpu(int len, double rate, ...);

and

foreign import ccall unsafe descend_cpu :: Int -> Double -> ... -> IO ()

but these don't match on amd64 Linux (int is 32bit and Int is 64bit).

Should probably be size_t in the C and CSize in the FFI import.

(Also to be pedantic it should be CDouble, which you can cast efficiently using coerce which should fail to compile on systems where Double /= CDouble, but I don't know if any exist. realToFrac is the wrong thing to use.)