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.

asked Nov 2, 2011 at 4:41
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. Commented 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. Commented 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. Commented 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.

answered Nov 2, 2011 at 22:08
3
  • I've used SDL before as a C library. How similar is the Haskell version to the C one? Commented Nov 3, 2011 at 2:47
  • @Pubby8: They’re quite similar. All the Haskell version really does is explicate where IO is happening. Commented 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. Commented 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 :/

answered Aug 21, 2012 at 9:44

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.