diff options
author | Avi Dessauer <avi.the.coder@gmail.com> | 2019-08-21 06:03:31 -0400 |
---|---|---|
committer | Alexey Kiryushin <alexey.a.kiryushin@gmail.com> | 2019-08-21 13:03:31 +0300 |
commit | af41ab40e1fc4888d1873a9ffe681ddafdfb4ee0 (patch) | |
tree | 219315a1ef02ae0d0f21889e7b88e08318b308a2 /app/Store.hs | |
parent | 5295ac7f7f26c3a43f0fe9b9c826e876b29cf666 (diff) |
Delete trailing whitespace (#42)
Diffstat (limited to 'app/Store.hs')
-rw-r--r-- | app/Store.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/app/Store.hs b/app/Store.hs index 15f5736..b0ea4ae 100644 --- a/app/Store.hs +++ b/app/Store.hs @@ -30,7 +30,7 @@ import Data.Serialize ( #if MIN_VERSION_cereal(0,5,8) #else get, put -#endif +#endif ) import GHC.Generics (Generic) import Prelude hiding (lookup) @@ -43,7 +43,7 @@ data Store = Store { index :: M.Map BSS.ShortByteString Location , values :: BS.ByteString } - + data Location = Location { offset :: Int , length :: Int @@ -56,7 +56,7 @@ instance Serialize Location instance Serialize BSS.ShortByteString where put = put . BSS.fromShort get = BSS.toShort <$> get -#endif +#endif class StoreItem item where toByteString :: item -> BS.ByteString @@ -74,7 +74,7 @@ data ReadMode = ReadEntireFile | MemoryMapFile deriving (Show, Eq) - + load :: FilePath -> ReadMode -> IO (Either String Store) load directoryPath readMode = do let valuesFilePath = directoryPath </> valuesFileName @@ -99,7 +99,7 @@ load directoryPath readMode = do lookup :: (StoreItem item) => KeyArgs item -> Store -> Either String item lookup keyArgs = lookupByteString (itemKey keyArgs) - + lookupByteString :: (StoreItem item) => BSS.ShortByteString -> Store -> Either String item lookupByteString key store = @@ -127,7 +127,7 @@ createStore directoryPath action = withFile (directoryPath </> valuesFileName) WriteMode $ \valuesHandle -> do locMap <- action valuesHandle BS.writeFile (directoryPath </> indexFileName) (encode locMap) - + writeValues :: Handle -> M.Map BSS.ShortByteString Location |