polysemy-fskvstore 0.1.1.0 → 0.1.2.0
raw patch · 3 files changed
+30/−21 lines, 3 filesdep ~polysemyPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: polysemy
API changes (from Hackage documentation)
- Polysemy.FSKVStore: runFSKVStoreRelBS :: Members '[Embed IO] r => Path b Dir -> Sem (FSKVStore Rel ByteString : r) a -> Sem r a
+ Polysemy.FSKVStore: runFSKVStoreRelBS :: Members '[Embed IO] r => Path b Dir -> Sem (KVStore (Path Rel File) ByteString : r) a -> Sem r a
Files
- ChangeLog.md +4/−0
- polysemy-fskvstore.cabal +5/−4
- src/Polysemy/FSKVStore.hs +21/−17
ChangeLog.md view
@@ -1,5 +1,9 @@ # Changelog for polysemy-fskvstore +## v0.1.2.0++* Explicit import lists.+ ## v0.1.1.0 * Fix inlining.
polysemy-fskvstore.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4.+-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack name: polysemy-fskvstore-version: 0.1.1.0+version: 0.1.2.0 synopsis: Run a KVStore as a filesystem in polysemy. category: Polysemy author: Daniel Firth@@ -20,7 +20,7 @@ source-repository head type: git- location: https://gitlab.com/homotopic-tech/polysemy-fskvstore+ location: https://gitlab.homotopic.tech/haskell/polysemy-fskvstore library exposed-modules:@@ -29,11 +29,12 @@ Paths_polysemy_fskvstore hs-source-dirs: src+ ghc-options: -Weverything -Wno-all-missed-specialisations -Wno-implicit-prelude -Wno-missing-safe-haskell-mode -Wno-prepositive-qualified-module -Wno-safe -Wno-unsafe build-depends: base >=4.7 && <5 , bytestring >=0.9 && <0.12 , path >=0.7.0 && <0.10- , polysemy >=1.4.0.0 && <1.7+ , polysemy >=1.4.0.0 && <1.8 , polysemy-kvstore >=0.1.2.0 && <0.2 , rio >=0.1.0.0 && <=0.2 , unliftio-path >=0.0.2.0 && <0.1
src/Polysemy/FSKVStore.hs view
@@ -1,9 +1,10 @@-{-# LANGUAGE BlockArguments #-}-{-# LANGUAGE DataKinds #-}-{-# LANGUAGE GADTs #-}-{-# LANGUAGE LambdaCase #-}-{-# LANGUAGE PolyKinds #-}-{-# LANGUAGE TypeOperators #-}+{-# LANGUAGE BlockArguments #-}+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE GADTs #-}+{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE PolyKinds #-}+{-# LANGUAGE StandaloneKindSignatures #-}+{-# LANGUAGE TypeOperators #-} module Polysemy.FSKVStore ( FSKVStore,@@ -14,14 +15,18 @@ ) where -import Data.ByteString as BS-import Path-import Polysemy-import Polysemy.KVStore-import RIO (Text, readFileUtf8, writeFileUtf8)+import Data.ByteString (ByteString)+import qualified Data.ByteString as BS (readFile, writeFile)+import Data.Kind (Type)+import Path (Abs, Dir, File, Path, Rel, parent,+ toFilePath, (</>))+import Polysemy (Embed, Members, Sem, embed, interpret)+import Polysemy.KVStore (KVStore (LookupKV, UpdateKV))+import RIO (Text, readFileUtf8, writeFileUtf8) import qualified UnliftIO.Path.Directory as U -- | Type synonym for a KVStore indexed by files.+type FSKVStore :: Type -> Type -> (Type -> Type) -> Type -> Type type FSKVStore b a = KVStore (Path b File) a -- | Run an `FSKVStore Rel ByteString` in the supplied directory in IO.@@ -30,7 +35,7 @@ runFSKVStoreRelBS :: Members '[Embed IO] r => Path b Dir ->- Sem (FSKVStore Rel ByteString ': r) a ->+ Sem (KVStore (Path Rel File) ByteString ': r) a -> Sem r a runFSKVStoreRelBS d = interpret \case LookupKV k -> embed $ do@@ -42,8 +47,7 @@ U.createDirectoryIfMissing True (d </> parent k) case v of Nothing -> pure ()- Just x -> BS.writeFile (toFilePath (d </> k)) x-{-# INLINE runFSKVStoreRelBS #-}+ Just x -> BS.writeFile (toFilePath (d </> k)) x -- | Run an `FSKVStore Abs ByteString` in IO. --@@ -62,7 +66,7 @@ U.createDirectoryIfMissing True (parent k) case v of Nothing -> pure ()- Just x -> BS.writeFile (toFilePath k) x+ Just x -> BS.writeFile (toFilePath k) x {-# INLINE runFSKVStoreAbsBS #-} -- | Run an `FSKVStore Rel Text` in the supplied directory in IO as UTF8.@@ -83,7 +87,7 @@ U.createDirectoryIfMissing True (d </> parent k) case v of Nothing -> pure ()- Just x -> writeFileUtf8 (toFilePath (d </> k)) x+ Just x -> writeFileUtf8 (toFilePath (d </> k)) x {-# INLINE runFSKVStoreRelUtf8 #-} -- | Run an `FSKVStore Abs Text` in IO as UTF8.@@ -103,5 +107,5 @@ U.createDirectoryIfMissing True (parent k) case v of Nothing -> pure ()- Just x -> writeFileUtf8 (toFilePath k) x+ Just x -> writeFileUtf8 (toFilePath k) x {-# INLINE runFSKVStoreAbsUtf8 #-}