[haskell-art] Sound.SC3.Lang.Pattern and external events

Stefan Kersten sk at k-hornz.de
Fri Nov 6 11:41:17 GMT 2009


Rohan Drape wrote:
>> i was wondering how to inject events from external
>> sources (controllers, etc.)  into a pattern. i was
>> about to extend P with an environment parameter that
>> can be modified between 'step' invocations, but maybe
>> there's a better (existing) way to accomplish
>> this. 
> 
> there are some patches in the history that generalise
> the pattern state (ie. P a => P s a).  however these
> weren't very helpful...  i'd gratefully accept any
> better work!

that was exactly what i was about to do ... what was the problem with 
this approach? i would think that if step were exposed in the interface, 
i could pass in a new state for each value produced by the pattern; a 
hypothetic `pask' would return the current state (or rather environment; 
it's not changed by the patterns).

>> any thoughts?
> 
> i am not super convinced about the implementation of
> 'patterns' in hsc3-lang.  it was written when working
> on a chapter for the sc3 book (we missed the deadline!)
> as a kind of 'proof of concept' and it's never been
> seriously used (as far as i know).  for my own work
> plain haskell has in the end been concise enough.

what do you mean by plain haskell, lazy lists? i'm having trouble 
imagining how i could deal with asynchronous events, but that's probably 
just my lack of imagination ;)

i think the patterns could be regarded as a kind of poor man's FRP, 
where reactivity is limited to the reoccurring "timer event" from the 
step invocations. i like their simplicity in comparison with the 
currently available "real" FRP systems, apart from the fact that my 
experiments with reactive in particular have been basically fruitless 
... maybe the (planned?) new version of haskore comes to the rescue?

<sk>



More information about the haskell-art mailing list