-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Automatically generate status for typed-session. -- -- Consider the communication process as a state machine, and this lib -- will generate the required states. @package typed-session-state-algorithm @version 0.2.0.0 module TypedSession.State.Constraint -- | Constraint 1 ~ 2 = Constraint 1 2 2 ~ 3 = Constraint 2 3 data Constraint Constraint :: Int -> Int -> Constraint type SubMap = IntMap Int toTuple :: Constraint -> (Int, Int) -- | bigSwapConstr >>> bigSwapConstr (Constraint 1 2) Constraint 2 -- 1 bigSwapConstr :: Constraint -> Constraint subFun :: [Constraint] -> [Constraint] replace :: Int -> Int -> [Constraint] -> [Constraint] -- | findNewConstraint >>> findNewConstraint [Constraint 3 1, -- Constraint 4 2, Constraint 4 3] [[Constraint 3 2]] findNewConstraint :: [Constraint] -> [[Constraint]] -- | stepConstraint >>> stepConstraint [Constraint 3 1, Constraint -- 4 2, Constraint 4 3] [Constraint 3 1,Constraint 4 2,Constraint 4 1] stepConstraint :: [Constraint] -> [Constraint] -- | constraintLoop >>> constraintLoop [Constraint 3 1, Constraint -- 4 2, Constraint 4 3] [Constraint 2 1,Constraint 3 1,Constraint 4 1] -- --
-- >>> stepConstraint [Constraint 3 1, Constraint 4 2, Constraint 4 3] -- [Constraint 3 1,Constraint 4 2,Constraint 4 1] ---- --
-- >>> findNewConstraint [Constraint 3 1,Constraint 4 2,Constraint 4 1] -- [[Constraint 2 1]] ---- --
-- >>> stepConstraint ([Constraint 3 1,Constraint 4 2,Constraint 4 1] <> [Constraint 2 1]) -- [Constraint 2 1,Constraint 3 1,Constraint 4 1] --constraintLoop :: [Constraint] -> [Constraint] -- | constrToSubMap >>> constrToSubMap [Constraint 3 1, Constraint -- 4 2, Constraint 4 3] fromList [(2,1),(3,1),(4,1)] constrToSubMap :: [Constraint] -> SubMap instance GHC.Classes.Eq TypedSession.State.Constraint.Constraint instance GHC.Classes.Ord TypedSession.State.Constraint.Constraint instance GHC.Internal.Show.Show TypedSession.State.Constraint.Constraint module TypedSession.State.Type type family XMsg eta type family XLabel eta type family XBranch eta type family XBranchSt eta type family XGoto eta type family XTerminal eta -- | ForallX type ForallX (f :: Type -> Constraint) eta = (f XMsg eta, f XLabel eta, f XBranch eta, f XBranchSt eta, f XGoto eta, f XTerminal eta) -- | BranchSt data BranchSt eta r bst BranchSt :: XBranchSt eta -> bst -> Protocol eta r bst -> BranchSt eta r bst -- | MsgOrLabel data MsgOrLabel eta r Msg :: XMsg eta -> String -> [String] -> r -> r -> MsgOrLabel eta r Label :: XLabel eta -> Int -> MsgOrLabel eta r -- | Protocol data Protocol eta r bst (:>) :: MsgOrLabel eta r -> Protocol eta r bst -> Protocol eta r bst Branch :: XBranch eta -> r -> [BranchSt eta r bst] -> Protocol eta r bst Goto :: XGoto eta -> Int -> Protocol eta r bst Terminal :: XTerminal eta -> Protocol eta r bst infixr 5 :> -- | XTraverse type XTraverse (m :: Type -> Type) eta gama r bst = ((XMsg eta, (String, [String], r, r, Protocol eta r bst)) -> m XMsg gama, (XLabel eta, (Int, Protocol eta r bst)) -> m XLabel gama, (XBranch eta, (r, [BranchSt eta r bst])) -> m (XBranch gama, m Protocol gama r bst -> m Protocol gama r bst), (XBranchSt eta, (bst, Protocol eta r bst)) -> m XBranchSt gama, (XGoto eta, Int) -> m XGoto gama, XTerminal eta -> m XTerminal gama) -- | xtraverse xtraverse :: Monad m => XTraverse m eta gama r bst -> Protocol eta r bst -> m (Protocol gama r bst) -- | XFold type XFold (m :: Type -> Type) eta r bst = ((XMsg eta, (String, [String], r, r, Protocol eta r bst)) -> m (), (XLabel eta, Int) -> m (), (XBranch eta, (r, [BranchSt eta r bst])) -> m m () -> m (), (XBranchSt eta, (bst, Protocol eta r bst)) -> m (), (XGoto eta, Int) -> m (), XTerminal eta -> m ()) -- | xfold xfold :: Monad m => XFold m eta r bst -> Protocol eta r bst -> m () -- | ProtocolError data ProtocolError r bst DefLabelMultTimes :: Int -> ProtocolError r bst LabelUndefined :: Int -> ProtocolError r bst BranchFirstMsgMustHaveTheSameSender :: r -> String -> r -> ProtocolError r bst UndecideStateCanNotSendMsg :: String -> ProtocolError r bst UndecideStateCanNotStartBranch :: [BranchSt (GenConst r) r bst] -> ProtocolError r bst TerminalNeedAllRoleDecide :: String -> ProtocolError r bst BranchAtLeastOneBranch :: ProtocolError r bst AStateOnlyBeUsedForTheSamePair :: ProtocolError r bst internalError :: String data Tracer r bst TracerProtocolCreat :: Protocol Creat r bst -> Tracer r bst TracerProtocolIdx :: Protocol Idx r bst -> Tracer r bst TracerReRank :: IntMap Int -> Tracer r bst TracerProtocolAddNum :: Protocol AddNums r bst -> Tracer r bst TracerProtocolGenConst :: Protocol (GenConst r) r bst -> Tracer r bst TracerConstraints :: Seq Constraint -> Tracer r bst TracerSubMap :: SubMap -> Tracer r bst TracerProtocolGenConstN :: Protocol (GenConst r) r bst -> Tracer r bst TracerVerifyResult :: IntMap (r, r) -> Tracer r bst TracerCollectBranchDynVal :: Set Int -> Tracer r bst TracerProtocolMsgT :: Protocol (MsgT r bst) r bst -> Tracer r bst TracerProtocolMsgT1 :: Protocol (MsgT1 r bst) r bst -> Tracer r bst data Creat data Idx data AddNums data GenConst r data T bst TNum :: Int -> T bst BstList :: Int -> bst -> T bst TAny :: Int -> T bst TEnd :: T bst data MsgT r bst data MsgT1 r bst instance GHC.Internal.Base.Functor (TypedSession.State.Type.BranchSt eta r) instance GHC.Internal.Base.Functor (TypedSession.State.Type.MsgOrLabel eta) instance GHC.Internal.Base.Functor (TypedSession.State.Type.Protocol eta r) instance (Prettyprinter.Internal.Pretty (TypedSession.State.Type.Protocol eta r bst), GHC.Internal.Show.Show (TypedSession.State.Type.XBranchSt eta), GHC.Internal.Show.Show bst) => Prettyprinter.Internal.Pretty (TypedSession.State.Type.BranchSt eta r bst) instance (GHC.Internal.Show.Show (TypedSession.State.Type.XMsg eta), GHC.Internal.Show.Show (TypedSession.State.Type.XLabel eta), GHC.Internal.Show.Show r) => Prettyprinter.Internal.Pretty (TypedSession.State.Type.MsgOrLabel eta r) instance (TypedSession.State.Type.ForallX GHC.Internal.Show.Show eta, GHC.Internal.Show.Show r, GHC.Internal.Show.Show bst) => Prettyprinter.Internal.Pretty (TypedSession.State.Type.Protocol eta r bst) instance (Prettyprinter.Internal.Pretty (TypedSession.State.Type.Protocol eta r bst), GHC.Internal.Show.Show (TypedSession.State.Type.XBranchSt eta), GHC.Internal.Show.Show bst) => GHC.Internal.Show.Show (TypedSession.State.Type.BranchSt eta r bst) instance (GHC.Internal.Show.Show (TypedSession.State.Type.XMsg eta), GHC.Internal.Show.Show (TypedSession.State.Type.XLabel eta), GHC.Internal.Show.Show r) => GHC.Internal.Show.Show (TypedSession.State.Type.MsgOrLabel eta r) instance (TypedSession.State.Type.ForallX GHC.Internal.Show.Show eta, GHC.Internal.Show.Show r, GHC.Internal.Show.Show bst) => GHC.Internal.Show.Show (TypedSession.State.Type.Protocol eta r bst) instance (GHC.Internal.Show.Show r, GHC.Internal.Show.Show bst) => GHC.Internal.Show.Show (TypedSession.State.Type.ProtocolError r bst) instance GHC.Internal.Show.Show bst => GHC.Internal.Show.Show (TypedSession.State.Type.T bst) module TypedSession.State.Parser data ParserError EmptyInput :: ParserError TheFirstLetterNotCapitalized :: ParserError type Parser = Parsec ParserError String spaceConsumer :: Parser () symbol :: String -> Parser String lexeme :: Parser a -> Parser a msg :: Parser String label :: Parser String branch :: Parser String branchSt :: Parser String goto :: Parser String terminal :: Parser String integer :: Parser Integer comma :: Parser String brackets :: Parser a -> Parser a braces :: Parser a -> Parser a dbg :: String -> m a -> m a constrOrType :: Parser String mkParserA :: (Enum a, Bounded a, Show a) => Parser a parseMsg :: (Enum r, Bounded r, Show r) => Parser (MsgOrLabel Creat r) parseLabel :: Show r => Parser (MsgOrLabel Creat r) parseGoto :: (Show bst, Show r) => Parser (Protocol Creat r bst) parseTerminal :: (Show bst, Show r) => Parser (Protocol Creat r bst) parseBranchSt :: (Enum bst, Bounded bst, Show bst, Enum r, Bounded r, Show r) => Parser (BranchSt Creat r bst) parseBranch :: (Enum r, Bounded r, Show r, Enum bst, Bounded bst, Show bst) => Parser (Protocol Creat r bst) parseMsgOrLabel :: (Enum r, Bounded r, Show r, Enum bst, Bounded bst, Show bst) => Parser (Protocol Creat r bst) parseProtocol :: (Enum r, Bounded r, Show r, Enum bst, Bounded bst, Show bst) => Parser (Protocol Creat r bst) runProtocolParser :: (Enum r, Enum bst, Bounded r, Bounded bst, Show r, Show bst) => String -> Either String (Protocol Creat r bst) instance GHC.Classes.Eq TypedSession.State.Parser.ParserError instance GHC.Classes.Ord TypedSession.State.Parser.ParserError instance Text.Megaparsec.Error.ShowErrorComponent TypedSession.State.Parser.ParserError instance GHC.Internal.Show.Show TypedSession.State.Parser.ParserError module TypedSession.State.Utils restoreWrapper :: forall s (sig :: (Type -> Type) -> Type -> Type) m a. Has (State s) sig m => m a -> m a getFirstMsgInfo :: Protocol eta r bst -> Maybe (r, r) getAllMsgInfo :: Protocol eta r bst -> [(r, r)] tellSeq :: forall a (sig :: (Type -> Type) -> Type -> Type) m. Has (Writer (Seq a)) sig m => [a] -> m () compressSubMap :: SubMap -> (SubMap, (Int, Int)) replaceList :: SubMap -> [Int] -> [Int] replaceVal :: IntMap Int -> Int -> Int module TypedSession.State.Render data StringFill CenterFill :: Int -> Char -> String -> StringFill LeftAlign :: Int -> Char -> String -> StringFill runCenterFill :: String -> StringFill -> String getPoint :: StringFill -> Int runCenterFills :: [StringFill] -> String data StrFillEnv StrFillEnv :: Int -> Int -> StrFillEnv [width] :: StrFillEnv -> Int [leftWidth] :: StrFillEnv -> Int defaultStrFilEnv :: StrFillEnv reSt :: StrFillEnv -> String -> String type XStringFill eta r bst = (XMsg eta -> ([StringFill], Bool), XLabel eta -> [StringFill], XBranch eta -> [StringFill], XBranchSt eta -> [StringFill], XGoto eta -> [StringFill], XTerminal eta -> [StringFill]) renderXFold :: forall r eta bst (sig :: (Type -> Type) -> Type -> Type) m. (Has (Writer [[StringFill]] :+: State Int) sig m, ForallX Show eta, Enum r, Bounded r, Show r, Show bst) => StrFillEnv -> XStringFill eta r bst -> XFold m eta r bst runRender :: forall r eta bst. (ForallX Show eta, Show bst, Enum r, Bounded r, Show r) => StrFillEnv -> XStringFill eta r bst -> Protocol eta r bst -> String traceWrapper :: String -> String -> String foo :: Ord a => a -> a -> [Char] -> a -> [Char] rtops :: Enum r => StrFillEnv -> r -> Int rRange :: (Enum r, Bounded r) => [r] too :: forall r a. (Show a, Enum r, Bounded r) => StrFillEnv -> [a] -> [StringFill] stMsgT :: forall r bst. (Show bst, Ord r, Enum r, Bounded r) => StrFillEnv -> XStringFill (MsgT r bst) r bst parensWarapper :: String -> String instance GHC.Internal.Show.Show TypedSession.State.Render.StrFillEnv instance GHC.Internal.Show.Show TypedSession.State.Render.StringFill 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) module TypedSession.State.Pipeline newtype Index Index :: Int -> Index addIdxXTraverse :: forall r bst (sig :: (Type -> Type) -> Type -> Type) m. (Has (State Int :+: (State Index :+: (State (Set Int) :+: Error (ProtocolError r bst)))) sig m, Enum r, Bounded r, Ord r) => XTraverse m Creat Idx r bst reRankXTraverse :: Monad m => IntMap Int -> XTraverse m Idx Idx r bst addNumsXTraverse :: forall r bst (sig :: (Type -> Type) -> Type -> Type) m. (Has (Error (ProtocolError r bst)) sig m, Enum r, Bounded r, Ord r) => XTraverse m Idx AddNums r bst toGenConstrXTraverse :: Monad m => XTraverse m AddNums (GenConst r) r bst data CurrSt Decide :: CurrSt Undecide :: CurrSt getRCurrSt :: forall r (sig :: (Type -> Type) -> Type -> Type) m. (Has (State (Map r CurrSt)) sig m, Ord r) => r -> m CurrSt restoreWrapper1 :: forall r (sig :: (Type -> Type) -> Type -> Type) m a. Has (State (Map r CurrSt) :+: State r) sig m => m a -> m a checkProtXFold :: forall r bst (sig :: (Type -> Type) -> Type -> Type) m. (Has (State (Map r CurrSt) :+: (State r :+: Error (ProtocolError r bst))) sig m, Eq r, Ord r, Enum r, Bounded r) => XFold m (GenConst r) r bst genConstrXFold :: forall r bst (sig :: (Type -> Type) -> Type -> Type) m. (Has (State (IntMap [Int]) :+: (State [Int] :+: (Writer (Seq Constraint) :+: Error (ProtocolError r bst)))) sig m, Enum r) => XFold m (GenConst r) r bst replXTraverse :: Monad m => SubMap -> XTraverse m (GenConst r) (GenConst r) r bst verifyProtXFold :: forall r bst (sig :: (Type -> Type) -> Type -> Type) m. (Has (State (IntMap (r, r)) :+: Error (ProtocolError r bst)) sig m, Enum r, Eq r) => XFold m (GenConst r) r bst collectBranchDynValXFold :: forall (sig :: (Type -> Type) -> Type -> Type) m r bst. (Has (State (Set Int)) sig m, Enum r) => XFold m (GenConst r) r bst genT :: forall bst (sig :: (Type -> Type) -> Type -> Type) m. Has (Reader (Set Int) :+: State bst) sig m => (bst -> Int -> T bst) -> Int -> m (T bst) genMsgTXTraverse :: forall r bst (sig :: (Type -> Type) -> Type -> Type) m. (Has (Reader (Set Int) :+: State bst) sig m, Enum r, Eq r, Bounded r) => XTraverse m (GenConst r) (MsgT r bst) r bst getFirstXV :: Protocol (MsgT r bst) r bst -> [T bst] genMsgT1XTraverse :: (Monad m, Enum r) => XTraverse m (MsgT r bst) (MsgT1 r bst) r bst data PipleResult r bst PipleResult :: Protocol (MsgT r bst) r bst -> Protocol (MsgT1 r bst) r bst -> Set Int -> (Int, Int) -> PipleResult r bst [msgT] :: PipleResult r bst -> Protocol (MsgT r bst) r bst [msgT1] :: PipleResult r bst -> Protocol (MsgT1 r bst) r bst [dnySet] :: PipleResult r bst -> Set Int [stBound] :: PipleResult r bst -> (Int, Int) reRank :: Set Int -> Int -> IntMap Int 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) piple :: (Enum r, Bounded r, Eq r, Ord r) => Protocol Creat r bst -> Either (ProtocolError r bst) (PipleResult r bst) pipleWithTracer :: (Enum r, Bounded r, Eq r, Ord r) => Protocol Creat r bst -> (Seq (Tracer r bst), Either (ProtocolError r bst) (PipleResult r bst)) genDocXFold :: forall r bst ann (sig :: (Type -> Type) -> Type -> Type) m. (Has (Writer [Doc ann]) sig m, Show r, Show bst) => String -> String -> XFold m (MsgT1 r bst) r bst genDoc :: (Show r, Show bst) => String -> String -> Protocol (MsgT1 r bst) r bst -> [Doc ann] genGraph :: (Enum r, Bounded r, Show bst, Ord r, Show r) => StrFillEnv -> PipleResult r bst -> String instance GHC.Classes.Eq TypedSession.State.Pipeline.CurrSt instance GHC.Classes.Eq TypedSession.State.Pipeline.Index instance GHC.Internal.Num.Num TypedSession.State.Pipeline.Index instance GHC.Classes.Ord TypedSession.State.Pipeline.CurrSt instance GHC.Classes.Ord TypedSession.State.Pipeline.Index instance GHC.Internal.Show.Show TypedSession.State.Pipeline.CurrSt instance GHC.Internal.Show.Show TypedSession.State.Pipeline.Index