diff options
Diffstat (limited to 'src/Data/Primitive/Struct.hs')
-rw-r--r-- | src/Data/Primitive/Struct.hs | 4 |
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 | ||
111 | withPointer :: Struct IO base tag -> (Ptr tag -> IO x) -> IO x | 111 | withPointer :: Struct IO base tag -> (Ptr tag -> IO x) -> IO x |
112 | withPointer (Struct (Offset off) ary) f = do | 112 | withPointer (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 | ||
116 | data ForeignStruct tag = ForeignStruct | 120 | data ForeignStruct tag = ForeignStruct |