úκ¼±ix      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_` a b c d e f g h i j k l m n o p q r s t u v w &(C) 2012 Edward Kmett, Rúnar Bjarnason BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalRank-N Types, MPTCs Safe-Inferred246HM 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 x 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 x.Output a result.8Like yield, except stops if there is no value to yield. Wait for input.  =  yWait for a particular input. awaits L ::  (T a b) o a awaits R ::  (T a b) o b awaits y ::  ( i) o i   = z 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, GADTs Safe-Inferred!"24HM 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 x 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  .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.  y = yCompile a machine to a model.MGenerates a model that runs a machine until it stops, then start it up again.  m =  ( m)ZEvaluate a machine until it stops, and then yield answers according to the supplied model.OGiven a handle, ignore all other inputs and just stream input from that handle.  y ::  a a    ::   a b a    ::   a b b    ::   a b a    ::   a b b    ::   a b (Either a b) 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.  !"#‰Š‹Œ  !"# !"#    !"#‰Š‹Œ(C) 2012 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalGADTs Safe-Inferred!"HM$@This is a simple process type that knows how to push back input.'?Peek at the next value in the input stream without consuming it(Push back into the input stream)&Pop the next value in the input stream*Stream outputs from one  ; into another with the possibility of pushing inputs back.$%&'()*$%&'()*$&%*')($&%'()*(C) 2012 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalGADTs, Type Families Safe-Inferred!"=K+Witnessed type equality+,Ž‘’“+,+,+,Ž‘’“(C) 2012 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalRank 2 Types, GADTs Safe-Inferred!"24HM -An -' is can be automatically lifted into a 0/A / 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 x m.0A 0 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.1 The trivial 0, that simply repeats each input it receives.2A 0! that prepends the elements of a ”3 onto its input, then repeats its input from there.3A 08 that only passes through inputs that match a predicate.4A 0 that drops the first n, then repeats the rest.5A 0 that passes through the first n# elements from its input then stops6A 0J that passes through elements until a predicate ceases to hold, then stops7A 0, that drops elements while a predicate holds8Chunk up the input into n element lists.NAvoids returning empty lists and deals with the truncation of the final group.9 Build a new   by adding a 0 to the output of an old  (9) :: 0 b c -> 0 a b -> 0 a c (9) :: 0 c d ->   a b c ->   a b d (9) :: 0 b c ->   k b ->   k c : Flipped (9).;Feed a 0 some input.<<Convert a machine into a process, with a little bit of help. <   :: 0 a c ->   a b c <   :: 0 b c ->   a b c < y :: 0 a b -> 0 a b = Construct a 0 from a left-scanning operation.Like @#, 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 operation@ Construct a 0 from a left-folding operation.Like =$, but only yielding the final value. @& :: (a -> b -> a) -> a -> Process b a AA is a variant of @$ that has no starting value argumentBCBreak each input into pieces that are fed downstream individually.CsinkPart_ 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 /S (that produces no output) while the first projection is passed down the pipeline.D.Apply a monadic function to each element of a /.E+Skip all but the final element of the input E :: 0 a a FaSkip all but the final element of the input. If the input is empty, the default value is emitted F :: a -> 0 a a G8Intersperse an element between the elements of the input G :: a -> 0 a a H'Return the maximum value from the inputI'Return the minimum value from the inputJ1Convert a stream of actions to a stream of valuesK4Apply a function to all values coming from the inputLParse •Cable values, only emitting the value if the parse succceeds. This   stops at first parsing errorMConvert –able values to —s#-./0123456789:;<=>?@ABCDEFGHIJKLM˜™!-./0123456789:;<=>?@ABCDEFGHIJKLM!0/-.<9:1;2345768@A=>?BCDEFGHIJKLM"-./0123456789:;<=>?@ABCDEFGHIJKLM˜™9 : (C) 2012 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportable Safe-InferredNN machinesP#Accumulate the input as a sequence.QHConstruct a Moore machine from a state valuation and transition functionšslow diagonalization NOPQ›œšžŸ ¡¢NOPQNOPQ NOPQ›œšžŸ ¡¢(C) 2012 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalportable Safe-InferredRR machinesUA R% machine modeled with explicit state.£$Fast forward a mealy machine forwardVAccumulate history.¤slow diagonalizationRSTU£V¥¦§¨©ª«¬¤­®¯RSTUVRSTUVRSTU£V¥¦§¨©ª«¬¤­®¯(C) 2012 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional Rank-2 Types Safe-Inferred24HM WA W@ never reads from its inputs, but may have monadic side-effects.XA X never reads from its inputs.Y%Repeat the same value, over and over.ZLoop through a ” container over and over.[ Generate a X from any ” container.\You can transform a X with a 0.-Alternately you can view this as capping the X end of a 0, yielding a new X. \ l r = l 9 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 ° WXYZ[\]^_ WXYZ[\]^_ XW[YZ\]^_ WXYZ[\]^_ 5(C) 2012 Edward Kmett, Rúnar Bjarnason, Paul Chiusano BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalRank-2 Types, GADTs Safe-Inferred!"HM `A  Y that can read from two input stream in a deterministic manner with monadic side-effects.aA  ? that can read from two input stream in a deterministic manner.bThe input descriptor for a a or `e0Compose a pair of pipes onto the front of a Tee.f/Precompose a pipe onto the left input of a tee.g0Precompose a pipe onto the right input of a tee.h>Tie off one input of a tee by connecting it to a known source.i>Tie off one input of a tee by connecting it to a known source.±Natural transformation used by h and i.jMwait for both the left and the right sides of a T and then merge them with f. `abcdefghi±j `abcdefghij a`bdcefghij `abdcefghi±j 5(C) 2012 Edward Kmett, Rúnar Bjarnason, Paul Chiusano BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisionalRank-2 Types, GADTs Safe-Inferred!"HM kA  ] that can read from two input stream in a non-deterministic manner with monadic side-effects.lA  C that can read from two input stream in a non-deterministic manner.mThe input descriptor for a l or kq,Compose a pair of pipes onto the front of a l. Precompose a 0 onto each input of a l (or k).=This is left biased in that it tries to draw values from the p= input whenever they are available, and only draws from the m input when p would block.r/Precompose a pipe onto the left input of a wye.s0Precompose a pipe onto the right input of a tee.t>Tie off one input of a tee by connecting it to a known source.u>Tie off one input of a tee by connecting it to a known source.²Natural transformation used by t and u klmnopqrstu² klmnopqrstu lkmponqrstu klmponqrstu²(C) 2012 Edward Kmett BSD-style (see the file LICENSE)Edward Kmett <ekmett@gmail.com> provisional non-portable Safe-Inferredo  !"#+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstu  Safe-Inferred!"³Feed a value to a / at an   . If the /c is awaiting a value, then its next step is returned. Otherwise, the original process is returned.´Like + but with a monadic accumulating function.µ%Exhaust a sequence of all successive  steps taken by a S. Returns the list of yielded values and the next (non-Yield) step of the machine.vShare 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.wŽ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 /us that await but don't yield some number of times, you can use 'fanOutSteps . map (fmap (const ()))' followed by a 5 process.³´µvwvwvw³´µvw· !"#$%&'   ()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcddefgghijklmnopqrs t  u   v w x y z { |      } ~  € ‚ ƒ„…†„‡ˆ„‰Š‹ŒŽ‘’“”•–—˜„™š„™›œžŸ ¡¢£¤¥¦„§¨„©ª„«¬„…­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅ„ÆÇ È É Ê Ë Ì„ÍÎÏ machines-0.4Data.Machine.PlanData.Machine.TypeData.Machine.StackData.Machine.IsData.Machine.ProcessData.Machine.MooreData.Machine.MealyData.Machine.SourceData.Machine.TeeData.Machine.WyeData.Machine.FanoutMachineMachineTIs Control.MonadforeverProcessLTeeRXWyeYZ Data.Machine Data.List mapAccumLPlanPlanTrunPlanTrunPlanyield maybeYieldawaitawaitsstopexhaust Applianceapplied runMachineTStepAwaitYieldStop runMachineencasedrunT_runTrunfitfitM construct repeatedlybeforepassstopped deconstructtagDone finishWithStackPopPushpeekpushpopstackRefl AutomatonautoProcessTecho prependedfiltereddroppingtaking takingWhile droppingWhilebuffered<~~>supplyprocessscanscan1scanMapfoldfold1asParts sinkPart_autoMfinalfinalOr intersperselargestsmallest sequencingmappingreadingshowingMoorelogMoore unfoldMooreMealyrunMealy unfoldMealylogMealySourceTSourcerepeatedcycledsourcecapiterated replicatedenumerateFromToTeeTTteeaddLaddRcapLcapRzipWithTWyeTwyeaddXaddYcapXcapYfanout fanoutStepsbaseGHC.BaseMonadControl.CategoryidControl.Applicativeempty$fMonadErrorePlanT$fMonadWriterwPlanT$fMonadReaderePlanT$fMonadStatesPlanT$fMonadIOPlanT$fMonadTransPlanT$fMonadPlusPlanT $fMonadPlanT$fAlternativePlanT$fApplicativePlanT$fFunctorPlanTtransformers-0.3.0.0Data.Functor.Identity runIdentity Data.MaybeNothingJust$fFoldableMachineT$fApplicativeMachineT$fPointedMachineT$fFunctorMachineT $fFunctorStep $fCategory*Is$fReadIs $fMonoidIs$fOrdIs$fEqIs$fShowIs Data.FoldableFoldableGHC.ReadReadGHC.ShowShowString $fAutomatonIs$fAutomaton(->) $fMonadMoore$fComonadApplyMoore$fComonadMoore$fCopointedMoore$fPointedMoore$fApplicativeMoore$fProfunctorMoore$fFunctorMoore$fAutomatonMoore driveMealy $fMonadMealy$fArrowApplyMealy $fChoiceMealy $fStrongMealy$fArrowChoiceMealy $fArrowMealy$fCategory*Mealy$fAutomatonMealy$fProfunctorMealy$fPointedMealy$fApplicativeMealy$fFunctorMealyGHC.EnumsucccappedTcappedfeed mapAccumLM flushYields Data.Monoidmempty