packages feed

tools-yj 0.1.0.44 → 0.1.0.45

raw patch · 3 files changed

+30/−1 lines, 3 filesPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

API changes (from Hackage documentation)

+ Data.Word.Word8: toBits :: (MonoFoldable mono, Element mono ~ Word8, Bits b) => mono -> b
+ Data.Word.Word8: toBits' :: forall b mono. (MonoFoldable mono, Element mono ~ Word8, FiniteBits b) => mono -> Maybe b
+ Data.Word.Word8: toBitsBE :: (MonoFoldable mono, Element mono ~ Word8, Bits b) => mono -> b
+ Foreign.C.ByteArray: alloca :: Int -> (B -> IO a) -> IO a

Files

+ src/Data/Word/Word8.hs view
@@ -0,0 +1,25 @@+{-# LANGUAGE ScopedTypeVariables, TypeApplications #-}+{-# LANGUAGE TypeOperators #-}+{-# OPTIONS_GHC -Wall -fno-warn-tabs #-}++module Data.Word.Word8 where++import Data.MonoTraversable+import Data.Bits+import Data.Bits.ToolsYj+import Data.Bool+import Data.Word++toBits :: (MonoFoldable mono, Element mono ~ Word8, Bits b) => mono -> b+toBits = ofoldr (\b s -> bitsToBits 8 b .|. s `shiftL` 8) zeroBits++toBits' :: forall b mono .+	(MonoFoldable mono, Element mono ~ Word8, FiniteBits b) =>+	mono -> Maybe b+toBits' bs = bool+	Nothing+	(Just $ ofoldr (\b s -> bitsToBits 8 b .|. s `shiftL` 8) zeroBits bs)+	(8 * olength bs <= finiteBitSize @b undefined)++toBitsBE :: (MonoFoldable mono, Element mono ~ Word8, Bits b) => mono -> b+toBitsBE = ofoldl' (\s b -> bitsToBits 8 b .|. s `shiftL` 8) zeroBits
src/Foreign/C/ByteArray.hs view
@@ -15,6 +15,9 @@ malloc :: Int -> IO B malloc n = (, n) <$> Alloc.mallocBytes n +alloca :: Int -> (B -> IO a) -> IO a+alloca n a = Alloc.allocaBytes n $ a . (, n)+ free :: B -> IO () free = Alloc.free . fst 
tools-yj.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           tools-yj-version:        0.1.0.44+version:        0.1.0.45 synopsis:       Tribial tools description:    Please see the README on GitHub at <https://github.com/YoshikuniJujo/tools-yj#readme> category:       Tools@@ -47,6 +47,7 @@       Data.Word.Adler32       Data.Word.Crc32       Data.Word.ToolsYj+      Data.Word.Word8       Foreign.C.ByteArray       Text.Show.ToolsYj   other-modules: