-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Run 'tmp' processes in integration tests -- -- tmp-proc runs services in docker containers for use in -- integration tests. It aims to make using these services become like -- accessing tmp processes, similar to how tmp file or -- directories are used. It aspires to provide a user-friendly API, while -- including useful features such as -- --
-- >>> :kind! SortSymbols '["xyz", "def", "abc"] -- SortSymbols '["xyz", "def", "abc"] :: [Symbol] -- = '["abc", "def", "xyz"] --type family SortSymbols (xs :: [Symbol]) :: [Symbol] -- | Takes 1 element at a time from a list until the desired length is -- reached. -- --
-- >>> :kind! Take '["a", "b", "c", "d"] 2 -- Take '["a", "b", "c", "d"] 2 :: [Symbol] -- = '["a", "b"] --type family Take (xs :: [k]) (n :: Nat) :: [k] -- | Drops 1 element at a time until the the dropped target is reached. -- --
-- >>> :kind! Drop '["a", "b", "c", "d"] 2 -- Drop '["a", "b", "c", "d"] 2 :: [Symbol] -- = '["c", "d"] ---- --
-- >>> :kind! Drop '["a"] 2 -- Drop '["a"] 2 :: [Symbol] -- = '[] --type family Drop (xs :: [k]) (n :: Nat) :: [k] -- | Counts a list, 1 element at a time. -- --
-- >>> :kind! CmpNat 4 (LengthOf '[1, 2, 3, 4]) -- CmpNat 4 (LengthOf '[1, 2, 3, 4]) :: Ordering -- = 'EQ --type family LengthOf (xs :: [k]) :: Nat -- | Computes the midpoint of a number. -- -- N.B: maximum value that this works for depends on the reduction limit -- of the type-checker. -- --
-- >>> :kind! CmpNat 49 (HalfOf 99) -- CmpNat 49 (HalfOf 99) :: Ordering -- = 'EQ ---- --
-- >>> :kind! CmpNat 50 (HalfOf 100) -- CmpNat 50 (HalfOf 100) :: Ordering -- = 'EQ --type family HalfOf (n :: Nat) :: Nat -- | Defines type-level data structures and combinators used by -- System.TmpProc.Docker and System.TmpProc.Warp. -- -- HList implements a heterogenous list used to define types that -- represent multiple concurrent tmp procs. -- -- KV is intended for internal use within the tmp-proc -- package. It allows indexing and sorting of lists of tmp procs. module System.TmpProc.TypeLevel -- | Defines a Heterogenous list. data HList :: [Type] -> Type [HNil] :: HList '[] [HCons] :: anyTy -> HList manyTys -> HList (anyTy : manyTys) infixr 5 `HCons` -- | An infix alias for HCons. (&:) :: x -> HList xs -> HList (x : xs) infixr 5 &: -- | Construct a singleton HList only :: x -> HList '[x] -- | An infix alias for both. (&:&) :: x -> y -> HList '[x, y] infixr 6 &:& -- | Construct a two-item HList. both :: x -> y -> HList '[x, y] infixr 6 `both` -- | Obtain the first element of a HList. hHead :: HList (a : as) -> a -- | Get an item in an HList given its type. hOf :: forall y xs. IsInProof y xs => Proxy y -> HList xs -> y -- | Allows reordering of similar HLists. -- --
-- >>> hReorder @_ @'[Bool, Int] ('c' &: (3 :: Int) &: True &: (3.1 :: Double) &: HNil) -- True &: 3 &: HNil ---- --
-- >>> hReorder @_ @'[Double, Bool, Int] ('c' &: (3 :: Int) &: True &: (3.1 :: Double) &: HNil) -- 3.1 &: True &: 3 &: HNil --class ReorderH xs ys hReorder :: ReorderH xs ys => HList xs -> HList ys -- | Use a type-level symbol as key type that indexes a value -- type. data KV :: Symbol -> Type -> Type [V] :: a -> KV s a -- | Select an item from an HList of KVs by -- key. -- -- N.B Returns the first item. It assumes the keys in the KV HList -- are unique. TODO: enforce this rule using a constraint. -- --
-- >>> select @"d" @Double @'[KV "b" Bool, KV "d" Double] (V True &: V (3.1 :: Double) &: HNil) -- 3.1 --select :: forall k t xs. MemberKV k t xs => HList xs -> t -- | Select items with specified keys from an HList of -- KVs by key. -- -- N.B. this this is an internal function. -- -- The keys must be provided in the same order as they occur in the -- HList, any other order will likely result in an compiler error. -- --
-- >>> selectMany @'["b"] @'[Bool] @'[KV "b" Bool, KV "d" Double] (V True &: V (3.1 :: Double) &: HNil) -- True &: HNil --selectMany :: forall ks ts xs. ManyMemberKV ks ts xs => HList xs -> HList ts -- | Proves a symbol and its type occur as entry in a list of -- KV types. data LookupKV (k :: Symbol) t (xs :: [Type]) [AtHead] :: LookupKV k t (KV k t : kvs) [OtherKeys] :: LookupKV k t kvs -> LookupKV k t (KV ok ot : kvs) -- | Generate proof instances of LookupKV. class MemberKV (k :: Symbol) (t :: Type) (xs :: [Type]) lookupProof :: MemberKV k t xs => LookupKV k t xs -- | Generate proof instances of LookupMany. class ManyMemberKV (ks :: [Symbol]) (ts :: [Type]) (kvs :: [Type]) manyProof :: ManyMemberKV ks ts kvs => LookupMany ks ts kvs -- | A constraint that confirms that a type is not present in a type-level -- list. type family IsAbsent e r :: Constraint -- | Generate proof instances of IsIn. class IsInProof t (tys :: [Type]) instance (System.TmpProc.TypeLevel.IsInProof y xs, System.TmpProc.TypeLevel.ReorderH xs ys) => System.TmpProc.TypeLevel.ReorderH xs (y : ys) instance System.TmpProc.TypeLevel.IsInProof t (t : tys) instance System.TmpProc.TypeLevel.IsInProof t tys => System.TmpProc.TypeLevel.IsInProof t (a : tys) instance System.TmpProc.TypeLevel.ReorderH xs '[] instance System.TmpProc.TypeLevel.ManyMemberKV '[k] '[t] (System.TmpProc.TypeLevel.KV k t : ks) instance System.TmpProc.TypeLevel.ManyMemberKV ks ts kvs => System.TmpProc.TypeLevel.ManyMemberKV (k : ks) (t : ts) (System.TmpProc.TypeLevel.KV k t : kvs) instance System.TmpProc.TypeLevel.ManyMemberKV ks ts kvs => System.TmpProc.TypeLevel.ManyMemberKV ks ts (System.TmpProc.TypeLevel.KV ok ot : kvs) instance System.TmpProc.TypeLevel.MemberKV k t '[System.TmpProc.TypeLevel.KV k t] instance System.TmpProc.TypeLevel.MemberKV k t (System.TmpProc.TypeLevel.KV k t : kvs) instance System.TmpProc.TypeLevel.MemberKV k t kvs => System.TmpProc.TypeLevel.MemberKV k t (System.TmpProc.TypeLevel.KV ok ot : kvs) instance GHC.Show.Show (System.TmpProc.TypeLevel.HList '[]) instance (GHC.Show.Show x, GHC.Show.Show (System.TmpProc.TypeLevel.HList xs)) => GHC.Show.Show (System.TmpProc.TypeLevel.HList (x : xs)) instance GHC.Classes.Eq (System.TmpProc.TypeLevel.HList '[]) instance (GHC.Classes.Eq x, GHC.Classes.Eq (System.TmpProc.TypeLevel.HList xs)) => GHC.Classes.Eq (System.TmpProc.TypeLevel.HList (x : xs)) -- | Provides the core datatypes and combinators used to launch temporary -- (tmp) processes (procs) using docker. -- -- tmp-proc helps launch services used by integration tests on -- docker. It aims to simplify writing those kind of tests, by providing -- combinators that -- --
-- >>> :kind! SortSymbols '["xyz", "def", "abc"] -- SortSymbols '["xyz", "def", "abc"] :: [Symbol] -- = '["abc", "def", "xyz"] --type family SortSymbols (xs :: [Symbol]) :: [Symbol] -- | Computes the midpoint of a number. -- -- N.B: maximum value that this works for depends on the reduction limit -- of the type-checker. -- --
-- >>> :kind! CmpNat 49 (HalfOf 99) -- CmpNat 49 (HalfOf 99) :: Ordering -- = 'EQ ---- --
-- >>> :kind! CmpNat 50 (HalfOf 100) -- CmpNat 50 (HalfOf 100) :: Ordering -- = 'EQ --type family HalfOf (n :: Nat) :: Nat -- | Counts a list, 1 element at a time. -- --
-- >>> :kind! CmpNat 4 (LengthOf '[1, 2, 3, 4]) -- CmpNat 4 (LengthOf '[1, 2, 3, 4]) :: Ordering -- = 'EQ --type family LengthOf (xs :: [k]) :: Nat -- | Drops 1 element at a time until the the dropped target is reached. -- --
-- >>> :kind! Drop '["a", "b", "c", "d"] 2 -- Drop '["a", "b", "c", "d"] 2 :: [Symbol] -- = '["c", "d"] ---- --
-- >>> :kind! Drop '["a"] 2 -- Drop '["a"] 2 :: [Symbol] -- = '[] --type family Drop (xs :: [k]) (n :: Nat) :: [k] -- | Takes 1 element at a time from a list until the desired length is -- reached. -- --
-- >>> :kind! Take '["a", "b", "c", "d"] 2 -- Take '["a", "b", "c", "d"] 2 :: [Symbol] -- = '["a", "b"] --type family Take (xs :: [k]) (n :: Nat) :: [k] -- | Generate proof instances of IsIn. class IsInProof t (tys :: [Type]) -- | Allows reordering of similar HLists. -- --
-- >>> hReorder @_ @'[Bool, Int] ('c' &: (3 :: Int) &: True &: (3.1 :: Double) &: HNil) -- True &: 3 &: HNil ---- --
-- >>> hReorder @_ @'[Double, Bool, Int] ('c' &: (3 :: Int) &: True &: (3.1 :: Double) &: HNil) -- 3.1 &: True &: 3 &: HNil --class ReorderH xs ys hReorder :: ReorderH xs ys => HList xs -> HList ys -- | Generate proof instances of LookupMany. class ManyMemberKV (ks :: [Symbol]) (ts :: [Type]) (kvs :: [Type]) -- | Generate proof instances of LookupKV. class MemberKV (k :: Symbol) (t :: Type) (xs :: [Type]) -- | A constraint that confirms that a type is not present in a type-level -- list. type family IsAbsent e r :: Constraint -- | Use a type-level symbol as key type that indexes a value -- type. data KV :: Symbol -> Type -> Type [V] :: a -> KV s a -- | Defines a Heterogenous list. data HList :: [Type] -> Type [HNil] :: HList '[] [HCons] :: anyTy -> HList manyTys -> HList (anyTy : manyTys) infixr 5 `HCons` -- | Obtain the first element of a HList. hHead :: HList (a : as) -> a -- | Get an item in an HList given its type. hOf :: forall y xs. IsInProof y xs => Proxy y -> HList xs -> y -- | An infix alias for HCons. (&:) :: x -> HList xs -> HList (x : xs) infixr 5 &: -- | Construct a two-item HList. both :: x -> y -> HList '[x, y] infixr 6 `both` -- | An infix alias for both. (&:&) :: x -> y -> HList '[x, y] infixr 6 &:& -- | Construct a singleton HList only :: x -> HList '[x] -- | Select an item from an HList of KVs by -- key. -- -- N.B Returns the first item. It assumes the keys in the KV HList -- are unique. TODO: enforce this rule using a constraint. -- --
-- >>> select @"d" @Double @'[KV "b" Bool, KV "d" Double] (V True &: V (3.1 :: Double) &: HNil) -- 3.1 --select :: forall k t xs. MemberKV k t xs => HList xs -> t -- | Select items with specified keys from an HList of -- KVs by key. -- -- N.B. this this is an internal function. -- -- The keys must be provided in the same order as they occur in the -- HList, any other order will likely result in an compiler error. -- --
-- >>> selectMany @'["b"] @'[Bool] @'[KV "b" Bool, KV "d" Double] (V True &: V (3.1 :: Double) &: HNil) -- True &: HNil --selectMany :: forall ks ts xs. ManyMemberKV ks ts xs => HList xs -> HList ts instance GHC.Show.Show System.TmpProc.Docker.Pinged instance GHC.Classes.Eq System.TmpProc.Docker.Pinged instance GHC.Show.Show System.TmpProc.Docker.SlimHandle instance GHC.Classes.Eq System.TmpProc.Docker.SlimHandle instance System.TmpProc.Docker.Connectables '[] instance (System.TmpProc.Docker.Connectable a, System.TmpProc.Docker.Connectables as, System.TmpProc.TypeLevel.IsAbsent a as) => System.TmpProc.Docker.Connectables (a : as) instance System.TmpProc.Docker.HasHandle p procs => System.TmpProc.Docker.HandleOf p procs p instance System.TmpProc.Docker.HasHandle p procs => System.TmpProc.Docker.IxReset p procs instance System.TmpProc.Docker.HasHandle p procs => System.TmpProc.Docker.IxPing p procs instance System.TmpProc.Docker.HasHandle p procs => System.TmpProc.Docker.IxUriOf p procs instance System.TmpProc.Docker.HasNamedHandle name p procs => System.TmpProc.Docker.HandleOf name procs p instance System.TmpProc.Docker.HasNamedHandle name a procs => System.TmpProc.Docker.IxReset name procs instance System.TmpProc.Docker.HasNamedHandle name a procs => System.TmpProc.Docker.IxPing name procs instance System.TmpProc.Docker.HasNamedHandle name a procs => System.TmpProc.Docker.IxUriOf name procs instance System.TmpProc.Docker.AreProcs '[] instance (System.TmpProc.Docker.ProcPlus a prepared, System.TmpProc.Docker.AreProcs as, System.TmpProc.TypeLevel.IsAbsent a as) => System.TmpProc.Docker.AreProcs (a : as) instance (a GHC.Types.~ a', System.TmpProc.Docker.Proc a) => System.TmpProc.Docker.Preparer a a' instance (a GHC.Types.~ a', System.TmpProc.Docker.Proc a) => System.TmpProc.Docker.ToRunCmd a a' -- | Provides functions that make it easy to run Applications -- that access services running as tmp procs in -- integration tests. module System.TmpProc.Warp -- | Set up some ProcHandles then run an Application that -- uses them on a free port. -- -- Allows the app to configure itself using the tmp procs, then -- provides a callback with access to the handles. -- -- The tmp procs are shut down when the application is shut -- down. testWithApplication :: AreProcs procs => HList procs -> (HandlesOf procs -> IO Application) -> ((HandlesOf procs, Port) -> IO a) -> IO a -- | Set up some ProcHandles then run an Application that -- uses them on a free port. -- -- Allows the app to configure itself using the tmp procs, then -- provides a callback with access to the handles. -- -- Also runs a ready action that to determine if the application -- started correctly. -- -- The tmp procs are shut down when the application is shut -- down. testWithReadyApplication :: AreProcs procs => (Port -> IO ()) -> HList procs -> (HandlesOf procs -> IO Application) -> ((HandlesOf procs, Port) -> IO a) -> IO a -- | Like testWithApplication, but the port is secured using a -- 'Warp.TLSSettings. ' testWithTLSApplication :: AreProcs procs => TLSSettings -> HList procs -> (HandlesOf procs -> IO Application) -> ((HandlesOf procs, Port) -> IO a) -> IO a -- | Like testWithReadyApplication; the port is secured with -- TLSSettings. testWithReadyTLSApplication :: AreProcs procs => TLSSettings -> (Port -> IO ()) -> HList procs -> (HandlesOf procs -> IO Application) -> ((HandlesOf procs, Port) -> IO a) -> IO a -- | Represents a started Warp application and any AreProcs -- dependencies. data ServerHandle procs -- | The Port on which the ServerHandles server is running. serverPort :: ServerHandle procs -> Port -- | The ServerHandles ProcHandles. handles :: AreProcs procs => ServerHandle procs -> HandlesOf procs -- | Shuts down the ServerHandle server and its tmp proc -- dependencies. shutdown :: AreProcs procs => ServerHandle procs -> IO () -- | Runs an Application with ProcHandle dependencies on a -- free port. runServer :: AreProcs procs => HList procs -> (HandlesOf procs -> IO Application) -> IO (ServerHandle procs) -- | Like runServer; with an additional ready that -- determines if the server is ready.'. runReadyServer :: AreProcs procs => (Port -> IO ()) -> HList procs -> (HandlesOf procs -> IO Application) -> IO (ServerHandle procs) -- | Like runServer; the port is secured with TLSSettings. runTLSServer :: AreProcs procs => TLSSettings -> HList procs -> (HandlesOf procs -> IO Application) -> IO (ServerHandle procs) -- | Like runReadyServer; the port is secured with -- TLSSettings. runReadyTLSServer :: AreProcs procs => TLSSettings -> (Port -> IO ()) -> HList procs -> (HandlesOf procs -> IO Application) -> IO (ServerHandle procs) -- | Simplifies writing the health checks used by ready variants -- of this module. checkHealth :: Int -> IO (Either a b) -> IO () -- | Exports all tmp-proc behaviour. -- -- tmp-proc is a package that aims to simplify writing -- integration tests that use dockerizable services. -- -- The package has the following structure: -- --