diff options
author | Dominic Steinitz <dominic@steinitz.org> | 2018-03-11 14:21:31 +0000 |
---|---|---|
committer | Dominic Steinitz <dominic@steinitz.org> | 2018-03-11 14:21:31 +0000 |
commit | a22963fa83156b76dd73777b7044897eed50e3bc (patch) | |
tree | 325c1f1d19bb0764290650770733e6bf8db171f8 /packages/sundials/src/Types.hs | |
parent | d83b17190029c11e3ab8b504e5cdc917f5863120 (diff) |
The start of an hmatrix interface to sundials
Diffstat (limited to 'packages/sundials/src/Types.hs')
-rw-r--r-- | packages/sundials/src/Types.hs | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/packages/sundials/src/Types.hs b/packages/sundials/src/Types.hs new file mode 100644 index 0000000..355850d --- /dev/null +++ b/packages/sundials/src/Types.hs | |||
@@ -0,0 +1,44 @@ | |||
1 | {-# LANGUAGE QuasiQuotes #-} | ||
2 | {-# LANGUAGE TemplateHaskell #-} | ||
3 | {-# LANGUAGE MultiWayIf #-} | ||
4 | {-# LANGUAGE OverloadedStrings #-} | ||
5 | |||
6 | module Types where | ||
7 | |||
8 | import qualified Language.C.Inline as C | ||
9 | import qualified Language.C.Inline.Unsafe as CU | ||
10 | import Data.Monoid ((<>)) | ||
11 | import Foreign.C.Types | ||
12 | import Foreign.Ptr (Ptr) | ||
13 | import Foreign.Marshal.Array | ||
14 | import qualified Data.Vector.Storable as V | ||
15 | |||
16 | import Data.Coerce (coerce) | ||
17 | import Data.Monoid ((<>)) | ||
18 | import qualified Data.Vector.Storable as V | ||
19 | import qualified Data.Vector.Storable.Mutable as VM | ||
20 | import Foreign.C.Types | ||
21 | import Foreign.ForeignPtr (newForeignPtr_) | ||
22 | import Foreign.Ptr (Ptr) | ||
23 | import Foreign.Storable (Storable) | ||
24 | import qualified Language.C.Inline as C | ||
25 | import qualified Language.C.Inline.Unsafe as CU | ||
26 | import System.IO.Unsafe (unsafePerformIO) | ||
27 | |||
28 | import qualified Language.Haskell.TH as TH | ||
29 | import qualified Language.C.Types as CT | ||
30 | import qualified Data.Map as Map | ||
31 | import Language.C.Inline.Context | ||
32 | |||
33 | |||
34 | -- This is a lie!!! | ||
35 | type SunIndexType = CLong | ||
36 | |||
37 | sunTypesTable :: Map.Map CT.TypeSpecifier TH.TypeQ | ||
38 | sunTypesTable = Map.fromList | ||
39 | [ | ||
40 | (CT.TypeName "sunindextype", [t| SunIndexType |] ) | ||
41 | ] | ||
42 | |||
43 | sunctx = mempty {ctxTypesTable = sunTypesTable} | ||
44 | |||