Compare commits

..

No commits in common. "uni2work" and "master" have entirely different histories.

5 changed files with 31 additions and 64 deletions

View File

@ -9,8 +9,8 @@ import Data.Bits
buildStaticMap :: (StaticElement i,StaticElement e,Ord i) => [(i,e)] -> String
buildStaticMap lst = let step :: Int -> [(i,e)] -> [(Int,(i,e))]
step n chunk = let ss = findSplitSize (genericLength chunk)
(h,d:t) = genericSplitAt ss chunk
step n chunk = let ss = findSplitSize (length chunk)
(h,d:t) = splitAt ss chunk
in if null chunk
then []
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
in "StaticMap ("++buildStaticArray (1,len) (map fst heap)++") ("++buildStaticArray (1,len) (map snd heap)++")"
maxSize :: Integer -> Integer
maxSize d = (floor $ 2^^d) - 1
maxSize :: Int -> Int
maxSize d = (1 `shiftL` d) - 1
treeDepth :: Integer -> Integer
treeDepth :: Int -> Int
treeDepth sz = find' [0..]
where
find' (x:xs) = if (floor $ 2^^x) > sz
find' (x:xs) = if 1 `shiftL` x > sz
then x
else find' xs
findSplitSize :: Integer -> Integer
findSplitSize :: Int -> Int
findSplitSize len = let depth = treeDepth len
free = (maxSize depth) - len
in if free <= (floor $ 2 ^^ (depth - 2))
in if free <= (1 `shiftL` (depth - 2))
then maxSize (depth - 1)
else len - (maxSize (depth - 2)) - 1

View File

@ -1,25 +1,13 @@
{-# LANGUAGE CPP #-}
module Main where
import Distribution.Simple
import Data.Encoding.Preprocessor.Mapping
import Data.Encoding.Preprocessor.XMLMappingBuilder
#if MIN_VERSION_Cabal(2,0,0)
main = defaultMainWithHooks (simpleUserHooks
{hookedPreProcessors = ( ("mapping" , \_ _ _ -> mappingPreprocessor)
: ("mapping2", \_ _ _ -> mappingPreprocessor)
: ("xml" , \_ _ _ -> xmlPreprocessor)
: (hookedPreProcessors simpleUserHooks)
{hookedPreProcessors = (("mapping",\_ _ -> mappingPreprocessor)
:("mapping2",\_ _ -> mappingPreprocessor)
:("xml",\_ _ -> xmlPreprocessor)
:(hookedPreProcessors simpleUserHooks)
)
})
#else
main = defaultMainWithHooks (simpleUserHooks
{hookedPreProcessors = ( ("mapping" , \_ _ -> mappingPreprocessor)
: ("mapping2", \_ _ -> mappingPreprocessor)
: ("xml" , \_ _ -> xmlPreprocessor)
: (hookedPreProcessors simpleUserHooks)
)
})
#endif

View File

@ -1,16 +1,16 @@
Name: encoding
Version: 0.8.2
Author: Henning Günther
Maintainer: daniel@wagner-home.com
License: BSD3
Name: encoding
Version: 0.8.2
Author: Henning Günther
Maintainer: daniel@wagner-home.com
License: BSD3
License-File: LICENSE
Synopsis: A library for various character encodings
Synopsis: A library for various character encodings
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.
Category: Codec
Homepage: http://code.haskell.org/encoding/
Cabal-Version: >=1.8
Build-Type: Custom
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
Homepage: http://code.haskell.org/encoding/
Cabal-Version: >=1.8
Build-Type: Custom
Extra-Source-Files:
CHANGELOG
Data/Encoding/Preprocessor/Mapping.hs
@ -36,23 +36,22 @@ Source-Repository this
Custom-Setup
Setup-Depends: base >=3 && <5,
Cabal >=1.24 && <4,
Cabal >=1.24 && <1.25,
containers,
filepath,
ghc-prim,
HaXml >=1.22 && <1.26,
deepseq
HaXml >=1.22 && <1.26
Library
Build-Depends: array >=0.4 && <0.6,
base >=4 && <5,
binary >=0.7 && <0.10,
bytestring >=0.9 && <0.11,
containers >=0.4 && <0.7,
containers >=0.4 && <0.6,
extensible-exceptions >=0.1 && <0.2,
ghc-prim >=0.3 && <0.6,
mtl >=2.0 && <2.3,
regex-compat >=0.71 && <0.96
regex-compat >=0.71 && <0.95
Extensions: CPP

View File

@ -15,7 +15,7 @@
# resolver:
# name: custom-snapshot
# location: "./custom-snapshot.yaml"
resolver: lts-15.0
resolver: lts-8.22
# User packages to be built.
# Various formats can be used as shown in the example below.
@ -36,11 +36,10 @@ resolver: lts-15.0
# non-dependency (i.e. a user package), and its test suites and benchmarks
# will not be run. This is useful for tweaking upstream packages.
packages:
- '.'
- '.'
# Dependency packages to be pulled from upstream that are not in the resolver
# (e.g., acme-missiles-0.3)
extra-deps:
- HaXml-1.25.5
extra-deps: []
# Override default flag values for local packages and extra-deps
flags: {}
@ -64,4 +63,4 @@ extra-package-dbs: []
# extra-lib-dirs: [/path/to/dir]
#
# Allow a newer minor version of GHC than the snapshot specifies
# compiler-check: newer-minor
# compiler-check: newer-minor

View File

@ -1,19 +0,0 @@
# This file was autogenerated by Stack.
# You should not edit this file by hand.
# For more information, please see the documentation at:
# https://docs.haskellstack.org/en/stable/lock_files
packages:
- completed:
hackage: HaXml-1.25.5@sha256:4f8534cda290b3d0a76b4ca5c4b9aa20902dcf029ddd50998d07c5dd608ad6f6,4420
pantry-tree:
size: 4076
sha256: 9682020b148433c41f5efee327b66708875015df8d4b3d48f875ac21f8222e1b
original:
hackage: HaXml-1.25.5
snapshots:
- completed:
size: 488576
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/15/0.yaml
sha256: e4b6a87b47ec1cf63a7f1a0884a3b276fce2b0d174a10e8753c4f618e7983568
original: lts-15.0