Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assumption of a callback-based, "event driven programming" library is too strong. #42

Closed
enolan opened this issue Oct 10, 2012 · 2 comments

Comments

@enolan
Copy link
Contributor

enolan commented Oct 10, 2012

Hi Heinrich!

My tutorial has progressed quite a bit. My biggest gripe is how hard it is to do things that aren't hooking it up to wxHaskell or something similar to wxHaskell. I should not have had to write this:

addHandlerFromThread :: (Chan a -> IO ()) -> AddHandler a
addHandlerFromThread writerThread handler = do
    chan <- newChan
    tId1 <- forkIO (writerThread chan)
    tId2 <- forkIO $ forever $ (readChan chan >>= handler)
    return (killThread tId1 >> killThread tId2)

And what if I have a thread or group of threads that consume multiple inputs and/or produce multiple outputs? I think I need a lower level interface for that i.e. either you or me should write a more general system for hooking stuff up to FRP-land.

Regards,
Echo

@HeinrichApfelmus
Copy link
Owner

Nice to see your tutorial progressing!

But what alternative assumption should reactive-banana make about the "outside world"?

As I see it, FRP is essentially just a fancy way to write callback functions, i.e. things that can be passed to AddHandlers. I'm not very happy with the administrative mumbo-jumbo that is currently needed to hook events in and out of reactive-banana, but it's the simplest one I could come up with so far.

Since you are implementing a custom timer and hence a miniature event-based framework, it seems quite reasonable to me that you have to implement your own machinery with managing callbacks. Fortunately, reactive-banana can help a bit by providing the newAddHandler function.

@enolan
Copy link
Contributor Author

enolan commented Oct 16, 2012

As /I/ see it, FRP is a fancy way to talk about systems that progress over
time. See herehttp://www.reddit.com/r/haskell/comments/11ixcl/absurd_ambition_towards_lifting/
for
a rank n generalization idea. Maybe doing that actual work can be Kmett's
job, he seems to know what he's talking about.

On Tue, Oct 16, 2012 at 7:03 AM, Heinrich Apfelmus <notifications@github.com

wrote:

Nice to see your tutorial progressing!

But what alternative assumption should reactive-banana make about the
"outside world"?

As I see it, FRP is essentially just a fancy way to write callback
functions, i.e. things that can be passed to AddHandlers. I'm not very
happy with the administrative mumbo-jumbo that is currently needed to hook
events in and out of reactive-banana, but it's the simplest one I could
come up with so far.

Since you are implementing a custom timer and hence a miniature
event-based framework, it seems quite reasonable to me that you have to
implement your own machinery with managing callbacks. Fortunately,
reactive-banana can help a bit by providing the newAddHandler function.


Reply to this email directly or view it on GitHubhttps://github.com//issues/42#issuecomment-9489060.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants