úÎósæàŸ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmno p q r s t u v w x y z { | } ~  € ‚ ƒ „ … † ‡ ˆ ‰ Š ‹ Œ Ž ‘ ’ “ ” • – — ˜ ™š›œž&(C) 2012 Edward Kmett, Rúnar Bjarnason BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalRank-N Types, MPTCsSafe357IN A  k o a is a specification for a pure Machine , that reads inputs selected by k with types based on i, writes values of type o', and has intermediate results of type a.A  k o a can be used as a  k o m a for any Ÿ m.!It is perhaps easier to think of / in its un-cps'ed form, which would look like: data m k o a = Done a | Yield o (Plan k o a) | forall z. Await (z -> Plan k o a) (k z) (Plan k o a) | Fail You can  construct a  (or ), turning it into a  (or ).Deconstruct a  without reference to a Ÿ.Output a result.8Like yield, except stops if there is no value to yield. Wait for input.  =   Wait for a particular input. awaits L ::  (T a b) o a awaits R ::  (T a b) o b awaits   ::  ( i) o i   = ¡ ORun a monadic action repeatedly yielding its results, until it returns Nothing. ¢£¤¥¦§¨©ª«¬     ¢£¤¥¦§¨©ª«¬(C) 2012 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional rank-2, GADTsSafe!"35IN DAn input type that supports merging requests from multiple machines. A  E reads from a number of inputs and may yield results before stopping.A   can be used as a  m for any Ÿ m.A ` reads from a number of inputs and may yield results before stopping with monadic side-effects.This is the base functor for a   or .Note: A   is usually constructed from ", so it does not need to be CPS'd.  = ­ . Pack a  of a   into a  . Transform a  - by looking at a single step of that machine.7Stop feeding input into model, taking only the effects.3Stop feeding input into model and extract an answer)Run a pure machine and extract an answer.$Connect different kinds of machines.    =  Compile a machine to a model.MGenerates a model that runs a machine until it stops, then start it up again.  m =  ( m)(Unfold a stateful PlanT into a MachineT. ZEvaluate a machine until it stops, and then yield answers according to the supplied model.!Incorporate a  into the resulting machine."OGiven a handle, ignore all other inputs and just stream input from that handle. "   ::  a a "   ::   a b a "   ::   a b b "   ::   a b a "   ::   a b b "   ::   a b (Either a b) #KRun a machine with no input until it stops, then behave as another machine.$This is a stopped  &GUse a predicate to mark a yielded value as the terminal value of this  %. This is useful in combination with % to combine s.'OUse a function to produce and mark a yielded value as the terminal value of a  ;. All yielded values for which the given function returns ®V are yielded down the pipeline, but the first value for which the function returns a ¯ value will be returned by a  created via %.°,This permits toList to be used on a Machine.$  !"#$%&'°±²³´µ¶  !"#$%&'  !%&'"#$    !"#$%&'°±²³´µ¶Safe(Given an initial state and a  that runs in · s m , produce a  that runs in m.))L allows a broken machine to be replaced without stopping the assembly line.*Given an environment and a  that runs in ¸ e m , produce a  that runs in m.()*()*()*()*Safe+HRight fold over a stream. This will be lazy if the underlying monad is. runT = foldrT (:) [],Strict left fold over a stream.->Strict fold over a stream. Items are accumulated on the right:  ... ((f o1 <> f o2) <> f o3) ...5Where this is expensive, use the dual monoid instead..FStrict fold over a monoid stream. Items are accumulated on the right: ... ((o1 <> o2) <> o3) ...5Where this is expensive, use the dual monoid instead. foldT = foldMapT id/¬Run a machine with no input until it yields for the first time, then stop it. This is intended primarily for use with accumulating machines, such as the ones produced by fold or fold1 runT1 m = getFirst  $( foldMapT (First . Just) (m ~> taking 1)+,-./+,-./+,-./+,-./(C) 2012 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalGADTsSafe!"IN0@This is a simple process type that knows how to push back input.3?Peek at the next value in the input stream without consuming it4Push back into the input stream5&Pop the next value in the input stream6Stream outputs from one  ; into another with the possibility of pushing inputs back.0123456012345601263540123456'(C) 2015 Yorick Laupa, Gabriel Gonzalez BSD-style (see the file LICENSE)!Yorick Laupa <yo.eight@gmail.com> provisionalRank-2 Types, GADTsSafe!"IN7Like ;, but with a polymorphic type8Like :, but with a polymorphic type9Like <, but with a polymorphic type: Server b' b receives requests of type b' and sends responses of type b. :s only B and never A.; Client a' a sends requests of type a'# and receives responses of type a. ;s only A and never B.<< s neither A nor BALSend a value of type a' upstream and block waiting for a reply of type a. A) is the identity of the request category.BMSend a value of type a downstream and block waiting for a reply of type a' B) is the identity of the respond category.C+Forward responses followed by requests. C& is the identity of the push category.D"Compose two proxies blocked while A0ing data, creating a new proxy blocked while Aing data. (D3) is the composition operator of the push category.E(p >>~ f) pairs each B in p with an A in f.F+Forward requests followed by responses. F& is the identity of the pull category.G-Compose two proxies blocked in the middle of B6ing, creating a new proxy blocked in the middle of B ing. (G3) is the composition operator of the pull category.H(f +>> p) pairs each A in p with a B in f.IIt is impossible for an > to hold a ¹ value.JRun a self-contained <', converting it back to the base monad.KLike J# but discarding any produced value.789:;<=>?@ABCDEFGHIJK789:;<=>?@ABCDEFGHIJK>?@=<;:987ABCDEFGHIJK789:;<=>?@ABCDEFGHIJKDEGH(C) 2012 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalGADTs, Type FamiliesSafe!">LLWitnessed type equalityLMº»¼½¾¿LMLMLMº»¼½¾¿(C) 2012 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalRank 2 Types, GADTsSafe !"35IN NAn N$ can be automatically lifted into a QPA P m a b8 is a stream transducer that can consume values of type a- from its input, and produce values of type b and has side-effects in the Ÿ m.QA Q a b8 is a stream transducer that can consume values of type a- from its input, and produce values of type b for its output.R The trivial Q, that simply repeats each input it receives.SA Q! that prepends the elements of a À3 onto its input, then repeats its input from there.TA Q8 that only passes through inputs that match a predicate.UA Q that drops the first n, then repeats the rest.VA Q that passes through the first n# elements from its input then stopsWA QJ that passes through elements until a predicate ceases to hold, then stopsXA Q, that drops elements while a predicate holdsYChunk up the input into n element lists.NAvoids returning empty lists and deals with the truncation of the final group.Z Build a new   by adding a Q to the output of an old  (Z) :: Q b c -> Q a b -> Q a c (Z) :: Q c d ->   a b c ->   a b d (Z) :: Q b c ->   k b ->   k c [ Flipped (Z).\Feed a Q some input.]<Convert a machine into a process, with a little bit of help. ]   :: Q a c ->   a b c ]   :: Q b c ->   a b c ] Á :: Q a b -> Q a b ^ Construct a Q from a left-scanning operation.Like a#, but yielding intermediate values. ^& :: (a -> b -> a) -> a -> Process b a __ is a variant of ^$ that has no starting value argument`Like ^N only uses supplied function to map and uses Monoid for associative operationa Construct a Q from a left-folding operation.Like ^$, but only yielding the final value. a& :: (a -> b -> a) -> a -> Process b a bb is a variant of a$ that has no starting value argumentcCBreak each input into pieces that are fed downstream individually.dsinkPart_ toParts sink" creates a process that uses the toParts) function to break input into a tuple of (passAlong, sinkPart); for which the second projection is given to the supplied sink PS (that produces no output) while the first projection is passed down the pipeline.e.Apply a monadic function to each element of a P.f+Skip all but the final element of the input f :: Q a a gaSkip all but the final element of the input. If the input is empty, the default value is emitted g :: a -> Q a a h8Intersperse an element between the elements of the input h :: a -> Q a a i'Return the maximum value from the inputj'Return the minimum value from the inputk1Convert a stream of actions to a stream of valuesl4Apply a function to all values coming from the inputmParse ÂCable values, only emitting the value if the parse succceeds. This   stops at first parsing errornConvert Ãable values to Äs#NOPQRSTUVWXYZ[\]^_`abcdefghijklmnÅÆ!NOPQRSTUVWXYZ[\]^_`abcdefghijklmn!QPNO]Z[R\STUVXWYab^_`cdefghijklmn"NOPQRSTUVWXYZ[\]^_`abcdefghijklmnÅÆZ [ (C) 2012 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportableNone7>Loo machinesq#Accumulate the input as a sequence.rHConstruct a Moore machine from a state valuation and transition functionÇslow diagonalizationopqrÈÉÊËÌÍÎÏÐÑÒÓÇÔÕÖרopqropqropqrÈÉÊËÌÍÎÏÐÑÒÓÇÔÕÖר (C) 2012 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportableNone7>Lss machinesvA s% machine modeled with explicit state.Ù$Fast forward a mealy machine forwardwAccumulate history.Úslow diagonalizationstuvÙwÛÜÝÞßàáâãäåæçèéêëÚìíîïstuvwstuvwstuvÙwÛÜÝÞßàáâãäåæçèéêëÚìíîï (C) 2012 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank-2 TypesSafe35IN xA x@ never reads from its inputs, but may have monadic side-effects.yA y never reads from its inputs.z%Repeat the same value, over and over.{Loop through a À container over and over.| Generate a y from any À container.}You can transform a y with a Q.-Alternately you can view this as capping the y end of a Q, yielding a new y. } l r = l Z r~~ f x9 returns an infinite source of repeated applications of f to x n x is a source of x emitted n time(s)€8Enumerate from a value to a final value, inclusive, via ð xyz{|}~€ xyz{|}~€ yx|z{}~€ xyz{|}~€ 5(C) 2012 Edward Kmett, Rúnar Bjarnason, Paul Chiusano BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalRank-2 Types, GADTsSafe!"IN A  Y that can read from two input stream in a deterministic manner with monadic side-effects.‚A  ? that can read from two input stream in a deterministic manner.ƒThe input descriptor for a ‚ or †0Compose a pair of pipes onto the front of a Tee.‡`teeT mt ma mb` Use a ‚) to interleave or combine the outputs of ma and mbˆ/Precompose a pipe onto the left input of a tee.‰0Precompose a pipe onto the right input of a tee.Š>Tie off one input of a tee by connecting it to a known source.‹>Tie off one input of a tee by connecting it to a known source.ñNatural transformation used by Š and ‹.ŒMwait for both the left and the right sides of a T and then merge them with f.£Zip together two inputs, then apply the given function, halting as soon as either input is exhausted. This implementation reads from the left, then the right‚ƒ„…†‡ˆ‰Š‹ñŒ ‚ƒ„…†‡ˆ‰Š‹Œ ‚ƒ„…†‡ˆ‰Š‹Œ ‚ƒ„…†‡ˆ‰Š‹ñŒ 5(C) 2012 Edward Kmett, Rúnar Bjarnason, Paul Chiusano BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalRank-2 Types, GADTsSafe!"IN ŽA  ] that can read from two input stream in a non-deterministic manner with monadic side-effects.A  C that can read from two input stream in a non-deterministic manner.The input descriptor for a  or Ž”,Compose a pair of pipes onto the front of a . Precompose a Q onto each input of a  (or Ž).=This is left biased in that it tries to draw values from the ‘= input whenever they are available, and only draws from the  input when ‘ would block.•/Precompose a pipe onto the left input of a wye.–0Precompose a pipe onto the right input of a tee.—>Tie off one input of a tee by connecting it to a known source.˜>Tie off one input of a tee by connecting it to a known source.òNatural transformation used by — and ˜ Ž‘’“”•–—˜ò Ž‘’“”•–—˜ Ž‘’“”•–—˜ Ž‘’“”•–—˜ò(C) 2012 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional non-portableNoneu  !"#$%&'LMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜None!"™Share inputs with each of a list of processes in lockstep. Any values yielded by the processes are combined into a single yield from the composite process.šŽShare inputs with each of a list of processes in lockstep. If none of the processes yields a value, the composite process will itself yield ó„. The idea is to provide a handle on steps only executed for their side effects. For instance, if you want to run a collection of Pus that await but don't yield some number of times, you can use 'fanOutSteps . map (fmap (const ()))' followed by a V process.ôõ™š™š™šôõ™šNone!"›XUsing a function to signal group changes, apply a machine independently over each group.œPMark a transition point between two groups as a function of adjacent elements.   (\ [1,2,2] (œ1 (==))) == [Right 1, Left (), Right 2, Right 2] _Run a machine multiple times over partitions of the input stream specified by Left () values.ž‹Read inputs until a condition is met, then behave as cont with | input matching condition as first input of cont. | If await fails, stop.ö›œž#›œž›œ#žö›œž÷ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\N]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„… † † ‡ ˆ ‰ ‰ Š ‹ Œ  Ž ‘ ’ “ ” • –  —   ˜ ™ š › œ ž Ÿ        ¡ ¢ £ ¤ ¥¦§¨©ª«¬­®¬¯°¬­±²³´µ¶·¸¹º»¼¬½¾¬­¿¬­ÀÁÂÃÄÅÆÇÈÉÊÈË̬ÍÎÏÐÑÒÓÔ¬ÕÖ¬­°¬×جÙÚ¬­ÛÜÝ Þ ß à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ       ¬   ¬­   machi_1ehezU07mCCBofA1mSC01MData.Machine.PlanData.Machine.TypeData.Machine.LiftData.Machine.RunnerData.Machine.StackData.Machine.PipeData.Machine.IsData.Machine.ProcessData.Machine.MooreData.Machine.MealyData.Machine.SourceData.Machine.TeeData.Machine.WyeData.Machine.FanoutData.Machine.GroupMachineMachineTIs Control.MonadforeverProcessLTeeRXWyeYZ Data.MachinePlanPlanTrunPlanTrunPlanyield maybeYieldawaitawaitsstopexhaust Applianceapplied runMachineTStepStopYieldAwait runMachineencased stepMachinerunT_runTrunfitfitM construct repeatedly unfoldPlanbeforepreplanpassstarvestopped deconstructtagDone finishWith execStateM catchExcept runReaderMfoldrTfoldlTfoldMapTfoldTrunT1StackPushPoppeekpushpopstackClient'Server'Effect'ServerClientEffectProxyExchangeRequestRespondrequestrespond>~>>>~pull>+>+>>absurdExchange runEffect runEffect_Refl AutomatonautoProcessTecho prependedfiltereddroppingtaking takingWhile droppingWhilebuffered<~~>supplyprocessscanscan1scanMapfoldfold1asParts sinkPart_autoMfinalfinalOr intersperselargestsmallest sequencingmappingreadingshowingMoorelogMoore unfoldMooreMealyrunMealy unfoldMealylogMealySourceTSourcerepeatedcycledsourcecapiterated replicatedenumerateFromToTeeTTteeteeTaddLaddRcapLcapRzipWithTzipWithWyeTwyeaddXaddYcapXcapYfanout fanoutSteps groupingOntaggedBy partitioning awaitUntilbaseGHC.BaseMonadControl.Categoryidempty$fMonadErrorePlanT$fMonadWriterwPlanT$fMonadReaderePlanT$fMonadStatesPlanT$fMonadIOPlanT$fMonadTransPlanT$fMonadPlusPlanT $fMonadPlanT$fAlternativePlanT$fApplicativePlanT$fFunctorPlanTData.Functor.Identity runIdentityNothingJust$fFoldableMachineT$fApplicativeMachineT$fMonoidMachineT$fSemigroupMachineT$fPointedMachineT$fFunctorMachineT $fFunctorSteptrans_3eG64VdP2vzGjP6wJiCp5X Control.Monad.Trans.State.StrictStateTControl.Monad.Trans.ReaderReaderT Data.VoidVoid $fCategory*Is$fReadIs $fMonoidIs$fOrdIs$fEqIs$fShowIs Data.FoldableFoldableGHC.ReadReadGHC.ShowShowString $fAutomatonIs$fAutomaton(->) $fMonadMoore $fClosedMoore$fMonadReader[]Moore$fMonadZipMoore$fMonadFixMoore$fCorepresentableMoore$fCostrongMoore$fCosieveMoore[]$fRepresentableMoore$fDistributiveMoore$fComonadApplyMoore$fComonadMoore$fCopointedMoore$fPointedMoore$fApplicativeMoore$fProfunctorMoore$fFunctorMoore$fAutomatonMoore driveMealy $fMonadMealy $fClosedMealy$fMonadReaderNonEmptyMealy$fMonadZipMealy$fMonadFixMealy$fCorepresentableMealy$fCostrongMealy$fCosieveMealyNonEmpty$fRepresentableMealy$fDistributiveMealy$fArrowApplyMealy $fChoiceMealy $fStrongMealy$fArrowChoiceMealy $fArrowMealy$fCategory*Mealy$fAutomatonMealy$fProfunctorMealy $fExtendMealy$fPointedMealy$fApplicativeMealy$fFunctorMealyGHC.EnumsucccappedTcappedmemptycontinuesemigroupDlistisLeft