packages feed

indexation 0.4 → 0.4.1

raw patch · 3 files changed

+14/−1 lines, 3 files

Files

indexation.cabal view
@@ -1,5 +1,5 @@ name: indexation-version: 0.4+version: 0.4.1 category: Data synopsis: Tools for entity indexation description: A set of tools for indexing entities
library/Indexation/Data.hs view
@@ -4,6 +4,7 @@   EntityTable,   Indexer,   lookupEntity,+  lookupIndex, ) where @@ -11,8 +12,13 @@ import Indexation.Types import Indexation.Instances () import qualified Data.Vector as Vector+import qualified Data.HashMap.Strict as HashMap   lookupEntity :: Index entity -> EntityTable entity -> Maybe entity lookupEntity (Index indexPrim) (EntityTable vector) =   vector Vector.!? indexPrim++lookupIndex :: (Eq entity, Hashable entity) => entity -> IndexTable entity -> Maybe (Index entity)+lookupIndex entity (IndexTable _ hashMap) =+  fmap Index (HashMap.lookup entity hashMap)
library/Indexation/IO.hs view
@@ -9,6 +9,7 @@   serializeIndexerToFile,   readEntitiesAmountFromEntityTableFile,   readEntityTableFromFile,+  readIndexTableFromFile, ) where @@ -68,6 +69,12 @@  readEntityTableFromFile :: Serialize entity => FilePath -> IO (Either IOException (Either Text (EntityTable entity))) readEntityTableFromFile filePath =+  PotokiIo.produceAndConsume+    (PotokiProduce.fileBytes filePath)+    (right' (PotokiConsume.get Cereal.get))++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))