Making a GTK Video Player with Haskell
lettier.github.io
lettier.github.io
I guess Haskell just doesn't do much to solve the problem of setting up GUIs, at least when it has to interface with a framework like Gtk+.
Overall there's going to be some unavoidable "setup gunk" though. You could make some of the code nicer, but the application is pretty small. For such a small little thing, I think abstracting away any further might end up in too much fluff, anyway.
It doesn't seem to be the case here as it's mostly setting up callback methods according to my limited understanding of haskell.
Extract method is probably one of the most abused refactoring patterns around. As you correctly point out, there is no benefit for extracting single use functions and then leaving the code like that. It's just trading one set of notation (function names) for another (comments), while at the same time allowing you to confusingly arrange the code out of execution order.
You want to extract functions in order to reason about execution. You do this by exposing state in the form of the return values from the functions you have created. Whether you write unit tests, or (in a language like Haskell) use it to enforce type contracts, the point is that you have a tool for detecting when the inputs and outputs aren't matching up. This allows you to much more quickly zero in on defects.
There are a couple of caveats with this. First, some people read code linearly no matter what they are doing. Especially programmers without much experience often play computer (with or without a debugger) instead of reasoning using larger abstractions. Quite frequently the benefit of factoring code is lost because of this. It's important to understand the techniques that your team uses before you stick the code in the proverbial food processor.
Secondly, the main benefit of this kind of access is when you are restructuring code. The idea is that (to paraphrase Micheal Feathers) you put some of the code in a kind of vice, while you move the other code around. By exposing state, you can detect when the code you put in the vice starts to slip around. Many, many, many teams do little or no refactoring/restructuring of code. Some teams even have rules for limiting edits, because they feel that this will reduce breakage. On such teams, the effort of exposing state will be worthless.
Since when does initialising the GUI framework include all of your business logic and if it does should a non trivial application have a main function that is several thousands of lines long?
Most people who use it aren't aware it's written in Haskell!
I implemented a fractal zoomer, but it might be too simple to meet your vague "fully formed": https://github.com/serprex/Fractaler
elm: https://en.wikipedia.org/wiki/Elm_(programming_language)
purescript: http://www.purescript.org/
postgREST: https://postgrest.com/en/v4.1/
Trending stuff on github: https://github.com/trending/haskell?since=monthly
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?
Edit: Okay, good, VB.NET is probably not the Visual Basic you were talking about. Thanks for the history lesson!
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.
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.
https://github.com/HeinrichApfelmus/threepenny-gui/blob/mast...
1. The open source SQL parser - HsSqlPpp https://github.com/jakewheat/hssqlppp, 35700 LOC + 3900 LOC of tests
2. The compiler and optimizer (proprietary) is roughly 55,000 Haskell LOC
Edit: And we use Pandoc and Quickcheck internally for a bunch of different things
I think it's hard to find many modern applications (I.e. some software package with a UI) made in anything outside of a few choice languages like JS, C++, C#, or Swift.
And there is/was a tiling window manager, but everyone I know who used it at some point migrated away because the configuration was Haskell as well.
Still use it with gnome and it's the only reason I can half read Haskell!