Fix arithmetic for ghc8.8.2
This commit is contained in:
parent
00270d4bc7
commit
22fc3bb148
@ -9,8 +9,8 @@ import Data.Bits
|
|||||||
|
|
||||||
buildStaticMap :: (StaticElement i,StaticElement e,Ord i) => [(i,e)] -> String
|
buildStaticMap :: (StaticElement i,StaticElement e,Ord i) => [(i,e)] -> String
|
||||||
buildStaticMap lst = let step :: Int -> [(i,e)] -> [(Int,(i,e))]
|
buildStaticMap lst = let step :: Int -> [(i,e)] -> [(Int,(i,e))]
|
||||||
step n chunk = let ss = findSplitSize (length chunk)
|
step n chunk = let ss = findSplitSize (genericLength chunk)
|
||||||
(h,d:t) = splitAt ss chunk
|
(h,d:t) = genericSplitAt ss chunk
|
||||||
in if null chunk
|
in if null chunk
|
||||||
then []
|
then []
|
||||||
else (n,d):((step (n*2) h)++(step (n*2+1) t))
|
else (n,d):((step (n*2) h)++(step (n*2+1) t))
|
||||||
@ -24,19 +24,19 @@ buildStaticMap lst = let step :: Int -> [(i,e)] -> [(Int,(i,e))]
|
|||||||
len = length heap
|
len = length heap
|
||||||
in "StaticMap ("++buildStaticArray (1,len) (map fst heap)++") ("++buildStaticArray (1,len) (map snd heap)++")"
|
in "StaticMap ("++buildStaticArray (1,len) (map fst heap)++") ("++buildStaticArray (1,len) (map snd heap)++")"
|
||||||
|
|
||||||
maxSize :: Int -> Int
|
maxSize :: Integer -> Integer
|
||||||
maxSize d = (1 `shiftL` d) - 1
|
maxSize d = (floor $ 2^^d) - 1
|
||||||
|
|
||||||
treeDepth :: Int -> Int
|
treeDepth :: Integer -> Integer
|
||||||
treeDepth sz = find' [0..]
|
treeDepth sz = find' [0..]
|
||||||
where
|
where
|
||||||
find' (x:xs) = if 1 `shiftL` x > sz
|
find' (x:xs) = if (floor $ 2^^x) > sz
|
||||||
then x
|
then x
|
||||||
else find' xs
|
else find' xs
|
||||||
|
|
||||||
findSplitSize :: Int -> Int
|
findSplitSize :: Integer -> Integer
|
||||||
findSplitSize len = let depth = treeDepth len
|
findSplitSize len = let depth = treeDepth len
|
||||||
free = (maxSize depth) - len
|
free = (maxSize depth) - len
|
||||||
in if free <= (1 `shiftL` (depth - 2))
|
in if free <= (floor $ 2 ^^ (depth - 2))
|
||||||
then maxSize (depth - 1)
|
then maxSize (depth - 1)
|
||||||
else len - (maxSize (depth - 2)) - 1
|
else len - (maxSize (depth - 2)) - 1
|
||||||
|
|||||||
@ -1,16 +1,16 @@
|
|||||||
Name: encoding
|
Name: encoding
|
||||||
Version: 0.8.2
|
Version: 0.8.2
|
||||||
Author: Henning Günther
|
Author: Henning Günther
|
||||||
Maintainer: daniel@wagner-home.com
|
Maintainer: daniel@wagner-home.com
|
||||||
License: BSD3
|
License: BSD3
|
||||||
License-File: LICENSE
|
License-File: LICENSE
|
||||||
Synopsis: A library for various character encodings
|
Synopsis: A library for various character encodings
|
||||||
Description:
|
Description:
|
||||||
Haskell has excellect handling of unicode, the Char type covers all unicode chars. Unfortunately, there's no possibility to read or write something to the outer world in an encoding other than ascii due to the lack of support for encodings. This library should help with that.
|
Haskell has excellect handling of unicode, the Char type covers all unicode chars. Unfortunately, there's no possibility to read or write something to the outer world in an encoding other than ascii due to the lack of support for encodings. This library should help with that.
|
||||||
Category: Codec
|
Category: Codec
|
||||||
Homepage: http://code.haskell.org/encoding/
|
Homepage: http://code.haskell.org/encoding/
|
||||||
Cabal-Version: >=1.8
|
Cabal-Version: >=1.8
|
||||||
Build-Type: Custom
|
Build-Type: Custom
|
||||||
Extra-Source-Files:
|
Extra-Source-Files:
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
Data/Encoding/Preprocessor/Mapping.hs
|
Data/Encoding/Preprocessor/Mapping.hs
|
||||||
@ -36,11 +36,12 @@ Source-Repository this
|
|||||||
|
|
||||||
Custom-Setup
|
Custom-Setup
|
||||||
Setup-Depends: base >=3 && <5,
|
Setup-Depends: base >=3 && <5,
|
||||||
Cabal >=1.24 && <2.5,
|
Cabal >=1.24 && <4,
|
||||||
containers,
|
containers,
|
||||||
filepath,
|
filepath,
|
||||||
ghc-prim,
|
ghc-prim,
|
||||||
HaXml >=1.22 && <1.26
|
HaXml >=1.22 && <1.26,
|
||||||
|
deepseq
|
||||||
|
|
||||||
Library
|
Library
|
||||||
Build-Depends: array >=0.4 && <0.6,
|
Build-Depends: array >=0.4 && <0.6,
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
# resolver:
|
# resolver:
|
||||||
# name: custom-snapshot
|
# name: custom-snapshot
|
||||||
# location: "./custom-snapshot.yaml"
|
# location: "./custom-snapshot.yaml"
|
||||||
resolver: lts-14.6
|
resolver: lts-15.0
|
||||||
|
|
||||||
# User packages to be built.
|
# User packages to be built.
|
||||||
# Various formats can be used as shown in the example below.
|
# Various formats can be used as shown in the example below.
|
||||||
|
|||||||
@ -13,7 +13,7 @@ packages:
|
|||||||
hackage: HaXml-1.25.5
|
hackage: HaXml-1.25.5
|
||||||
snapshots:
|
snapshots:
|
||||||
- completed:
|
- completed:
|
||||||
size: 524127
|
size: 488576
|
||||||
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/14/6.yaml
|
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/15/0.yaml
|
||||||
sha256: dc70dfb45e2c32f54719819bd055f46855dd4b3bd2e58b9f3f38729a2d553fbb
|
sha256: e4b6a87b47ec1cf63a7f1a0884a3b276fce2b0d174a10e8753c4f618e7983568
|
||||||
original: lts-14.6
|
original: lts-15.0
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user