memory 0.14.2 → 0.14.3
raw patch · 2 files changed
+26/−1 lines, 2 filesdep +foundationdep ~base
Dependencies added: foundation
Dependency ranges changed: base
Files
- Data/ByteArray/Types.hs +17/−0
- memory.cabal +9/−1
Data/ByteArray/Types.hs view
@@ -20,6 +20,11 @@ import qualified Data.ByteString.Internal as B import Foreign.ForeignPtr (withForeignPtr) #endif+#ifdef WITH_FOUNDATION_SUPPORT+import qualified Foundation as F+import qualified Foundation.String as F (toBytes, Encoding(UTF8))+import qualified Foundation.Array.Internal as F+#endif -- | Class to Access size properties and data of a ByteArray class ByteArrayAccess ba where@@ -44,3 +49,15 @@ return (r, B.PS fptr 0 sz) #endif +#ifdef WITH_FOUNDATION_SUPPORT+uarrayRecastW8 :: F.PrimType ty => F.UArray ty -> F.UArray F.Word8+uarrayRecastW8 = F.recast++instance F.PrimType ty => ByteArrayAccess (F.UArray ty) where+ length = F.length . uarrayRecastW8+ withByteArray a f = F.withPtr (uarrayRecastW8 a) (f . castPtr)++instance ByteArrayAccess F.String where+ length = F.length+ withByteArray s f = withByteArray (F.toBytes F.UTF8 s) f+#endif
memory.cabal view
@@ -1,5 +1,5 @@ Name: memory-Version: 0.14.2+Version: 0.14.3 Synopsis: memory and related abstraction stuff Description: Chunk of memory, polymorphic byte array management and manipulation@@ -37,6 +37,11 @@ Default: True Manual: True +Flag support_foundation+ Description: add support for foundation strings and unboxed array+ Default: True+ Manual: True+ Flag support_deepseq Description: add deepseq instances for memory types Default: True@@ -89,6 +94,9 @@ if flag(support_deepseq) CPP-options: -DWITH_DEEPSEQ_SUPPORT Build-depends: deepseq >= 1.1+ if flag(support_foundation)+ CPP-options: -DWITH_FOUNDATION_SUPPORT+ Build-depends: foundation >= 0.0.4 ghc-options: -Wall -fwarn-tabs default-language: Haskell2010