>>   ^a + b / (x * ^y)
[...]
>
> I have not followed this thread closely ... You may
> overload +, *, / in order to work on your particular
> monad. Actually, for these kinds of operations
> Applicative Functors are enough, and their
> combinators allow functional style of writing also
> for non-overloaded functions. However, Eq class
> cannot be easily overloaded this way.

yes, & i did not give a great example, but it is not a
very general solution to require all functions be in
type classes and overloaded to accept possibly monadic
arguments at all inputs.

i mentioned this in the context of DSLs and
'non-programmers' since my experience with writing
instruments (ugen graphs, control graphs etc.) in
haskell is that the only real 'awkwardness' is having
to introduce unnecessary bindings and nest alternate
binding constructs.  as a concrete example consider:

  do { n1 <- brownNoise AR
     ; n2 <- brownNoise AR
     ; let { n3 = lpf n2 f * m + a
           ; n4 = onePole n1 0.99 }
       in return (rhpf n4 n3 0.03 * g) }

where n1 and n2 are only defined because there is no
simple notation to write the values directly into the
expressions where they are used.

also, changing an input from a non-monadic to a monadic
value tends to require a lot of textual re-writing and
re-indentation, so using layout is often troublesome.

for 'real' programming this is all a non-issue, but for
interactive / iterative / experimental / musical
writing it is, i find, a problem.

i think my point is that 'plain haskell plus more
elegant do notation' might be an excellent 'DSL' for
non-programmers!

bests
rohan
_______________________________________________
haskell-art mailing list
[email protected]
http://lists.lurk.org/mailman/listinfo/haskell-art

Reply via email to