Changes between Version 5 and Version 6 of Architecture

Show
Ignore:
Timestamp:
03/20/10 19:12:26 (4 years ago)
Author:
blamario (IP: 99.241.117.248)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Architecture

    v5 v6  
    77The framework relies on the following packages: 
    88 * [wiki:monad-parallel monad-parallel] to enable parallel execution of monadic computations, and 
    9  * [wiki:monad-coroutine monad-coroutine] to enable the same monadic computations to suspend and resume each other. 
     9 * [wiki:monad-coroutine monad-coroutine] for the ability to suspend and resume monadic computations. 
    1010 
    1111== Streams == 
    1212 
    13 The lowest layer builds on the coroutine foundation to provide streaming computations. The main idea here is to introduce sinks and sources: 
     13The lowest layer builds on the monad-coroutine foundation to provide streaming computations. The main idea here is to introduce sinks and sources: 
    1414 
    1515{{{ 
    1616data Sink (m :: * -> *) a x = Sink { 
    17    put :: forall d. (AncestorFunctor a d) => x -> Coroutine d m Bool, 
    18    canPut :: forall d. (AncestorFunctor a d) => Coroutine d m Bool 
     17   put :: forall d. (AncestorFunctor a d) => x -> Coroutine d m () 
    1918   } 
    2019 
     
    3130}}} 
    3231 
    33 This function takes two coroutines as arguments, ''producer'' and ''consumer''. The producer gets a sink argument, and the consumer a source argument. All data that the producer writes to the sink can be read from the source by the consumer. The arrangement couldn't be simpler. Here is a contrived example of a producer/consumer pair: 
     32This function takes two coroutines as arguments, ''producer'' and ''consumer''. The producer takes a sink argument, and the consumer a source argument. All data that the producer writes to the sink can be read from the source by the consumer. The arrangement couldn't be simpler. Here is a contrived example of a producer/consumer pair: 
    3433 
    3534{{{ 
     
    4746}}} 
    4847 
    49 The {{{rangeProducer}}} coroutine produces a range of integers while the {{{sumConsumer}}} consumes all the numbers and sums them up. The two coroutines are bound together by {{{pipe}}}. Note that either of them could be bound to a different coroutine and still perform its job. Furthermore, though in this example both coroutines run in the IO monad, they are completely generic and could run in any monad. 
     48The {{{rangeProducer}}} coroutine produces a range of integers while the {{{sumConsumer}}} consumes all the numbers and sums them up. The two coroutines are bound together by {{{pipe}}}. Note that either of them could be replaced by a different coroutine of the same type and the other coroutine would still perform its job. Furthermore, though in this example both coroutines run in the IO monad, they are completely generic and could run in any monad. 
    5049 
    5150== Components and combinators == 
     
    5655type OpenConsumer m a d x r = AncestorFunctor a d => Source m a x -> Coroutine d m r 
    5756type OpenProducer m a d x r = AncestorFunctor a d => Sink m a x -> Coroutine d m r 
    58 type OpenTransducer m a1 a2 d x y =  
    59    (AncestorFunctor a1 d, AncestorFunctor a2 d) => Source m a1 x -> Sink m a2 y -> Coroutine d m [x] 
    60 type OpenSplitter m a1 a2 a3 a4 d x b = 
     57type OpenTransducer m a1 a2 d x y r =  
     58   (AncestorFunctor a1 d, AncestorFunctor a2 d) => Source m a1 x -> Sink m a2 y -> Coroutine d m r 
     59type OpenSplitter m a1 a2 a3 a4 d x b r = 
    6160   (AncestorFunctor a1 d, AncestorFunctor a2 d, AncestorFunctor a3 d, AncestorFunctor a4 d) => 
    62    Source m a1 x -> Sink m a2 x -> Sink m a3 x -> Sink m a4 b -> Coroutine d m [x] 
     61   Source m a1 x -> Sink m a2 x -> Sink m a3 x -> Sink m a4 b -> Coroutine d m r 
    6362 
    6463newtype Consumer m x r = Consumer {consume :: forall a d. OpenConsumer m a d x r} 
    6564newtype Producer m x r = Producer {produce :: forall a d. OpenProducer m a d x r} 
    66 newtype Transducer m x y = Transducer {transduce :: forall a1 a2 d. OpenTransducer m a1 a2 d x y} 
    67 newtype Splitter m x b = Splitter {split :: forall a1 a2 a3 a4 d. OpenSplitter m a1 a2 a3 a4 d x b} 
     65newtype Transducer m x y = Transducer {transduce :: forall a1 a2 d. OpenTransducer m a1 a2 d x y ()} 
     66newtype Splitter m x b = Splitter {split :: forall a1 a2 a3 a4 d. OpenSplitter m a1 a2 a3 a4 d x b ()} 
    6867}}} 
    6968