vLmGp      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmno  The reversed version of . p ss n t ss' denotes that ss' is same as ss except that its n-th element is t.  Formally,  ss n t ss' if ss' = update ss n t where update is:   1 update ss n t = updateR ss (len ss - (n+1)) t - where updateR (ss:>_) Z t = ss :> t 9 updateR (ss:>s) (S n) t = updateR ss n t :> s  len Nil = 0 & len (ss:>s) = (len ss) + 1 In other words, 8 (End :> Bot :> Send Int End) Z End (End :> Bot :> End)) is an instance of Update. @Note that the list counts from left to right, as in the case of Pickup. qThe reversed version of E which accesses lists in reversed order (counts from right to left).  I.e., . (End :> Bot :> Send Int End) Z (Send Int End) is an instance of . r ss n s denotes that the n-th element of the list ss is s. F This type class plays an important role in session-type inference.  Formally,  ss n s if s = pickup ss n where pickup is:   - pickup ss n = pickupR ss (len ss - (n+1)) % where pickupR (ss:>s) Z = s 0 pickupR (ss:>s) (S n) = pickupR ss n  len Nil = 0 & len (ss:>s) = (len ss) + 1 In other words, *Pickup (End :> Bot :> Send Int End) Z End) is an instance of Pickup. /Note that the list counts from left to right.  For example, The 0-th element of the list (End :> Bot) :> Send Int End is End. 2Usually the list is accessed from the right end.  The context     ss (S n),  (ss:>Bot:>Recv Char End) n s is expanded into     ss (S n),  (ss:>Bot:>Recv Char End) ( (S n) (S n)) s,  (S n) (S n) since  ( n) ( n) ~ Z, it will be reduced to     (ss:>Bot:>Recv Char End) Z s  and then s is unified with  Recv Char End. stThe class which covers session-type environments. The second parameter of the class denotes the length of the list. tType-level empty list ([]). u*Type-level snoc (reversed version of cons (:)). ss :> s denotes a list ss with s on its end. (FIXME:English) vComputes subtraction of n by n' Computes subtraction of n by n' (FIXME:OK?) wx )Equality on type-level natural numbers. b ~   if x == y . Otherwise b ~ F.  type-level y  Type level False. z  Type level True. { 3The class which covers type-level natural numbers. |0Type level predecessor (only for internal use).  n denotes (n-1). }Type level successor.  n denotes (n+1). ~Type level zero.  pqrstuvwx z { |}~ ppqqrrssttuuvvwxwx zz {{ ||}}~~ (The channel type. The type-level number nK points to the session-type in type environments. For example, in the type  +Session t (Nil:>Send Int End) (Nil:>End) (),  the usage of the channel c :: Channel t Z is  Send Int End in pretype and End in posttype. 7 denotes a session that can do nothing but closing it. Recursion variable.  m r" denotes recursive session, where m/ represents the binder of recursion variable. " a type-level natural numer (like  ). nesting level of , and  r0 is the body of the recursion which may contain  m. O denotes a terminated session. Further communication along a channel with type  cannot take place.  is the type for a channel whose both endpoints are already engaged by two processes, so that no further processes can own that channel.  For example, in forkIO (send k e) >>> recv k, k has type .  u1 u2 denotes a behavior like either u1 or u2" according to the incoming label.  u1 u2' denotes to be either behavior of type u1 or type u2& after emitting a corresponding label 1 or 2.  Use of sel1 or sel2, on a channel changes its session type from  u1 u2 into u1 or u2, respectively.   u1 u2- is the input of a channel with session type u1 followed by a behavior of type u2.  Use of recvS, on a channel changes its session type from   u1 u2 into u2. !! u1 u2= denotes a behavior to output of a channel with session type u1 followed by a behavior of type u2.  Use of sendS, on a channel changes its session type from ! u1 u2 into u2. "" v u1 denotes a protocol of receiving a value of type v followed by a behavior of type u.  Use of recv, on a channel changes its session type from " v u into u. ## v u, denotes a protocol to emit a value of type v followed by a behavior of type u.  Use of send, on a channel changes its session type from # v u into u.  !"#  !"#$sesion type algebra %duality $%$%&'()*+,-- ss b denotes that b ~ T if ss is Ended, otherwise b ~ F. In other words, b ~ T# if the all elements of ss are End .. n ss+ denotes that the session-type environment ss (the length of it is n?) is Ended. The all elements in an Ended type environments are . &'()*+,-.&'()*+,-./01234/01234/01234 5The Session monad. ss and tt denotes the usage of channels.  ss denotes pre-type5, which denotes the type-level list of session types required to run the session.  tt denotes  post-type6, which denotes the type-level lists of session types produced by the session. t denotes a type-tag;, which prevents abuse of use of channels. For detail, see 9. 6 Bind (a.k.a >>=) operation for 5 monad. 78 Unit (a.k.a return) operation for 5 monad. 99 runs the 5. The pretype (see 5 ) must be .  The posttype must be ., i.e. all channels must be . Forall'd type variable t9 prevents abuse of use of channels inside different run.  For example,  new >>>= c -> io_ (runS ( ... send c ...) )3 is rejected by the Haskell typechecker with error /Inferred type is less polymorphic than expected. :;<= 56789:;<= 56789:;<= >?the specialized case for  ss -- FIXME @pointwise extension of $ -- FIXME: method ABCDEFoutput a label `1' Goutput a label `2' HIJKstart a new thread LMNOPQRSTUVWX>?@ABCDEFGHIJKLMNOPQRSTUVWX>?@ABCDEFGHIJKLMNOPQRSTUVWX YZ[\]^_`abcdefghijkoutput a label `1' lmnoYZ[\]^_`abcdefghijklmnoYZ[\]^_`a`abcdefghijklmno p  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnop #"! 56789>ABCDEFGHINTUVWXeghklmnijdf_`aJKLMoOPQRS:;<=  .-,%$@?+*)('&cb^]\[ZY43210/   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z {|}~#$%&'()*+,-./A J n o full-sessions-0.6.2Control.Concurrent.FullSessionFullSession.BaseFullSession.TypeEqFullSession.TypesFullSession.TypeAlgebraFullSession.EndedFullSession.RecursionFullSession.SMonadFullSession.FullSessionFullSession.NwSessionFullSession.IncoherentUpdateRUpdatePickupRPickupSListNil:>SubTSubEqNatAndFTNatPSZTypeEq''TypeEq'TypeEqDiff'DiffChannelOfferNSelectNCloseVarRecEndBotOfferSelectCatchThrowRecvSendCompDual AppendEnd' AppendEndEndedWithout2' EndedWithout2 EndedWithout' EndedWithout IsEndedSTIsEndedEnded RecUnfoldCont RecUnfold RecFoldCont2RecFold2 RecFoldContRecFoldSession>>>=>>>ireturnrunS channeltype1 channeltype2 typecheck1 typecheck2ServicePar'ParclosesendrecvsendSrecvSsel1sel2ifSelectofferforkIOsforkOSsioio_newunwind0unwind1unwind2recur1recur2 newServiceconnect connectRunSaccept acceptRunS NwReceiveOnly NwSendOnlyNwDual NwSession NwReceiverNwSenderMessage parseMessage showMessage NwService2 NwService mkNwService connectNw mkNwService2 connectNw2 acceptOneNw2dualNwdualNw2sel1Nsel2N ifSelectNofferNfinallysupdateRupdatepickupRpickuplen_subsub_base GHC.Classes&&nattype'eqdiff'diffCdecompdual appendEnd' deleteEnd' appendEnd deleteEndended unfoldContunfold' fold2'contfold2' fold'contfold'unfoldunfold0unfold1unfold2sessioninspect1split'splitunwind genSessiontryParse errorExitfinish connectTolistenAt