typed-session-state-algorithm 0.2.0.0 → 0.3.0.0
raw patch · 5 files changed
+31/−36 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- TypedSession.State.Pipeline: piple :: (Enum r, Bounded r, Eq r, Ord r) => Protocol Creat r bst -> Either (ProtocolError r bst) (PipleResult r bst)
- TypedSession.State.Pipeline: piple' :: forall r bst (sig :: (Type -> Type) -> Type -> Type) m. (Has (Error (ProtocolError r bst)) sig m, Enum r, Bounded r, Eq r, Ord r) => (Tracer r bst -> m ()) -> Protocol Creat r bst -> m (PipleResult r bst)
- TypedSession.State.Pipeline: pipleWithTracer :: (Enum r, Bounded r, Eq r, Ord r) => Protocol Creat r bst -> (Seq (Tracer r bst), Either (ProtocolError r bst) (PipleResult r bst))
- TypedSession.State.Render: instance (GHC.Internal.Show.Show r, GHC.Internal.Show.Show bst, GHC.Internal.Enum.Enum r, GHC.Internal.Enum.Bounded r, GHC.Classes.Eq r, GHC.Classes.Ord r) => GHC.Internal.Show.Show (TypedSession.State.Type.Tracer r bst)
- TypedSession.State.Render: traceWrapper :: String -> String -> String
+ TypedSession.State.Pipeline: pipe :: (Enum r, Bounded r, Eq r, Ord r) => Protocol Creat r bst -> Either (ProtocolError r bst) (PipleResult r bst)
+ TypedSession.State.Pipeline: pipe' :: forall r bst (sig :: (Type -> Type) -> Type -> Type) m. (Has (Error (ProtocolError r bst)) sig m, Enum r, Bounded r, Eq r, Ord r) => (Tracer r bst -> m ()) -> Protocol Creat r bst -> m (PipleResult r bst)
+ TypedSession.State.Pipeline: pipeWithTracer :: (Enum r, Bounded r, Eq r, Ord r) => Protocol Creat r bst -> (Seq (Tracer r bst), Either (ProtocolError r bst) (PipleResult r bst))
+ TypedSession.State.Type: instance (GHC.Internal.Show.Show r, GHC.Internal.Show.Show bst) => GHC.Internal.Show.Show (TypedSession.State.Type.Tracer r bst)
+ TypedSession.State.Type: traceWrapper :: String -> String -> String
Files
- src/TypedSession/State/Pipeline.hs +8/−8
- src/TypedSession/State/Render.hs +0/−24
- src/TypedSession/State/Type.hs +19/−0
- test/Main.hs +3/−3
- typed-session-state-algorithm.cabal +1/−1
src/TypedSession/State/Pipeline.hs view
@@ -319,7 +319,7 @@ restList = [i | i <- [0 .. maxSize], i `Set.notMember` allSet] in IntMap.fromList $ zip (Set.toList allSet ++ restList) [0 ..] -piple'+pipe' :: forall r bst sig m . ( Has (Error (ProtocolError r bst)) sig m , Enum r@@ -330,7 +330,7 @@ => (Tracer r bst -> m ()) -> Protocol Creat r bst -> m (PipleResult r bst)-piple' trace prot0 = do+pipe' trace prot0 = do trace (TracerProtocolCreat prot0) (brSet, (maxSzie, (_, idxProt))) <- runState @(Set Int) Set.empty@@ -373,17 +373,17 @@ trace (TracerProtocolMsgT1 prot5) pure (PipleResult prot4 prot5 dnys stBound) -piple+pipe :: forall r bst . (Enum r, Bounded r, Eq r, Ord r) => Protocol Creat r bst -> Either (ProtocolError r bst) (PipleResult r bst)-piple protocol =- run $ runError @(ProtocolError r bst) $ (piple' (const (pure ())) protocol)+pipe protocol =+ run $ runError @(ProtocolError r bst) $ (pipe' (const (pure ())) protocol) -pipleWithTracer+pipeWithTracer :: forall r bst . (Enum r, Bounded r, Eq r, Ord r) => Protocol Creat r bst@@ -392,11 +392,11 @@ (ProtocolError r bst) (PipleResult r bst) )-pipleWithTracer protocol =+pipeWithTracer protocol = run . runWriter @(Seq (Tracer r bst)) . runError @(ProtocolError r bst)- $ (piple' (\w -> tell @(Seq (Tracer r bst)) (Seq.singleton w)) protocol)+ $ (pipe' (\w -> tell @(Seq (Tracer r bst)) (Seq.singleton w)) protocol) genDocXFold :: forall r bst ann sig m
src/TypedSession/State/Render.hs view
@@ -136,15 +136,6 @@ tell [header] (xfold (renderXFold sfe xst) prot) --traceWrapper :: String -> String -> String-traceWrapper desc st =- "--------------------"- ++ desc- ++ "-----------------\n"- ++ st- ++ "\n"- foo :: (Ord a) => a -> a -> [Char] -> a -> [Char] foo from to str i = if@@ -185,18 +176,3 @@ parensWarapper :: String -> String parensWarapper st = "{" <> st <> "}"--instance (Show r, Show bst, Enum r, Bounded r, Eq r, Ord r) => Show (Tracer r bst) where- show = \case- TracerProtocolCreat p -> traceWrapper "Creat" $ show p- TracerProtocolIdx p -> traceWrapper "Idx" $ show p- TracerReRank p -> traceWrapper "ReRank" $ show p- TracerProtocolAddNum p -> traceWrapper "AddNum" $ show p- TracerProtocolGenConst p -> traceWrapper "GenConst" $ show p- TracerConstraints p -> traceWrapper "Constrains" $ show p- TracerSubMap p -> traceWrapper "SubMap" $ show p- TracerProtocolGenConstN p -> traceWrapper "GenConstN" $ show p- TracerVerifyResult m -> traceWrapper "VerifyResult Map" $ show m- TracerCollectBranchDynVal dvs -> traceWrapper "CollectBranchDynVal" $ show dvs- TracerProtocolMsgT p -> traceWrapper "MsgT" $ show p- TracerProtocolMsgT1 p -> traceWrapper "MsgT1" $ show p
src/TypedSession/State/Type.hs view
@@ -172,6 +172,25 @@ | TracerProtocolMsgT (Protocol (MsgT r bst) r bst) | TracerProtocolMsgT1 (Protocol (MsgT1 r bst) r bst) +traceWrapper :: String -> String -> String+traceWrapper desc st =+ "--------------------" ++ desc ++ "-----------------\n" ++ st ++ "\n"++instance (Show r, Show bst) => Show (Tracer r bst) where+ show = \case+ TracerProtocolCreat p -> traceWrapper "Creat" $ show p+ TracerProtocolIdx p -> traceWrapper "Idx" $ show p+ TracerReRank p -> traceWrapper "ReRank" $ show p+ TracerProtocolAddNum p -> traceWrapper "AddNum" $ show p+ TracerProtocolGenConst p -> traceWrapper "GenConst" $ show p+ TracerConstraints p -> traceWrapper "Constrains" $ show p+ TracerSubMap p -> traceWrapper "SubMap" $ show p+ TracerProtocolGenConstN p -> traceWrapper "GenConstN" $ show p+ TracerVerifyResult m -> traceWrapper "VerifyResult Map" $ show m+ TracerCollectBranchDynVal dvs -> traceWrapper "CollectBranchDynVal" $ show dvs+ TracerProtocolMsgT p -> traceWrapper "MsgT" $ show p+ TracerProtocolMsgT1 p -> traceWrapper "MsgT1" $ show p+ ------------------------ data Creat
test/Main.hs view
@@ -6,7 +6,7 @@ import Text.RawString.QQ (r) import TypedSession.State.Parser (runProtocolParser)-import TypedSession.State.Pipeline (genGraph, pipleWithTracer)+import TypedSession.State.Pipeline (genGraph, pipeWithTracer) import TypedSession.State.Render (StrFillEnv (StrFillEnv)) main :: IO ()@@ -38,7 +38,7 @@ r1 = case runProtocolParser @PingPongRole @PingPongBranchSt s1 of Left e -> e Right a ->- let (lq, res) = pipleWithTracer a+ let (lq, res) = pipeWithTracer a in case res of Left e -> show e Right ppResult -> show lq <> "\n" <> genGraph (StrFillEnv 20 20) ppResult@@ -228,7 +228,7 @@ r2 = case runProtocolParser @Role @BookBranchSt s2 of Left e -> e Right a ->- let (seqList, res) = pipleWithTracer a+ let (seqList, res) = pipeWithTracer a in case res of Left e -> show e Right ppResult ->
typed-session-state-algorithm.cabal view
@@ -20,7 +20,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.2.0.0+version: 0.3.0.0 -- A short (one-line) description of the package. synopsis: Automatically generate status for typed-session.