fltkhs
fltkhs copied to clipboard
type of windows API should not be IO but should be MonadIO
So I am building a reflex wrapper for fltkhs at https://github.com/MarisaKirisame/reflex-fltk. I had made a special wrapper of newtype FLTK m a = FLTK { unFLTK :: m a } to denote that something is a fltk application, and FL.run will be call automatically.
So far, so good, but if I want to use setXXX, newButton, I have to liftIO everywhere.
Even worse, I cannot replace my implementation of within (which is on FLTK m) with the newly-added within (which is on IO).
I can redefine every function to have impl on FLTK, but I guess a more rational approach is to extend them to generic MonadIO here.
That's a cool project! I took a small stab at it some time ago; it maybe of some help.
Re: MonadIO
that's a pretty big change let me think about it. Do you know if there's a performance hit? I would think since it's a single function typeclass the dictionary get optimized away and it shouldn't be a problem but I could be wrong. A couple of other big things for me to consider are impact on type inference and compilation speed (fltkhs
is kind of slow already).
I started reflex-fltk by reading that :) I am not good with performance, but we can try to ddump a intermediate result. My guess is FFI will be much greater cost than passing a dictionary. For type inference, compilation, I dont know. But we can test all three of them. If you are interested I can do it.
Sure, go for it! Not sure how you're building but profiling works pretty well with stack
. Unfortunately you'll probably need to hose your .stack-work
and do a stack clean
first.
It is hard to profile for GUI application I guess.. So I am planning to just compare ddump
That sounds good, but just FYI, I've done a bit of work to make sure that profiling does work for fltkhs
apps as well. Running stack
with profiling should just work, if it doesn't please open an issue.
btw, I don't think MonadIO works for bracket functions
On Thu, Apr 5, 2018, 12:30 PM deech [email protected] wrote:
That sounds good, but just FYI, I've done a bit of work to make sure that profiling does work for fltkhs apps as well. Running stack with profiling should just work, if it doesn't please open an issue.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/deech/fltkhs/issues/81#issuecomment-379050561, or mute the thread https://github.com/notifications/unsubscribe-auth/ACNoMVfdBd4D_w78ahj6P6Isq38VzP2qks5tlnDDgaJpZM4TIOPR .
@sboosali there are MonadCatchIO for that