summaryrefslogtreecommitdiff
path: root/lib/Data
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2010-04-07 07:18:41 +0000
committerAlberto Ruiz <aruiz@um.es>2010-04-07 07:18:41 +0000
commitbc854c679c77cbdc97ee2e24383322550109118d (patch)
tree903f8cce6d3dfbca8a7f6ca80fbe3b080102c046 /lib/Data
parent2e48ffd1a395817288b8271299eebd0e483407af (diff)
mbCholSH
Diffstat (limited to 'lib/Data')
-rw-r--r--lib/Data/Packed/Internal/Common.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Data/Packed/Internal/Common.hs b/lib/Data/Packed/Internal/Common.hs
index bfa63f1..455b176 100644
--- a/lib/Data/Packed/Internal/Common.hs
+++ b/lib/Data/Packed/Internal/Common.hs
@@ -17,7 +17,7 @@
17module Data.Packed.Internal.Common( 17module Data.Packed.Internal.Common(
18 Adapt, 18 Adapt,
19 app1, app2, app3, app4, 19 app1, app2, app3, app4,
20 (//), check, 20 (//), check, mbCatch,
21 splitEvery, common, compatdim, 21 splitEvery, common, compatdim,
22 fi, 22 fi,
23 table 23 table
@@ -29,6 +29,7 @@ import Foreign.C.String(peekCString)
29import Foreign.C.Types 29import Foreign.C.Types
30import Foreign.Storable.Complex() 30import Foreign.Storable.Complex()
31import Data.List(transpose,intersperse) 31import Data.List(transpose,intersperse)
32import Control.Exception as E
32 33
33-- | @splitEvery 3 [1..9] == [[1,2,3],[4,5,6],[7,8,9]]@ 34-- | @splitEvery 3 [1..9] == [[1,2,3],[4,5,6],[7,8,9]]@
34splitEvery :: Int -> [a] -> [[a]] 35splitEvery :: Int -> [a] -> [[a]]
@@ -151,3 +152,9 @@ check msg f = do
151 152
152-- | description of GSL error codes 153-- | description of GSL error codes
153foreign import ccall "auxi.h gsl_strerror" gsl_strerror :: CInt -> IO (Ptr CChar) 154foreign import ccall "auxi.h gsl_strerror" gsl_strerror :: CInt -> IO (Ptr CChar)
155
156-- | Error capture and conversion to Maybe
157mbCatch :: IO x -> IO (Maybe x)
158mbCatch act = E.catch (Just `fmap` act) f
159 where f :: SomeException -> IO (Maybe x)
160 f _ = return Nothing