News for hackers. Stuff that matters.
Re:Making a GTK Video Player with Haskell by progman on Sunday September 03, 2017 @09:55AM (#15161414)
The examples mentioned in the other posts confirm my impression that Haskell is a good language for text processing and server applications but a pain for writing rich desktop applications.

One of the things I miss in Haskell is a way to compile to C, and a convenient declarative GUI which also compiles to C so that all code can be linked together, and distributed as a single binary. The GUI doesn't need to be native. Lisp has its own GUI (McCLIM), Smalltalk has one (Squeak), Rust has one (Conrod), why not Haskell?

Re:Making a GTK Video Player with Haskell by mrkgnao on Sunday September 03, 2017 @01:08PM (#15162533)
I'm currently playing with Reflex, a wonderful functional reactive programming library that lets you compile the same code into into webapps with GHCJS (a JavaScript backend for GHC) or into standalone desktop apps (using WebKitGTK).

It's wonderfully expressive and doesn't feel like you're painfully imitating C++ in Haskell. On the contrary, it's very idiomatic.

https://github.com/reflex-frp/reflex

However, FRP is ... unusual, and takes a bit of time to get the hang of.

Here's a stripped-down todo app "tutorial" in Reflex:

https://gist.github.com/mrkgnao/1a5c06cc1e188f2238c8c11cb74e...

And this is a full-featured TodoMVC in Reflex:

https://github.com/reflex-frp/reflex-todomvc

--

FLTK is a GUI toolkit that has Haskell bindings. It's a very C++-like API, but the library is in heavy development.

https://github.com/deech/fltkhs

The developer is also quite friendly, and I believe there are good docs. Here are a few demos:

https://github.com/deech/fltkhs-demos

Also, GHC does have a C backend, afaik, although it's deprecated nowadays and only available if you build it yourself in "unregisterised mode", which people do when porting GHC to a new architecture.

Re:Making a GTK Video Player with Haskell by nickpsecurity on Sunday September 03, 2017 @01:02PM (#15162503)
Red uses DSL's to make it pretty easy. It's a REBOL-like language that's easy to parse and macro kind of like LISP. Here's an early demo of how that looks with examples:

http://www.red-lang.org/2016/03/060-red-gui-system.html

I don't know Haskell but I know Galois does DSL's like Ivory language with it. So, I imagine doing something like Red's GUI in Haskell would be worth exploring. Alternatively, building such a clean abstraction on top of a cross-platform library with messy stuff generated automatically from DSL version.

Re:Making a GTK Video Player with Haskell by willtim on Sunday September 03, 2017 @01:25PM (#15162621)
Most rich desktop APIs are very imperative and the Haskell bindings are often just a thin veneer on top. For an example of a really nice Haskell UI API, see threepenny-gui:

https://github.com/HeinrichApfelmus/threepenny-gui/blob/mast...

Re:Making a GTK Video Player with Haskell by orbifold on Sunday September 03, 2017 @10:09AM (#15161479)
I think pretty much any Language is a pain to write GUIs in, a single property dialogue in photoshop is ~6k loc in C++...
Re:Making a GTK Video Player with Haskell by progman on Sunday September 03, 2017 @10:22AM (#15161540)
Pascal (Delphi, Lazarus) and Visual Basic are exact counter examples. They demonstrate how easy and convenient GUI development can be.
Re:Making a GTK Video Player with Haskell by tentaTherapist on Sunday September 03, 2017 @03:24PM (#15163323)
I really hope I'm wrong, but if you're talking about VB.NET, then my personal experience with it has been the exact opposite of easy and convenient.

Edit: Okay, good, VB.NET is probably not the Visual Basic you were talking about. Thanks for the history lesson!

Re:Making a GTK Video Player with Haskell by CyberDildonics on Monday September 04, 2017 @12:46PM (#15169335)
Why would some ridiculous plug in API mean that every language is a pain to write GUIs in?
Re:Making a GTK Video Player with Haskell by taeric on Sunday September 03, 2017 @01:08PM (#15162534)
To be fair. Good desktop applications pretty much require teams and are more about user acceptance than metrics you can capture in the type system. Or tests.