[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip / qa] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


has anyone here tried game development in haskell? how did it go?
>>
>>100196218
fast haskell is not idiomatic haskell, and idiomatic haskell is not fast enough to do anything but the most basic things
>>
>>100196253
"the most basic things" are 99% of business logic for games though. the parts that need to be performance-critical, such as 3d graphics and physics, already exist as C++ libraries and should be reachable via FFI (which is exceptionally good in haskell)
>>
it would have gone poorly, functional programming isn't useful in the real world, it's a scientific theoretical toy
>>
Games are extremely state-heavy programs, if that makes any sense. You CAN use Haskell for them but it won't
>>
>>100196296
Not him but you are wrong. In most games the scripts for missions and objects that make up the game logic take up a significant amount of CPU (the other big thing being the physics engine).
The Sims 3 for example is CPU bound rather than GPU bound and it doesn't even have any physics.
>>
>>100196485
Mongoloid
>>
>>100196641
point at a GitHub repository for a useful in the real world project written in a functional language that wouldn't have been better served by a real programming language
>>
>>100196710
Discord, but it's closed source
https://github.com/xmonad/xmonad
Various compilers and static analyzers that I forget the name of
Google others if you want, although we both know you won't.
>>
It seems to be masochism.

https://www.fpcomplete.com/haskell/tutorial/lens/
>>
>>100196765
>that wouldn't have been better served by a real programming language
try again
>>
>>100196710
I HATE using Haskell for "real" code, but I will admit that pandoc is bretty gud.
>>
>>100196485
This.
>>
>>100196253
Unironically this, sort of. I've been doing fp for awhile now and honestly just using rust really showed me that what FP really needs is mutable xor shared semantics of Rust. Mutability is fine if you have Rust's aliasing guarantees.
>>
>>100196811
None of this is harder than basic bitch oop autism. Get filtered.
>>
>>100196710
>useful in the real world project written in a functional language
There are none, period.
>>
>>100196824
Give detailed technical information on how using your favorite deprecated language would have made any of those projects better. Be sure to reference discord's extensive writings about how Elixir and Rust were critical to building what they did, and deboonk everything they say. I'm sure you're an expert on all of that.
>>
File: lichess.png (398 KB, 1920x968)
398 KB
398 KB PNG
>>100196485
Nah, functional programming is actually quite useful as long as you're not autistically pure about it.
picrel was written in Scala.
Scala/Clojure/various dialects of ML/erlang/even Common Lisp if you classify that as functional are used quite often in industry, though not much for gamedev.

Haskell's just a toy though. Monads for things like io are theoretically cool but practically retarded, and having state is important.
>>
>>100196631
Sims 3 isn't computationally expensive at all though.
But yes, it depends on the game.

Real time Strategy games are also very c.p.u. bound due to all the pathing.
>>
>>100196856
You did not think of inconvenience and inefficiency, but rather about the level of difficulty.
>>
I don't think I have enough RAM.
>>
>>100197396
HLS isn’t the haskell runtime though
>>100196932
Scala is a pile of shit though and is worse than haskell in every way except for java interop
>>
>>100197646
>HLS isn’t the haskell runtime though
but it is an accurate representative of the haskell DX. haskell tooling is so fucking bad it's unreal
>>
>>100197666
Already fixed
https://github.com/josephsumabat/static-ls
Btw hls works fine for codebases that aren’t massive so most non-AAA games should do finr
>>
>>100196485
Jon Carmack ported Wolfenstein to Haskell as an exercise. He said the biggest drawback of adopting it was everyone would need to learn completely new stuff. I know he said the Haskell solution basically forced double buffering the gamestate which was a source of many bugs in the original implementation. I think he also likes to be a systems programming contrarian though. Some of his other hot takes: Modern games should use garbage collection and "'Game Engines' aren't real. I just write code to make a game"
>>
File: .png (3.72 MB, 1920x1200)
3.72 MB
3.72 MB PNG
>>100196218
No, I haven't. I did use it for some personal projects, but they weren't games, they were command-line programs. It went... okay, but not great.
First, the good. The community is full of very smart people. It's exceptional among programming communities. The average Haskeller tends to know at least one other language well, and be good at math too. Sometimes you can get better Python and C advice from Haskellers than on actual Python and C websites.
The syntax is genuinely nice. Combined with the advanced type system that has features like sum types and GADTs, it can be easier than in other languages to "make invalid states unrepresentable". Some things that you'd enforce with assertions or exceptions in OOP just naturally fall out here.
It turned out that people who say that a purely functional language must be useless, or that it can't do I/O, or that monads are super complicated, are simply morons. They're parroting dumb shit they've heard without having written any Haskell. Haskell can do I/O just fine. Monads were easy to learn and I sometimes miss them in other languages. They can be useful for things like async and parsers.
Now, the bad. People are right that Haskell is academic and impractical, it's just not in the way they claim. The main problem is that the standard library is a joke. It's one of the least "batteries included" standard libraries in any language. It has a ton of ways to slice and dice lists, and little else. It doesn't even have a decent string type. The default string is a linked list of codepoints, and for anything better you need to download the "text" package. No hashtables, no hashsets, no constant-time-access arrays, no path manipulation, the list just goes on. When writing a simple program that would only need the standard library in Python or Java, in Haskell you're going to include half a dozen of external packages and have a wall of imports at the top of your program.
>>
cont. >>100198295
The situation is so bad that there's a dozen alternative standard libraries on the Hackage, and every major Haskell application tends to write its own standard library. Yet... Haskellers somehow don't see the glaring problem, and keep working on ever more super advanced stuff to add to the already advanced type system. That's fun to do, and addressing the standard library situation would be a huge slog: academically trivial but socially difficult. So nobody does it. This is the main thing that made me abandon Haskell and lose hope in the language.
In addition to the "wall of imports" problem, I just found Haskell kind of... unergonomic for everyday programming. It was a lot more annoying than Python or Java when dealing with records that have many fields or with nested records.
I'm also unconvinced about the merits of having lazy evaluation on by default. It not only makes it harder to predict time and space complexity from looking at your code, it also makes debugging worse. I think Python has a better compromise, where almost everything is strict but you also have a dedicated generator mechanism when you want lazy evaluation. Yes, I know that generators are vastly less general than Haskell's laziness, but be honest, how often are you actually using laziness for anything more complex than lists?
So this is my short review of Haskell. In the end, I went back to mainstream languages. Won't respond for 10h because I'm going to sleep now. Tired.
>>
>>100198295
>>100198301
Good analysis
>>
>>100198295
>>100198301
>community
generally true
>advanced type system
a lot more to discuss here but yeah
>terrible stdlib
true
>wall of imports at the top of the file
imo this helps with readability, especially with large projects. maybe I'm coping though
>records suck
you can actually use OverloadedRecordDot and OverloadedRecordUpdate now
>lazy evaluation by default
this was a mistake. however, lazy evaluation applies to a lot more than streaming, and doesn't even do streaming that well (you can't really use it if you need to stream with side effects)
>>
>>100198295
> People are right that Haskell is academic and impractical
self-taught lol
>>
>>100196218
Good thread. OP is not a faggot today. Okay, maybe just a little :)
>>
>>100197072
On my machine it runs slower than GTA V regardless of graphics settings.
>>
>>100199295
Yeah, that's why Haskell is so popular at real companies like Google or Microsoft that only hire people with degrees.
>>
Pity bump for Haskell being garbage.
>>
>>100196765
>last non-ci commit was 5 months ago
>most other parts havent been touched in 2 - 10 years
Impressive
>>
>>100203878
It just werks without fixes
>>
Haskell is a great language held back by a community traumatized by stupid breaking changes. So all the good breaking changes simply never happen.



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.