{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_HADDOCK prune not-home #-}
module Test.KeyedVals.CheckHandle (
spec,
setupFixture,
closeFixture,
) where
import qualified Data.Map.Strict as Map
import KeyedVals.Handle
import Test.KeyedVals.Prelude
spec :: SpecWith (Handle IO)
spec :: SpecWith (Handle IO)
spec = do
String -> SpecWith (Handle IO) -> SpecWith (Handle IO)
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
context String
"with simple values" (SpecWith (Handle IO) -> SpecWith (Handle IO))
-> SpecWith (Handle IO) -> SpecWith (Handle IO)
forall a b. (a -> b) -> a -> b
$ do
String
-> (Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation))
forall a.
(HasCallStack, Example a) =>
String -> a -> SpecWith (Arg a)
it String
"should load correctly" ((Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation)))
-> (Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation))
forall a b. (a -> b) -> a -> b
$ \Handle IO
h -> do
Handle IO -> Val -> IO (Either HandleErr (Maybe Val))
forall (m :: * -> *).
Handle m -> Val -> m (Either HandleErr (Maybe Val))
loadVal Handle IO
h Val
key1 IO (Either HandleErr (Maybe Val)) -> Maybe Val -> Expectation
forall a b.
(HasCallStack, Show a, Eq a, Show b, Eq b) =>
IO (Either a b) -> b -> Expectation
`endsRight` Val -> Maybe Val
forall a. a -> Maybe a
Just Val
simple1
String
-> (Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation))
forall a.
(HasCallStack, Example a) =>
String -> a -> SpecWith (Arg a)
it String
"should update correctly" ((Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation)))
-> (Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation))
forall a b. (a -> b) -> a -> b
$ \Handle IO
h -> do
IO (Either HandleErr ()) -> Expectation
forall a b. (Show a, Show b) => IO (Either a b) -> Expectation
endsRight_ (IO (Either HandleErr ()) -> Expectation)
-> IO (Either HandleErr ()) -> Expectation
forall a b. (a -> b) -> a -> b
$ Handle IO -> Val -> Val -> IO (Either HandleErr ())
forall (m :: * -> *).
Handle m -> Val -> Val -> m (Either HandleErr ())
saveVal Handle IO
h Val
key1 Val
"changed"
Handle IO -> Val -> IO (Either HandleErr (Maybe Val))
forall (m :: * -> *).
Handle m -> Val -> m (Either HandleErr (Maybe Val))
loadVal Handle IO
h Val
key1 IO (Either HandleErr (Maybe Val)) -> Maybe Val -> Expectation
forall a b.
(HasCallStack, Show a, Eq a, Show b, Eq b) =>
IO (Either a b) -> b -> Expectation
`endsRight` Val -> Maybe Val
forall a. a -> Maybe a
Just Val
"changed"
String
-> (Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation))
forall a.
(HasCallStack, Example a) =>
String -> a -> SpecWith (Arg a)
it String
"should delete matching keys correctly " ((Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation)))
-> (Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation))
forall a b. (a -> b) -> a -> b
$ \Handle IO
h -> do
Handle IO -> Val -> IO (Either HandleErr (Maybe Val))
forall (m :: * -> *).
Handle m -> Val -> m (Either HandleErr (Maybe Val))
loadVal Handle IO
h Val
key2 IO (Either HandleErr (Maybe Val)) -> Maybe Val -> Expectation
forall a b.
(HasCallStack, Show a, Eq a, Show b, Eq b) =>
IO (Either a b) -> b -> Expectation
`endsRight` Val -> Maybe Val
forall a. a -> Maybe a
Just Val
simple2
Val -> (Glob -> Expectation) -> Expectation
forall a. Val -> (Glob -> IO a) -> IO a
withGlobOf Val
"*2" ((Glob -> Expectation) -> Expectation)
-> (Glob -> Expectation) -> Expectation
forall a b. (a -> b) -> a -> b
$ \Glob
patt -> do
IO (Either HandleErr ()) -> Expectation
forall a b. (Show a, Show b) => IO (Either a b) -> Expectation
endsRight_ (IO (Either HandleErr ()) -> Expectation)
-> IO (Either HandleErr ()) -> Expectation
forall a b. (a -> b) -> a -> b
$ Handle IO -> Glob -> IO (Either HandleErr ())
forall (m :: * -> *). Handle m -> Glob -> m (Either HandleErr ())
deleteMatches Handle IO
h Glob
patt
Handle IO -> Val -> IO (Either HandleErr (Maybe Val))
forall (m :: * -> *).
Handle m -> Val -> m (Either HandleErr (Maybe Val))
loadVal Handle IO
h Val
key2 IO (Either HandleErr (Maybe Val)) -> Maybe Val -> Expectation
forall a b.
(HasCallStack, Show a, Eq a, Show b, Eq b) =>
IO (Either a b) -> b -> Expectation
`endsRight` Maybe Val
forall a. Maybe a
Nothing
String
-> (Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation))
forall a.
(HasCallStack, Example a) =>
String -> a -> SpecWith (Arg a)
it String
"should delete correctly" ((Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation)))
-> (Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation))
forall a b. (a -> b) -> a -> b
$ \Handle IO
h -> do
Handle IO -> NonEmpty Val -> IO (Either HandleErr ())
forall (m :: * -> *).
Handle m -> NonEmpty Val -> m (Either HandleErr ())
deleteKeys Handle IO
h (Val
key1 Val -> [Val] -> NonEmpty Val
forall a. a -> [a] -> NonEmpty a
:| []) IO (Either HandleErr ()) -> () -> Expectation
forall a b.
(HasCallStack, Show a, Eq a, Show b, Eq b) =>
IO (Either a b) -> b -> Expectation
`endsRight` ()
Handle IO -> Val -> IO (Either HandleErr (Maybe Val))
forall (m :: * -> *).
Handle m -> Val -> m (Either HandleErr (Maybe Val))
loadVal Handle IO
h Val
key1 IO (Either HandleErr (Maybe Val)) -> Maybe Val -> Expectation
forall a b.
(HasCallStack, Show a, Eq a, Show b, Eq b) =>
IO (Either a b) -> b -> Expectation
`endsRight` Maybe Val
forall a. Maybe a
Nothing
String -> SpecWith (Handle IO) -> SpecWith (Handle IO)
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
context String
"with keyed values" (SpecWith (Handle IO) -> SpecWith (Handle IO))
-> SpecWith (Handle IO) -> SpecWith (Handle IO)
forall a b. (a -> b) -> a -> b
$ do
let mKey1Of :: Handle m -> Val -> m (Either HandleErr (Maybe Val))
mKey1Of Handle m
h = Handle m -> Val -> Val -> m (Either HandleErr (Maybe Val))
forall (m :: * -> *).
Handle m -> Val -> Val -> m (Either HandleErr (Maybe Val))
loadFrom Handle m
h Val
mKey1
String
-> (Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation))
forall a.
(HasCallStack, Example a) =>
String -> a -> SpecWith (Arg a)
it String
"should load correctly" ((Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation)))
-> (Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation))
forall a b. (a -> b) -> a -> b
$ \Handle IO
h -> do
Handle IO -> Val -> IO (Either HandleErr ValsByKey)
forall (m :: * -> *).
Handle m -> Val -> m (Either HandleErr ValsByKey)
loadKVs Handle IO
h Val
mKey1 IO (Either HandleErr ValsByKey) -> ValsByKey -> Expectation
forall a b.
(HasCallStack, Show a, Eq a, Show b, Eq b) =>
IO (Either a b) -> b -> Expectation
`endsRight` ValsByKey
d1
Val -> Natural -> SpecWith (Handle IO)
checkLength Val
mKey1 Natural
4
String
-> (Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation))
forall a.
(HasCallStack, Example a) =>
String -> a -> SpecWith (Arg a)
it String
"should update an indexed value correctly" ((Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation)))
-> (Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation))
forall a b. (a -> b) -> a -> b
$ \Handle IO
h -> do
IO (Either HandleErr ()) -> Expectation
forall a b. (Show a, Show b) => IO (Either a b) -> Expectation
endsRight_ (IO (Either HandleErr ()) -> Expectation)
-> IO (Either HandleErr ()) -> Expectation
forall a b. (a -> b) -> a -> b
$ Handle IO -> Val -> Val -> Val -> IO (Either HandleErr ())
forall (m :: * -> *).
Handle m -> Val -> Val -> Val -> m (Either HandleErr ())
saveTo Handle IO
h Val
mKey1 Val
key1 Val
"changed"
Handle IO -> Val -> IO (Either HandleErr (Maybe Val))
forall (m :: * -> *).
Handle m -> Val -> m (Either HandleErr (Maybe Val))
mKey1Of Handle IO
h Val
key1 IO (Either HandleErr (Maybe Val)) -> Maybe Val -> Expectation
forall a b.
(HasCallStack, Show a, Eq a, Show b, Eq b) =>
IO (Either a b) -> b -> Expectation
`endsRight` Val -> Maybe Val
forall a. a -> Maybe a
Just Val
"changed"
Val -> Natural -> SpecWith (Handle IO)
checkLength Val
mKey1 Natural
4
String
-> (Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation))
forall a.
(HasCallStack, Example a) =>
String -> a -> SpecWith (Arg a)
it String
"should add an indexed value correctly" ((Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation)))
-> (Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation))
forall a b. (a -> b) -> a -> b
$ \Handle IO
h -> do
Handle IO -> Val -> IO (Either HandleErr (Maybe Val))
forall (m :: * -> *).
Handle m -> Val -> m (Either HandleErr (Maybe Val))
mKey1Of Handle IO
h Val
"foo" IO (Either HandleErr (Maybe Val)) -> Maybe Val -> Expectation
forall a b.
(HasCallStack, Show a, Eq a, Show b, Eq b) =>
IO (Either a b) -> b -> Expectation
`endsRight` Maybe Val
forall a. Maybe a
Nothing
IO (Either HandleErr ()) -> Expectation
forall a b. (Show a, Show b) => IO (Either a b) -> Expectation
endsRight_ (IO (Either HandleErr ()) -> Expectation)
-> IO (Either HandleErr ()) -> Expectation
forall a b. (a -> b) -> a -> b
$ Handle IO -> Val -> Val -> Val -> IO (Either HandleErr ())
forall (m :: * -> *).
Handle m -> Val -> Val -> Val -> m (Either HandleErr ())
saveTo Handle IO
h Val
mKey1 Val
"foo" Val
"bar"
Handle IO -> Val -> IO (Either HandleErr (Maybe Val))
forall (m :: * -> *).
Handle m -> Val -> m (Either HandleErr (Maybe Val))
mKey1Of Handle IO
h Val
"foo" IO (Either HandleErr (Maybe Val)) -> Maybe Val -> Expectation
forall a b.
(HasCallStack, Show a, Eq a, Show b, Eq b) =>
IO (Either a b) -> b -> Expectation
`endsRight` Val -> Maybe Val
forall a. a -> Maybe a
Just Val
"bar"
Val -> Natural -> SpecWith (Handle IO)
checkLength Val
mKey1 Natural
5
String
-> (Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation))
forall a.
(HasCallStack, Example a) =>
String -> a -> SpecWith (Arg a)
it String
"should delete key-values correctly" ((Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation)))
-> (Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation))
forall a b. (a -> b) -> a -> b
$ \Handle IO
h -> do
IO (Either HandleErr ()) -> Expectation
forall a b. (Show a, Show b) => IO (Either a b) -> Expectation
endsRight_ (IO (Either HandleErr ()) -> Expectation)
-> IO (Either HandleErr ()) -> Expectation
forall a b. (a -> b) -> a -> b
$ Handle IO -> Val -> NonEmpty Val -> IO (Either HandleErr ())
forall (m :: * -> *).
Handle m -> Val -> NonEmpty Val -> m (Either HandleErr ())
deleteKeysFrom Handle IO
h Val
mKey1 (Val
key1 Val -> [Val] -> NonEmpty Val
forall a. a -> [a] -> NonEmpty a
:| [Val
key2])
Handle IO -> Val -> IO (Either HandleErr (Maybe Val))
forall (m :: * -> *).
Handle m -> Val -> m (Either HandleErr (Maybe Val))
mKey1Of Handle IO
h Val
"foo" IO (Either HandleErr (Maybe Val)) -> Maybe Val -> Expectation
forall a b.
(HasCallStack, Show a, Eq a, Show b, Eq b) =>
IO (Either a b) -> b -> Expectation
`endsRight` Val -> Maybe Val
forall a. a -> Maybe a
Just Val
"bar"
Handle IO -> Val -> IO (Either HandleErr (Maybe Val))
forall (m :: * -> *).
Handle m -> Val -> m (Either HandleErr (Maybe Val))
mKey1Of Handle IO
h Val
key1 IO (Either HandleErr (Maybe Val)) -> Maybe Val -> Expectation
forall a b.
(HasCallStack, Show a, Eq a, Show b, Eq b) =>
IO (Either a b) -> b -> Expectation
`endsRight` Maybe Val
forall a. Maybe a
Nothing
Handle IO -> Val -> IO (Either HandleErr (Maybe Val))
forall (m :: * -> *).
Handle m -> Val -> m (Either HandleErr (Maybe Val))
mKey1Of Handle IO
h Val
key2 IO (Either HandleErr (Maybe Val)) -> Maybe Val -> Expectation
forall a b.
(HasCallStack, Show a, Eq a, Show b, Eq b) =>
IO (Either a b) -> b -> Expectation
`endsRight` Maybe Val
forall a. Maybe a
Nothing
Val -> Natural -> SpecWith (Handle IO)
checkLength Val
mKey1 Natural
3
String
-> (Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation))
forall a.
(HasCallStack, Example a) =>
String -> a -> SpecWith (Arg a)
it String
"should update the key-values correctly" ((Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation)))
-> (Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation))
forall a b. (a -> b) -> a -> b
$ \Handle IO
h -> do
IO (Either HandleErr ()) -> Expectation
forall a b. (Show a, Show b) => IO (Either a b) -> Expectation
endsRight_ (IO (Either HandleErr ()) -> Expectation)
-> IO (Either HandleErr ()) -> Expectation
forall a b. (a -> b) -> a -> b
$ Handle IO -> Val -> ValsByKey -> IO (Either HandleErr ())
forall (m :: * -> *).
Handle m -> Val -> ValsByKey -> m (Either HandleErr ())
updateKVs Handle IO
h Val
mKey1 ValsByKey
d2
Handle IO -> Val -> IO (Either HandleErr (Maybe Val))
forall (m :: * -> *).
Handle m -> Val -> m (Either HandleErr (Maybe Val))
mKey1Of Handle IO
h Val
key1 IO (Either HandleErr (Maybe Val)) -> Maybe Val -> Expectation
forall a b.
(HasCallStack, Show a, Eq a, Show b, Eq b) =>
IO (Either a b) -> b -> Expectation
`endsRight` Val -> Maybe Val
forall a. a -> Maybe a
Just Val
simple3
Handle IO -> Val -> IO (Either HandleErr (Maybe Val))
forall (m :: * -> *).
Handle m -> Val -> m (Either HandleErr (Maybe Val))
mKey1Of Handle IO
h Val
key2 IO (Either HandleErr (Maybe Val)) -> Maybe Val -> Expectation
forall a b.
(HasCallStack, Show a, Eq a, Show b, Eq b) =>
IO (Either a b) -> b -> Expectation
`endsRight` Maybe Val
forall a. Maybe a
Nothing
Handle IO -> Val -> IO (Either HandleErr (Maybe Val))
forall (m :: * -> *).
Handle m -> Val -> m (Either HandleErr (Maybe Val))
mKey1Of Handle IO
h Val
key5 IO (Either HandleErr (Maybe Val)) -> Maybe Val -> Expectation
forall a b.
(HasCallStack, Show a, Eq a, Show b, Eq b) =>
IO (Either a b) -> b -> Expectation
`endsRight` Val -> Maybe Val
forall a. a -> Maybe a
Just Val
simple3
String
-> (Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation))
forall a.
(HasCallStack, Example a) =>
String -> a -> SpecWith (Arg a)
it String
"should fetch a subset of the key-values correctly" ((Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation)))
-> (Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation))
forall a b. (a -> b) -> a -> b
$ \Handle IO
h -> do
let want :: ValsByKey
want = [(Val, Val)] -> ValsByKey
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList [(Val
"foo", Val
"bar"), (Val
key5, Val
simple3)]
Handle IO -> Val -> Selection -> IO (Either HandleErr ValsByKey)
forall (m :: * -> *).
Handle m -> Val -> Selection -> m (Either HandleErr ValsByKey)
loadSlice Handle IO
h Val
mKey1 (NonEmpty Val -> Selection
AllOf (Val
"foo" Val -> [Val] -> NonEmpty Val
forall a. a -> [a] -> NonEmpty a
:| [Val
key5])) IO (Either HandleErr ValsByKey) -> ValsByKey -> Expectation
forall a b.
(HasCallStack, Show a, Eq a, Show b, Eq b) =>
IO (Either a b) -> b -> Expectation
`endsRight` ValsByKey
want
String
-> (Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation))
forall a.
(HasCallStack, Example a) =>
String -> a -> SpecWith (Arg a)
it String
"should delete correctly" ((Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation)))
-> (Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation))
forall a b. (a -> b) -> a -> b
$ \Handle IO
h -> do
IO (Either HandleErr ()) -> Expectation
forall a b. (Show a, Show b) => IO (Either a b) -> Expectation
endsRight_ (IO (Either HandleErr ()) -> Expectation)
-> IO (Either HandleErr ()) -> Expectation
forall a b. (a -> b) -> a -> b
$ Handle IO -> NonEmpty Val -> IO (Either HandleErr ())
forall (m :: * -> *).
Handle m -> NonEmpty Val -> m (Either HandleErr ())
deleteKeys Handle IO
h (Val
mKey1 Val -> [Val] -> NonEmpty Val
forall a. a -> [a] -> NonEmpty a
:| [])
Handle IO -> Val -> IO (Either HandleErr ValsByKey)
forall (m :: * -> *).
Handle m -> Val -> m (Either HandleErr ValsByKey)
loadKVs Handle IO
h Val
mKey1 IO (Either HandleErr ValsByKey) -> ValsByKey -> Expectation
forall a b.
(HasCallStack, Show a, Eq a, Show b, Eq b) =>
IO (Either a b) -> b -> Expectation
`endsRight` ValsByKey
forall k a. Map k a
Map.empty
Handle IO -> Val -> IO (Either HandleErr (Maybe Val))
forall (m :: * -> *).
Handle m -> Val -> m (Either HandleErr (Maybe Val))
mKey1Of Handle IO
h Val
"foo" IO (Either HandleErr (Maybe Val)) -> Maybe Val -> Expectation
forall a b.
(HasCallStack, Show a, Eq a, Show b, Eq b) =>
IO (Either a b) -> b -> Expectation
`endsRight` Maybe Val
forall a. Maybe a
Nothing
Val -> Natural -> SpecWith (Handle IO)
checkLength Val
mKey1 Natural
0
setupFixture :: Handle IO -> IO (Handle IO)
setupFixture :: Handle IO -> IO (Handle IO)
setupFixture Handle IO
h = do
IO (Either HandleErr ()) -> Expectation
orThrowHandleErr (IO (Either HandleErr ()) -> Expectation)
-> IO (Either HandleErr ()) -> Expectation
forall a b. (a -> b) -> a -> b
$ Handle IO -> Val -> Val -> IO (Either HandleErr ())
forall (m :: * -> *).
Handle m -> Val -> Val -> m (Either HandleErr ())
saveVal Handle IO
h Val
key1 Val
simple1
IO (Either HandleErr ()) -> Expectation
orThrowHandleErr (IO (Either HandleErr ()) -> Expectation)
-> IO (Either HandleErr ()) -> Expectation
forall a b. (a -> b) -> a -> b
$ Handle IO -> Val -> Val -> IO (Either HandleErr ())
forall (m :: * -> *).
Handle m -> Val -> Val -> m (Either HandleErr ())
saveVal Handle IO
h Val
key2 Val
simple2
IO (Either HandleErr ()) -> Expectation
orThrowHandleErr (IO (Either HandleErr ()) -> Expectation)
-> IO (Either HandleErr ()) -> Expectation
forall a b. (a -> b) -> a -> b
$ Handle IO -> Val -> ValsByKey -> IO (Either HandleErr ())
forall (m :: * -> *).
Handle m -> Val -> ValsByKey -> m (Either HandleErr ())
saveKVs Handle IO
h Val
mKey1 ValsByKey
d1
Handle IO -> IO (Handle IO)
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Handle IO
h
closeFixture :: Handle IO -> IO ()
closeFixture :: Handle IO -> Expectation
closeFixture = Handle IO -> Expectation
forall (m :: * -> *). Handle m -> m ()
close
checkLength :: Key -> Natural -> SpecWith (Handle IO)
checkLength :: Val -> Natural -> SpecWith (Handle IO)
checkLength Val
aKey Natural
n = String -> SpecWith (Handle IO) -> SpecWith (Handle IO)
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
context String
"and the reported length" (SpecWith (Handle IO) -> SpecWith (Handle IO))
-> SpecWith (Handle IO) -> SpecWith (Handle IO)
forall a b. (a -> b) -> a -> b
$ do
String
-> (Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation))
forall a.
(HasCallStack, Example a) =>
String -> a -> SpecWith (Arg a)
it String
"should be correct " ((Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation)))
-> (Handle IO -> Expectation)
-> SpecWith (Arg (Handle IO -> Expectation))
forall a b. (a -> b) -> a -> b
$ \Handle IO
h -> do
Handle IO -> Val -> IO (Either HandleErr Natural)
forall (m :: * -> *).
Handle m -> Val -> m (Either HandleErr Natural)
countKVs Handle IO
h Val
aKey IO (Either HandleErr Natural) -> Natural -> Expectation
forall a b.
(HasCallStack, Show a, Eq a, Show b, Eq b) =>
IO (Either a b) -> b -> Expectation
`endsRight` Natural
n
key1, key2, key3, key4, key5, mKey1 :: Key
key1 :: Val
key1 = Val
"a-simple-key-1"
key2 :: Val
key2 = Val
"a-simple-key-2"
key3 :: Val
key3 = Val
"another-key-1"
key4 :: Val
key4 = Val
"another_key-2"
key5 :: Val
key5 = Val
"yet-another-key"
mKey1 :: Val
mKey1 = Val
"a-map-key-1"
simple1, simple2, simple3 :: Val
simple1 :: Val
simple1 = Val
"a-simple-value-1"
simple2 :: Val
simple2 = Val
"a-simple-value-2"
simple3 :: Val
simple3 = Val
"a-simple-value-3"
d1, d2 :: ValsByKey
d1 :: ValsByKey
d1 = [(Val, Val)] -> ValsByKey
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList [(Val
key1, Val
simple1), (Val
key2, Val
simple2), (Val
key3, Val
simple1), (Val
key4, Val
simple2)]
d2 :: ValsByKey
d2 = [(Val, Val)] -> ValsByKey
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList [(Val
key1, Val
simple3), (Val
key5, Val
simple3)]