mini 2.0.0.0 → 2.0.0.1
raw patch · 3 files changed
+37/−2 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +6/−0
- mini.cabal +1/−1
- src/Mini/Hash/Class.hs +30/−1
CHANGELOG.md view
@@ -4,6 +4,12 @@ (!) Breaking change ``` +2.0.0.1 [2026-08-03]+--------------------+```+(!) hash(class): Fix Hashable Char instance for UTF-8+```+ 2.0.0.0 [2026-08-01] -------------------- ```
mini.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: mini-version: 2.0.0.0+version: 2.0.0.1 license: MIT license-file: LICENSE author: Victor Wallsten <victor.wallsten@protonmail.com>
src/Mini/Hash/Class.hs view
@@ -16,6 +16,8 @@ FiniteBits, finiteBitSize, shiftR,+ (.&.),+ (.|.), ) import Data.Int ( Int,@@ -34,6 +36,9 @@ import Mini.Data.Array ( Array, )+import Mini.Data.Recursion (+ bool,+ ) import Prelude ( Bool, Char,@@ -49,6 +54,7 @@ take, ($), (.),+ (<=), ) -- Classes@@ -70,7 +76,30 @@ toBytes = enumToBytes instance Hashable Char where- toBytes = enumToBytes+ toBytes = fmap fromIntegral . go . fromEnum+ where+ go c =+ bool+ ( bool+ ( bool+ [ 0xf0 .|. (c `shiftR` 18)+ , 0x80 .|. ((c `shiftR` 12) .&. 0x3f)+ , 0x80 .|. ((c `shiftR` 6) .&. 0x3f)+ , 0x80 .|. (c .&. 0x3f)+ ]+ [ 0xe0 .|. (c `shiftR` 12)+ , 0x80 .|. ((c `shiftR` 6) .&. 0x3f)+ , 0x80 .|. (c .&. 0x3f)+ ]+ $ c <= 0xffff+ )+ [ 0xc0 .|. (c `shiftR` 6)+ , 0x80 .|. (c .&. 0x3f)+ ]+ $ c <= 0x7ff+ )+ [c]+ $ c <= 0x7f instance Hashable Int where toBytes = finiteBitsIntegralToBytes