indexation 0.6.3 → 0.6.4
raw patch · 3 files changed
+14/−11 lines, 3 filesdep ~potokidep ~potoki-cereal
Dependency ranges changed: potoki, potoki-cereal
Files
indexation.cabal view
@@ -1,5 +1,5 @@ name: indexation-version: 0.6.3+version: 0.6.4 category: Data synopsis: Tools for entity indexation description: A set of tools for indexing entities@@ -49,8 +49,8 @@ hashable >=1 && <2, list-t >=1 && <1.1, mmorph >=1 && <2,- potoki >=2.1 && <2.2,- potoki-cereal >=0.3 && <0.4,+ potoki >=2.1.3 && <2.2,+ potoki-cereal >=0.3.1 && <0.4, profunctors >=5.2 && <6, stm-containers >=1.1 && <1.2, text >=1 && <2,
library/Indexation/IO.hs view
@@ -17,6 +17,7 @@ import Indexation.Types import Indexation.Instances () import qualified Potoki.IO as PotokiIo+import qualified Potoki.Cereal.IO as PotokiIo import qualified Potoki.Produce as PotokiProduce import qualified Potoki.Consume as PotokiConsume import qualified Potoki.Cereal.Consume as PotokiConsume@@ -68,13 +69,7 @@ Left x -> error ("Unexpected binary parsing error: " <> x) readEntityTableFromFile :: Serialize entity => FilePath -> IO (Either IOException (Either Text (EntityTable entity)))-readEntityTableFromFile filePath =- PotokiIo.produceAndConsume- (PotokiProduce.fileBytes filePath)- (right' (PotokiConsume.get Cereal.get))+readEntityTableFromFile = PotokiIo.deserializeFromFile readIndexTableFromFile :: (Serialize entity, Eq entity, Hashable entity) => FilePath -> IO (Either IOException (Either Text (IndexTable entity)))-readIndexTableFromFile filePath =- PotokiIo.produceAndConsume- (PotokiProduce.fileBytes filePath)- (right' (PotokiConsume.get Cereal.get))+readIndexTableFromFile = PotokiIo.deserializeFromFile
library/Indexation/Potoki/Produce.hs view
@@ -3,6 +3,7 @@ entities, counts, indexedCounts,+ indices, ) where @@ -10,6 +11,7 @@ import Indexation.Types import qualified Potoki.Produce as Produce import qualified Data.Vector.Generic as GenericVector+import qualified DenseIntSet entities :: EntityTable a -> Produce a@@ -26,3 +28,9 @@ -} indexedCounts :: IndexCounts a -> Produce (Int, Word32) indexedCounts (IndexCounts vector) = Produce.vectorWithIndices vector++{-|+Indices, which are present in the set.+-}+indices :: IndexSet a -> Produce (Index a)+indices (IndexSet set) = coerce (Produce.unfoldr (DenseIntSet.presentElementsUnfoldr set))