netlib-ffi 0.1 → 0.1.1
raw patch · 2 files changed
+9/−4 lines, 2 filesdep +guarded-allocationdep ~transformers
Dependencies added: guarded-allocation
Dependency ranges changed: transformers
Files
- netlib-ffi.cabal +3/−2
- src/Numeric/Netlib/Utility.hs +6/−2
netlib-ffi.cabal view
@@ -1,5 +1,5 @@ Name: netlib-ffi-Version: 0.1+Version: 0.1.1 License: BSD3 License-File: LICENSE Author: Henning Thielemann <haskell@henning-thielemann.de>@@ -20,7 +20,7 @@ Build-Type: Simple Source-Repository this- Tag: 0.1+ Tag: 0.1.1 Type: darcs Location: http://hub.darcs.net/thielema/netlib-ffi/ @@ -30,6 +30,7 @@ Library Build-Depends:+ guarded-allocation >=0.0 && <0.1, storable-complex >=0.2.2 && <0.3, transformers >=0.2 && <0.6, base >=4.5 && <5
src/Numeric/Netlib/Utility.hs view
@@ -6,6 +6,7 @@ assert, ignore, cint,+ leadingDim, alloca, allocaArray, bool,@@ -23,7 +24,7 @@ import qualified Numeric.Netlib.Class as Class import qualified Foreign.Marshal.Utils as Marshal-import qualified Foreign.Marshal.Array as Array+import qualified Foreign.Marshal.Array.Guarded as Array import qualified Foreign.Marshal.Alloc as Alloc import qualified Foreign.C.String as CStr import qualified Foreign.C.Types as C@@ -66,11 +67,14 @@ cint :: Int -> FortranIO r (Ptr C.CInt) cint = ContT . Marshal.with . fromIntegral +leadingDim :: Int -> FortranIO r (Ptr C.CInt)+leadingDim = cint . max 1+ alloca :: (Storable a) => FortranIO r (Ptr a) alloca = ContT Alloc.alloca allocaArray :: (Storable a) => Int -> FortranIO r (Ptr a)-allocaArray = ContT . Array.allocaArray+allocaArray = ContT . Array.alloca bool :: Bool -> FortranIO r (Ptr Bool) bool = ContT . Marshal.with