New Haskell package: OpenCL I am developing a high level OpenCL binding in Haskell, and I need peer-review and testing. It currently only gets platform and device info from OpenCL.

I have lots of functions that only change the returned type and the size of the type passed to the C library, but I don't know how to fix it.

GitHub

getDeviceInfoUlong :: CLDeviceInfo_ -&gt; CLDeviceID -&gt; IO (Either CLError CLulong)
getDeviceInfoUlong infoid device = alloca $ \(dat :: Ptr CLulong) -&gt; do
  whenSuccess (raw_clGetDeviceInfo device infoid size (castPtr dat) nullPtr)
    $ peek dat
    where 
      size = fromIntegral $ sizeOf (0::CLulong)

getDeviceInfoSizet :: CLDeviceInfo_ -&gt; CLDeviceID -&gt; IO (Either CLError CSize)
getDeviceInfoSizet infoid device = alloca $ \(dat :: Ptr CSize) -&gt; do
  whenSuccess (raw_clGetDeviceInfo device infoid size (castPtr dat) nullPtr)
    $ peek dat
    where 
      size = fromIntegral $ sizeOf (0::CSize)
Looking through the code, I see often the "high level wrapper" returns CLuints and such. I would say that is improper - Why not return the haskell type?

Instead of returning, say, CLint, do

f :: Integral i =&gt; ... -&gt; i


so that the user doesn't have to litter his code with those types and fromIntegrals all over the place.

Also, don't leave commented code in the repository. You can always recover via git if you need to.