5 ms·
I'm still waiting for his in depth article about his experiences while porting Wolfenstein to Haskell - mainly to see if it's worth learning Haskell. Beacause a
by kybernetyk 13y ago
I'm still waiting for his in depth article about his experiences while porting Wolfenstein to Haskell - mainly to see if it's worth learning Haskell. Beacause as he said in the video: Most examples in books (I guess that counts for evangelization blogs too) are toy examples. And I'd like to know how viable the language is for bigger systems.
- steveklabnik 13y agoYou should check out Real World Haskell, it's much more practically focused than other things.
- vbs_redlof 13y agoThis book is starting to show it's age, lots of the examples are broken.
- thirsteh 13y agoThis is highly anecdotal, but I've built and been part of very practical/non-theoretical, large Haskell projects (100k+ lines, which is a lot for Haskell). The only big complaint I have is that it's somewhat hard to do loose coupling, i.e. for something somewhere to reference a type without either redeclaring the type (when that's possible), or having a huge, centralized Types.hs that declares all the types that are used in different places (to avoid cyclic imports.) (Contrast with e.g. Go or ML where you have interfaces/modules without 'implements'.) This isn't unique to Haskell by any means, but it's the only real complaint I have about Haskell as a language for non-toy projects. The benefits definitely make it my go-to language. It's hard to list them all, but by far the nicest feeling is the correctness: when your code compiles, 60% of the time your program works every time. (Not to imply that tests aren't necessary--QuickCheck is great for that.) It's an otherworldly feeling to write a program not in terms of what to do, but what kinds of filters you want to put on something, and have it just work (and either stay working, or break future compiles if something's changed!) after compiling 10 lines of code, when you would have written at least 50-70 and had to debug it in almost any other language. Edit: I'll add another complaint: Haskell is like C++ in that it's incredibly easy for a codebase to become completely unmanageable if your team doesn't have a common style/discipline. Go is a nicer language for "average"/"enterprise" teamwork, I think, since it almost forces you to write programs in a way everyone will understand. If you're in a team with good programmers that you trust not to abuse the language, this is a non-issue. Edit: Okay, another one: If you change your Types.hs, the recompilation can take a long time in a large codebase, similar to C++. But GHC/Cabal keep getting faster. Think that's it.
- evincarofautumn 13y agoHave you tried .hs-boot files for separate compilation with circular dependencies? It’s not bad, but it does lead to some extra crapwork when changing interfaces, much like with C++ headers.
- thirsteh 13y agoI haven't, and it does look pretty cumbersome. So far a couple of Types.hs, i.e. for functionally separate components, have worked out fine, but I'll check it out if that becomes unwieldy.
- Dewie 13y agoHow long does it take to compile the whole codebase? If you know.
- thirsteh 13y agoMy biggest project probably takes about 5-7 minutes to compile in dev mode (no optimizations), and about 15-20 minutes with -fllvm and -O2 on a not-super-beefy i7 laptop (I haven't really timed it recently.) It's not noticeable in general, since only the Types.hs affect many different files, and they're rarely changed. Also, 99% of the compiles are partial, i.e. only the files that have changed (or dependencies of them) are recompiled. Partial compiles don't feel slower than ones on my smaller Haskell projects. Is it annoying compared to e.g. Go? Definitely. But it isn't ruining my life. And there's a lot of optimization, fusion particularly, that goes on in the background.
- rybosome 13y agoYou frequently mention nice things about Go in comparison to Haskell. I'm learning Go at the moment, and must admit that I find myself struggling to stay motivated. Given your background in FP (and apparent enjoyment), what do you find appealing about Go?
- 13y ago
- ghc 13y agoI think it would be fair to say that Wolfenstein would qualify as a relatively small system in Haskell. Haskell's own compiler, GHC is a highly complex system and one of the most sophisticated compilers in existence. The source is free, so it's a great way to see what Haskell looks like when used for large applications in the hands of experts. If you want to see where Haskell is being used in industry, check the Haskell in Industry page out: http://www.haskell.org/haskellwiki/Haskell_in_industry http://www.haskell.org/haskellwiki/Haskell_in_industry And if you really just want to see what it is like for game development, check out Frag: http://www.haskell.org/haskellwiki/Frag http://www.haskell.org/haskellwiki/Frag Haskell is very well suited to large applications in my personal experience. My feeling is that it is actually worse for small-scale applications where you don't need the type system guarantees it provides.
- nicolast 13y ago> The source is free, so it's a great way to see what Haskell looks like when used for large applications in the hands of experts. I tend to disagree with this. Yes, GHC is a large application and most certainly developed by experts, but it's also a project with a very long history, whilst Haskell (language, extension, conventions,...) have changed over the years, and this shows in several places. Next to that, GHC code isn't very idiomatic at times (e.g. for performance reasons, or because it can't depend on too many external high-level libraries).
- orclev 13y agoSince GHC is bootstrapped by a lower stage compiler I'd imagine there are some limitations to what kinds of language features at least parts of it can use as well. I haven't looked into all the details, but last time I did look into building GHC from scratch I remember there being an initial step where you built an initial minimal Haskell compiler that was written in I think C--, and then used that to build the rest of GHC.
- binarycrusader 13y agoThis is where I'm at with Go. Go seems to have been used in lots of networking-related scenarios, but I have yet to see either a major graphical application or even well-known open source game written in it yet. I would love to see what the architecture of a 3D renderer looks like in Go, as an example. Like you, I also share the same interest with Haskell.
- bdg 13y agoI've been using the xmonad window manager, which is roughly 1000 lines. While not a vastly complex system, it's non-trivial, especially solving things like gui interaction in a side-effect free world. I believe they had to use some sort of zipper structure for the mouse detection to overcome things that are easy in other languages.
- anaphor 13y agoI wouldn't say zippers are really "overcoming" anything, they're very nice and elegant data structures, particularly because any data type has an associated zipper form.