I've been wanting to try out graphics in Haskell. From what I've seen, the available libraries are either front-ends to C/C++ libraries, or an abstraction of them with minimal features. The high-level libraries do not seem to suit my needs, and so I'm left with lower-level front-ends.
What I need is to render tiles and text - basics for a very simple game. I know how to do this with C, and was thinking I could write the graphics in C and interface it with Haskell. The alternative is to write the graphics using a Haskell library.
My question is, can available Haskell libraries achieve what I want? I do not want to bend over backwards; if C can do it better than I would like to know.
-
1How much should be done is unanswerable if you don't tell us what you need be done. How much could be done is a different question, one that might even be on topic.yannis– yannis2011年11月02日 06:01:17 +00:00Commented Nov 2, 2011 at 6:01
-
Hi Pubby8, if you can update your question with what exactly you're trying to do that's got you thinking about this, feel free to flag it for reopening.user8– user82011年11月02日 07:03:15 +00:00Commented Nov 2, 2011 at 7:03
-
2Why not use SDL? It's low-level (for Haskell), yes, but I don't think that writing graphics in C would give you considerable benefits.Anton Barkovsky– Anton Barkovsky2011年11月02日 19:22:44 +00:00Commented Nov 2, 2011 at 19:22
2 Answers 2
SDL is an excellent library with good Haskell bindings—and related libraries for images, audio, and text—for which enough tutorials exist to get you off the ground; being rather low-level, it requires a bit of care to keep things pretty and functional, but in my experience SDL and Haskell make a superb combination.
-
I've used SDL before as a C library. How similar is the Haskell version to the C one?Pubby– Pubby2011年11月03日 02:47:02 +00:00Commented Nov 3, 2011 at 2:47
-
@Pubby8: They’re quite similar. All the Haskell version really does is explicate where
IO
is happening.Jon Purdy– Jon Purdy2011年11月03日 14:07:27 +00:00Commented Nov 3, 2011 at 14:07 -
+1, I second this recommendation. I'm using SDL with Haskell to code a small 2D game, so far with no problems.Andres F.– Andres F.2011年11月23日 13:19:14 +00:00Commented Nov 23, 2011 at 13:19
If you are asking if there is a good C/C++ alternative to haskell that does GUI well, then look no further: http://qt-project.org/
Definitely the strongest GUI framework out there for C++.
If however, your question was "find me something better in haskell" then I can't help you :/