[Announcement] New version of FLTKHS with much better error messages and OpenGL integration.
Happy to announce a new major version of FLTKHS, the Haskell binding to the FLTK for easy native cross-platform GUI apps in Haskell. Quick install instructions are available on the Github page and the main documentation has more information on why this library exists and how to use it.
The highlights of this release are:
-
OpenGL is now optional so apps that don't need it aren't forced into runtime dependencies on
GLandGLUTlibraries. To enable OpenGL build your app withstack build --flag fltkhs:bundled --flag fltkhs:opengl. -
The OpenGL integration itself has been overhauled to make it much easier to add graphics to an FLTKHS application using standard Haskell OpenGL libraries. I've started a demo repo currently with one demo showing how to use FLTKHS with OpenGLRaw. I'll add more as I find time. PR's welcome :).
-
On GHC 8 and above the error messages are much better thanks to CustomTypeErrors. For example,
getDirection buttonis a mistake because a Button does not have a direction. In the past the typechecker would spit out:* Couldn't match type 'Match r0' with 'NoFunction (GetDirection ()) (Graphics.UI.FLTK.LowLevel.Hierarchy.CButton Widget)'
but now generates:
* GetDirection is not supported by Graphics.UI.FLTK.LowLevel.Hierarchy.CButton
It's not 100% there but I think it's definitely better and will be even more improved when CustomTypeErrors offers an option to not expand type synonyms.
Next I'll (finally) be working on theming.
Finally, a request for help: the library currently does not build if profiling is turned on (stack build ... --profile). It seems to be because GHC profiling doesn't like linking against a static library but I'm not sure. In any case, if you're interested in helping please DM or email me at the address on the Hackage page.
Enjoy!
Posted Jul 4, 2017, 4:44 PM UTC · edited
Why did you choose FLTK? I don't mean any criticism with this question, I just don't know much about GUI frameworks and would like to hear your thoughts.
I have some of the reasons in the docs but I can flesh it out a little:
OpenGLRawintegration in the demo I linked above.I really wish great looking themes were available because then this whole project would be a much easier sell. But on balance the toolkit provides so much of what I was looking for in terms of primitives and flexibility I thought it was well worth the investment.
Update: some people have asked about other micro toolkits like Fox. The reason I went with FLTK was that it was the only small toolkit that also had a GUI builder which is now pretty much integrated with Haskell, if you really wanted to you could write your entire Haskell app purely in Fluid.
It was also the first GUI library for me that I got running by simply following the build instructions for Windows. (Not that I tried all of them but I did try a few)
It doesn't sound like much but that alone is an achievement to me.
[deleted]
About Twitter, it's disgusting that you need hundreds of megabytes of memory to display tweets that are 140 characters. That gives you 1 million bytes per character, talk about wasteful.
Extra bonus: because everything is JavaScript, the back button doesn't work reliably (it will often nuke all the tweets you'd scrolled past and you have to start over) and it shows you a "sign up for twitter" splash page every time you hit back.
Twitter isn't a static page displaying 140 characters of text. In any case, a browser tabs RAM usage isn't usually dominated by the size of the website it displays anyway.
No, it is dominated by the huge massive mess of spaghetti javascript twitter foists on you to display an incredibly simple tiny little page that requires only a few lines of javascript as an optional enhancement.
AFAIR he wanted to have the lowest amount of dependencies for easiest builds, and FLTK fit that bill.