Functional reactive programming library

#3Tutorial too hard

The tutorial is pretty well written, I like it a lot more that most other tutorial for haskell libraries.

Although I consider myself smart and have had Haskell experience for several years now, I was not able to get through the tutorial easily.

The problem is that I was not able to compile and run the examples given in the tutorial.

In the beginning everything worked fine, but as soon as the tutorial started using strings as signal values, I got type errors. When using (pure "some string") everything works, but the examples use strings directly implying that there should be some kind of pre-defined instances like for Num.

I am using ghc-7.8.2.

Maybe two things should be added to the tutorial:

  1. A hint to {-# LANGUAGE OverloadedStrings #-}
  2. A type signature for at least 'netwireIsCool', like this one:

netwireIsCool :: (Monad m, HasTime t s, Fractional t) => Wire s () m a String

    • description updated
  • Thank you for this tutorial! I'm loving netwire. I struggled a bit with the lack of type signatures and would like to also request more clarification around using the arrow interface. Just some surrounding code would really help a noob like me who doesn't understand the context of proc _ -> do ... My guess is that you would use that do expression with mkGenN or similar?

  • Hi, I often use arrows just to compose ordinary functions (instead of '.' operator). Since functions are arrows, you can write eg. 'map fst >>> flip zip [0..] >>> Map.fromList' which is equivalent of 'arr map fst >>> arr flip zip [0..] >>> arr Map.fromList'. It was hard for me to find out howto create even simple Wire from pure function. Solution was to use eg. 'arr (-> fromIntegral x / 2) :: WireP e s Int Double'. It might be good to include similar example and link to http://www.haskell.org/arrows/ and http://en.wikibooks.org/wiki/Haskell/Understanding_arrows in tutorial. Thanks for making netwire.

  • Somehow I've lost lambda parameter: 'arr (-> fromIntegral x / 2) :: WireP e s Int Double

  • ok... I didn't, ehm... arr (  x -> fromIntegral ... ?

  • This is annoying arr (  x -> fromIntegral ...

    • added tag bug
    • added tag docs

    Thanks for your report. I admit that I had to write the tutorial in a hurry, although I did test the examples. In the future tutorials will be written as literate Haskell, and there will be a test suite to make sure they actually work. =)