[Haskell-cafe] FRP, arrows and loops

Maciej Piechotka uzytkownik2 at gmail.com
Fri Apr 2 02:12:50 EDT 2010

Hello. I'm trying to understand the FRP (by implementing FRP system on
my own) and I think I'm slowly getting it.

1. How to interpret ArrowLoop? I have two possible implementations:

type RunSF a = a Dynamic ()

data SF a b c =
  SF (a (Dynamic, b, RunSF, Set Unique) (c, Set Unique, SF a b c))


instance ArrowLoop (SF a) where
  loop (SF f) = loop' f undefined
                where loop' g d = proc (dyn, b, r, s) -> do
                        ((c, d'), s, g') <- g <- (dyn, (b, d), r, s)
                        returnA -< (c, s, loop' g' d')

instance ArrowLoop a => ArrowLoop (SF a) where
  loop (SF f) =  SF $! proc (d, b, r, s) -> do
    rec ((c, d), s, f') <- f -< (d, (b, d), r, s)
    returnA -< (c, s, loop f')

Since the first is not unlike ArrayCircuit from arrays I guess second
one but I'm not quite sure.

2. Why there is no ArrowIO in arrows? I.e.

class Arrow a => ArrowIO a where
  liftAIO :: Kleisli IO b c -> a b c


class Arrow a => ArrowST a where
  liftAST :: Kleisli ST b c -> a b c

3. Why switch is needed? How to interpret switch with current

I think switch is equivalent to ArrowChoice but do I miss something?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20100402/5e0162bd/attachment.bin

More information about the Haskell-Cafe mailing list