diff options
Diffstat (limited to 'lib/GSL/Special')
-rw-r--r-- | lib/GSL/Special/Internal.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/GSL/Special/Internal.hs b/lib/GSL/Special/Internal.hs index c7455d9..ad1aaa2 100644 --- a/lib/GSL/Special/Internal.hs +++ b/lib/GSL/Special/Internal.hs | |||
@@ -25,7 +25,7 @@ module GSL.Special.Internal ( | |||
25 | where | 25 | where |
26 | 26 | ||
27 | import Foreign | 27 | import Foreign |
28 | import Data.Packed.Internal.Common(check,(//)) | 28 | import Data.Packed.Internal(check,(//)) |
29 | 29 | ||
30 | 30 | ||
31 | data Precision = PrecDouble | PrecSingle | PrecApprox | 31 | data Precision = PrecDouble | PrecSingle | PrecApprox |
@@ -39,10 +39,10 @@ type Gsl_mode_t = Int | |||
39 | 39 | ||
40 | ---------------------------------------------------------------- | 40 | ---------------------------------------------------------------- |
41 | -- | access to a sf_result | 41 | -- | access to a sf_result |
42 | createSFR :: Storable a => t -> (Ptr a -> IO Int) -> (a, a) | 42 | createSFR :: Storable a => String -> (Ptr a -> IO Int) -> (a, a) |
43 | createSFR s f = unsafePerformIO $ do | 43 | createSFR s f = unsafePerformIO $ do |
44 | p <- mallocArray 2 | 44 | p <- mallocArray 2 |
45 | f p // check "createSFR" [] | 45 | f p // check s [] |
46 | [val,err] <- peekArray 2 p | 46 | [val,err] <- peekArray 2 p |
47 | free p | 47 | free p |
48 | return (val,err) | 48 | return (val,err) |
@@ -52,12 +52,12 @@ createSFR s f = unsafePerformIO $ do | |||
52 | -- the sf_result_e10 contains two doubles and the exponent | 52 | -- the sf_result_e10 contains two doubles and the exponent |
53 | 53 | ||
54 | -- | acces to sf_result_e10 | 54 | -- | acces to sf_result_e10 |
55 | createSFR_E10 :: (Storable t2, Storable t3, Storable t1) => t -> (Ptr a -> IO Int) -> (t1, t2, t3) | 55 | createSFR_E10 :: (Storable t2, Storable t3, Storable t1) => String -> (Ptr a -> IO Int) -> (t1, t2, t3) |
56 | createSFR_E10 s f = unsafePerformIO $ do | 56 | createSFR_E10 s f = unsafePerformIO $ do |
57 | let sd = sizeOf (0::Double) | 57 | let sd = sizeOf (0::Double) |
58 | let si = sizeOf (0::Int) | 58 | let si = sizeOf (0::Int) |
59 | p <- mallocBytes (2*sd + si) | 59 | p <- mallocBytes (2*sd + si) |
60 | f p // check "createSFR_E10" [] | 60 | f p // check s [] |
61 | val <- peekByteOff p 0 | 61 | val <- peekByteOff p 0 |
62 | err <- peekByteOff p sd | 62 | err <- peekByteOff p sd |
63 | expo <- peekByteOff p (2*sd) | 63 | expo <- peekByteOff p (2*sd) |