Earlier quoted context omitted.
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…
I think pretty much any Language is a pain to write GUIs in, a single property dialogue in photoshop is ~6k loc in C++...
Making a GTK Video Player with Haskell
31–40 of 42 posts
Re: Making a GTK Video Player with Haskell
#32Very nice project keep going, would love to see more haskell projects arising from this. Code related: I'm by no means an haskell expert, but your main function in Main.hs looks a bit lengthy, usually i dont see haskell methods with 50+ lines, might be better to split them up and provide names for subfunctions.
Re: Making a GTK Video Player with Haskell
#33Earlier quoted context omitted.
I think pretty much any Language is a pain to write GUIs in, a single property dialogue in photoshop is ~6k loc in C++...
Pascal (Delphi, Lazarus) and Visual Basic are exact counter examples. They demonstrate how easy and convenient GUI development can be.
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
#34Earlier quoted context omitted.
The main function would read pretty much the same in any language. Slicing it into multiple functions doesn't really do anything that couldn't be achieved by adding a few comments. 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+.
If you have good function names, you do not need comment.
Re: Making a GTK Video Player with Haskell
#35Very nice project keep going, would love to see more haskell projects arising from this. Code related: I'm by no means an haskell expert, but your main function in Main.hs looks a bit lengthy, usually i dont see haskell methods with 50+ lines, might be better to split them up and provide names for subfunctions.
The main function would read pretty much the same in any language. Slicing it into multiple functions doesn't really do anything that couldn't be achieved by adding a few comments. 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+.
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?
Re: Making a GTK Video Player with Haskell
#36Earlier quoted context omitted.
If you have good function names, you do not need comment.
If your imperative code is readable and well-commented, why break it up into single-use functions?
It doesn't seem to be the case here as it's mostly setting up callback methods according to my limited understanding of haskell.
Re: Making a GTK Video Player with Haskell
#37Earlier quoted context omitted.
If you have good function names, you do not need comment.
If your imperative code is readable and well-commented, why break it up into single-use functions?
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.
Re: Making a GTK Video Player with Haskell
#38I was hoping this would include an efficient H 265 decoder written in Haskell. That would have been neat.
Re: Making a GTK Video Player with Haskell
#39Re: Making a GTK Video Player with Haskell
#40Is there any fully formed application made with Haskell out there?
Here are a few: 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