aboutsummaryrefslogtreecommitdiff
path: root/plug/src/Montis/Foreign.hs
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2026-01-01 20:29:02 -0700
committerJosh Rahm <joshuarahm@gmail.com>2026-01-01 20:29:02 -0700
commitcb657fa9fc8124bdab42eb148e9b4a8ac69fc05e (patch)
tree299ab9c10e0c6c40fe30f38f3c75286a282c6283 /plug/src/Montis/Foreign.hs
parent88b5144ba82393e9efbffc8ba7ecc225d99dc9ed (diff)
downloadmontis-cb657fa9fc8124bdab42eb148e9b4a8ac69fc05e.tar.gz
montis-cb657fa9fc8124bdab42eb148e9b4a8ac69fc05e.tar.bz2
montis-cb657fa9fc8124bdab42eb148e9b4a8ac69fc05e.zip
[refactor] Wetterhorn -> Montis
Diffstat (limited to 'plug/src/Montis/Foreign.hs')
-rw-r--r--plug/src/Montis/Foreign.hs18
1 files changed, 18 insertions, 0 deletions
diff --git a/plug/src/Montis/Foreign.hs b/plug/src/Montis/Foreign.hs
new file mode 100644
index 0000000..fbbfb08
--- /dev/null
+++ b/plug/src/Montis/Foreign.hs
@@ -0,0 +1,18 @@
+module Montis.Foreign
+ ( TypedIntPtr (..),
+ toPtr,
+ fromPtr,
+ )
+where
+
+import Foreign (IntPtr, Ptr)
+import qualified Foreign
+
+toPtr :: TypedIntPtr a -> Ptr a
+toPtr (TypedIntPtr ip) = Foreign.intPtrToPtr ip
+
+fromPtr :: Ptr a -> TypedIntPtr a
+fromPtr = TypedIntPtr . Foreign.ptrToIntPtr
+
+newtype TypedIntPtr a = TypedIntPtr IntPtr
+ deriving (Show, Read, Eq, Ord, Num)