[Haskell-cafe] Global fixity (our status quo) vs. local fixity

Adam Bergmark adam at bergmark.nl
Tue Oct 20 00:03:15 UTC 2015


On Mon, Oct 19, 2015 at 10:49 PM, Jeffrey Brown <jeffbrown.the at gmail.com>
wrote:

> Adam: Sweet! Are there implementations in Haskell?
>
>
I don't know. A colleague implemented it in purescript (I believe) for a
toy language of his.


> Francesco: here is the problem that spurred me to write this email:
>
> Tidal uses a |+| operator to conjoin what it calls OscPatterns. For
> instance, you can write:
>
>   d1 $ sound "bd sn" |+| speed "3" |+| pan "1"
>
> to tell the sampler named d1, "play the bd (bass drum) sample at phase 0
> and the sn (snare drum) sample at pahse 1/2. Speed both up by a factor of
> 3, and pan both to the right speaker". (Phase takes values in the interval
> [0,1); upon reaching 1, a new cycle begins at 0.)
>
> Tidal offers functions for changing patterns.  For instance, to slow down
> by a factor of 2 the frequency at which samples are triggered (that's how
> often a sample is played, not its playback speed), you can write this:
>
>   d1 $ (slow 2 $ sound "bd sn") |+| speed "3" |+| pan "1"
>
> Every instruction issued to d1 is a chain of |+|-separated OscPatterns. I
> often want to thread OscPatterns through functions before conjoining them.
> I therefore would like to be able to explain to Tidal that in whatever it
> finds to the right of a statement beginning with "d1 $", it should bind |+|
> after $. Then I would not need so many parentheses.
>
> On Mon, Oct 19, 2015 at 1:01 PM, Francesco Ariis <fa-ml at ariis.it> wrote:
>
>> On Mon, Oct 19, 2015 at 12:39:04PM -0700, Jeffrey Brown wrote:
>> > Does anybody else think it would be nice if a library's author had only
>> to
>> > decide its operators' precedence relative to each other, and could let
>> > users decide for themselves how fast its operators should bind relative
>> to
>> > operators from another library?
>>
>> It is true that fixity is ordinal, not cardinal, but I guess letting the
>> user decide for themselves how to blend operators from different libraries
>> could lead to a fragmentation where I will find difficult to
>> read/interpret your code and viceversa.
>>
>> Can you make an example where the 10 levels of precedence (plus function
>> application) wasn't enough for you/other devs?
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>>
>
>
>
> --
> Jeffrey Benjamin Brown
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20151020/e3f4b690/attachment.html>


More information about the Haskell-Cafe mailing list