[Haskell-beginners] How to solve this using State Monad?
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
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 ?)
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...
Size: 836 bytes
Desc: not available
More information about the Beginners