summaryrefslogtreecommitdiff
path: root/src/Data/Primitive/Struct.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/Primitive/Struct.hs')
-rw-r--r--src/Data/Primitive/Struct.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Data/Primitive/Struct.hs b/src/Data/Primitive/Struct.hs
index 705e65d..92bd387 100644
--- a/src/Data/Primitive/Struct.hs
+++ b/src/Data/Primitive/Struct.hs
@@ -110,7 +110,11 @@ instance IsStruct IO Ptr where
110 110
111withPointer :: Struct IO base tag -> (Ptr tag -> IO x) -> IO x 111withPointer :: Struct IO base tag -> (Ptr tag -> IO x) -> IO x
112withPointer (Struct (Offset off) ary) f = do 112withPointer (Struct (Offset off) ary) f = do
113#if !MIN_VERSION_primitive(0,7,0)
113 x <- f (ptr (mutableByteArrayContents ary) `plusPtr` off) 114 x <- f (ptr (mutableByteArrayContents ary) `plusPtr` off)
115#else
116 x <- f ((mutableByteArrayContents ary) `plusPtr` off)
117#endif
114 seq ary $ return x 118 seq ary $ return x
115 119
116data ForeignStruct tag = ForeignStruct 120data ForeignStruct tag = ForeignStruct