[Haskell-beginners] How to solve this using State Monad?

Ertugrul Söylemez es at ertes.de
Sat Jun 2 13:56:15 CEST 2012

Miguel Negrao <miguel.negrao-lists at friendlyvirus.org> wrote:

> I mostly program audio related stuff and arrows seem perfect for
> defining audio synthesis (I already saw some attempts at this with
> Yampa).

If what you want to define is a monad, you should make it a monad.
Arrows are there because of the limitations of monads.  Monads, while
being less general, are more expressive.

If you find that what you want is an arrow, you usually want to make it
an applicative functor as well.  Applicative style combined with the
Category class gives much more declarative descriptions of the same
thing (and usually also with higher performance).

This is something I wanted to cover in a later chapter in my tutorial,
but yeah -- it's not finished yet. =)

> I see a lot of similarities between arrows and the Faust audio
> synthesis languages (perhaps it’s the same core idea ?)
> http://faust.grame.fr/.

Yes, that looks like functional reactive programming.  You can do that
with Netwire for example.  In fact the code samples can be translated
almost 1:1 to Netwire.


nightmare = unsafePerformIO (getWrongWife >>= sex)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120602/9ab84865/attachment.pgp>

More information about the Beginners mailing list