packages feed

DimensionalHash 0.1 → 0.1.1

raw patch · 2 files changed

+7/−1 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Data/DimensionalHash.hs view
@@ -11,13 +11,16 @@ import Data.Int
 import Data.Word
 
+-- |Return an element having all bits set to 0, excepting the bit at n
 takeBitAt :: (Bits a) => a -> Int -> a
 takeBitAt x n = x .&. (shift 1 n)
 
+-- |Return a list have shifted elements by (n + index)
 shiftElements :: (Bits a) => [a] -> Int -> [a]
 shiftElements [] n = []
 shiftElements (x:xs) n = [(shift x n)] ++ (shiftElements xs (n+1))
 
+-- |Return a list have been shifted elements by n + index
 concatBits :: (Bits a) => [a] -> Int -> a
 concatBits list n = foldl (\acc x -> acc .|. x) 0 shiftedMap
 	where 	
@@ -29,13 +32,16 @@ 	| n < precision = (concatBits list n) .|. (hash list (n + 1) precision)
 	| otherwise = concatBits list precision
 
+-- | recursevely compute the morton number.	
 class (Bits a) => (MortonNumber a) where	
 	dimensionalHash :: (Bits a) => [a] -> a
 	dimensionalHash list = hash list 0 (bitSize (head list))
 
+-- Integer haven't a fixed bitsize
 instance MortonNumber Integer where
 	dimensionalHash list = hash list 0 32
 
+-- Types that have a fixed bitsize are instance of MortonNumber
 instance MortonNumber Int8
 instance MortonNumber Int32
 instance MortonNumber Int64
DimensionalHash.cabal view
@@ -1,5 +1,5 @@ name:          DimensionalHash
-version:       0.1
+version:       0.1.1
 build-Type:    Simple
 cabal-version: >= 1.6
 tested-with:   GHC == 7.0.3