11

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.

3
  • 1
    How 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
    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
    Nov 2, 2011 at 7:03
  • 2
    Why 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. Nov 2, 2011 at 19:22

2 Answers 2

8

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.

3
  • I've used SDL before as a C library. How similar is the Haskell version to the C one?
    – Pubby
    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
    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.
    Nov 23, 2011 at 13:19
2

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 :/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.