packages feed

tools-yj 0.1.0.34 → 0.1.0.35

raw patch · 2 files changed

+57/−3 lines, 2 filesdep +arrayPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies added: array

API changes (from Hackage documentation)

- Text.Show.ToolsYj: instance GHC.Show.Show a => Text.Show.ToolsYj.ShowIO a
+ Data.Word.Crc32: complement :: C -> C
+ Data.Word.Crc32: data C
+ Data.Word.Crc32: fromWord :: Word32 -> C
+ Data.Word.Crc32: initial :: C
+ Data.Word.Crc32: instance GHC.Classes.Eq Data.Word.Crc32.C
+ Data.Word.Crc32: instance GHC.Internal.Show.Show Data.Word.Crc32.C
+ Data.Word.Crc32: step :: C -> Word8 -> C
+ Data.Word.Crc32: toWord :: C -> Word32
+ Text.Show.ToolsYj: instance GHC.Internal.Show.Show a => Text.Show.ToolsYj.ShowIO a

Files

+ src/Data/Word/Crc32.hs view
@@ -0,0 +1,51 @@+{-# LANGUAGE ImportQualifiedPost #-}+{-# LANGUAGE BlockArguments, OverloadedStrings #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE RequiredTypeArguments #-}+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE TypeOperators #-}+{-# LANGUAGE FlexibleContexts #-}+{-# OPTIONS_GHC -Wall -fno-warn-tabs #-}++module Data.Word.Crc32 (++	C, fromWord, toWord, step, initial, complement++	) where++import Control.Arrow+import Data.Bits hiding (complement)+import Data.Bits qualified as Bits+import Data.Bits.ToolsYj+import Data.Array+import Data.Bool+import Data.Word++newtype C = C { unC :: Word32 } deriving (Show, Eq)++fromWord :: Word32 -> C+fromWord = C++toWord :: C -> Word32+toWord = unC++crc1 :: Word32 -> Word32+crc1 = uncurry (bool id (`xor` 0xedb88320)) . popBit++crc8 :: Word8 -> Word32+crc8 n = iterate crc1 (fromIntegral n) !! 8++table :: Array Word8 Word32+table = listArray (0, 255) $ map crc8 [0 .. 255]++popByte :: (Integral a, Bits a) => a -> (Word8, a)+popByte n = (fromIntegral n, n `shiftR` 8)++step :: C -> Word8 -> C+step (C n) b = C . uncurry xor . (first $ (table !) . (`xor` b)) $ popByte n++initial :: C+initial = C 0xffffffff++complement :: C -> C+complement = C . Bits.complement . unC
tools-yj.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           tools-yj-version:        0.1.0.34+version:        0.1.0.35 synopsis:       Tribial tools description:    Please see the README on GitHub at <https://github.com/YoshikuniJujo/tools-yj#readme> category:       Tools@@ -43,6 +43,7 @@       Data.Sequences.ToolsYj       Data.Text.ToolsYj       Data.Tuple.ToolsYj+      Data.Word.Crc32       Text.Show.ToolsYj   other-modules:       Paths_tools_yj@@ -52,7 +53,8 @@       src   ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints   build-depends:-      base >=4.7 && <5+      array <1+    , base >=4.7 && <5     , bytestring <1     , containers <1     , data-default <1@@ -72,7 +74,8 @@       test   ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N   build-depends:-      base >=4.7 && <5+      array <1+    , base >=4.7 && <5     , bytestring <1     , containers <1     , data-default <1