packages feed

byteset 0.1.1.2 → 0.1.2.0

raw patch · 5 files changed

+58/−36 lines, 5 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ Data.ByteSet: generate :: (Word8 -> Bool) -> ByteSet
- Data.ByteSet: data () => Word8
+ Data.ByteSet: data Word8

Files

Data/ByteSet.hs view
@@ -15,6 +15,7 @@     -- * Construction   , empty   , singleton+  , generate   , insert   , delete     -- * Combine@@ -39,6 +40,7 @@   , (+), (-), ($), (*)   , fromIntegral   , Show (..)+  , seq     ) import Data.Word (Word8, Word64) import Data.Int (Int)@@ -83,7 +85,7 @@   where     i = fromIntegral w -generalOp :: (Word64  -> Word64  -> Word64 )+generalOp :: (Word64  -> Word64  -> Word64)           ->  ByteSet -> ByteSet -> ByteSet {-# INLINE generalOp #-} generalOp f (ByteSet s1 s2 s3 s4)@@ -130,7 +132,33 @@ singleton :: Word8 -> ByteSet singleton w = insert w empty --- | /O(1)/. Delete a byte in the byteset. Returns the original byteset when the byte was not present.+generatePart+  :: Int -- ^ Offset+  -> (Word8 -> Bool) -- ^ Element test+  -> Word64+generatePart offset test = go 0 0+  where+    go :: Word64 -- Accumulator+       -> Int -- Index+       -> Word64+    go acc 64 = acc+    go acc i =+      let i' = i + offset+          acc' = if test $ fromIntegral i' then setBit acc i else acc+      in  acc' `seq` go acc' (i+1)++-- | /O(n)/. Generate a byte set from a test function.+--   The result will contain all bytes that pass the test.+generate :: (Word8 -> Bool) -> ByteSet+generate f =+  ByteSet+    (generatePart   0 f)+    (generatePart  64 f)+    (generatePart 128 f)+    (generatePart 192 f)++-- | /O(1)/. Delete a byte in the byteset.+--   Returns the original byteset when the byte was not present. delete :: Word8 -> ByteSet -> ByteSet delete = generalSet clearBit 
− LICENSE
@@ -1,30 +0,0 @@-Copyright (c) 2023, Daniel Casanueva--All rights reserved.--Redistribution and use in source and binary forms, with or without-modification, are permitted provided that the following conditions are met:--    * Redistributions of source code must retain the above copyright-      notice, this list of conditions and the following disclaimer.--    * Redistributions in binary form must reproduce the above-      copyright notice, this list of conditions and the following-      disclaimer in the documentation and/or other materials provided-      with the distribution.--    * Neither the name of Daniel Casanueva nor the names of other-      contributors may be used to endorse or promote products derived-      from this software without specific prior written permission.--THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
byteset.cabal view
@@ -1,14 +1,14 @@+cabal-version:       1.18 name:                byteset-version:             0.1.1.2+version:             0.1.2.0 category:            Data synopsis:            Set of bytes. description:         Data structure for sets of bytes, where bytes are @Word8@ values.-license:             BSD3-license-file:        LICENSE+license:             MIT+license-file:        license.txt maintainer:          Daniel Casanueva (coding `at` danielcasanueva.eu) bug-reports:         https://codeberg.org/daniel-casanueva/byteset/issues build-type:          Simple-cabal-version:       1.18 extra-doc-files:     changelog.md  library
changelog.md view
@@ -1,3 +1,6 @@+## 0.1.2.0+* Add `generate` function.+ ## 0.1.1.2 * Metadata update. 
+ license.txt view
@@ -0,0 +1,21 @@+MIT License++Copyright (c) 2026 Daniel Díaz Casanueva++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.