Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I found this:


But.. I've never used it, so I don't know what whether it is much good. Anybody has proposals?

Basic requirements:

  • serialize as many data structures used typically in both languages as possible, have no problem with nesting
  • as reliable/unbuggy as possible
  • high performance is nice to have, but not critical
  • as simple as possible to use, but not simpler
share|improve this question
I haven't used it either but I have heard good things about msgpack. Another contender is protobuffs, I have used them in C# and they worked fairly well for my use cases. –  stonemetal Feb 7 '13 at 14:14
The last three are the same requirements as used for every program. –  DeadMG Feb 7 '13 at 14:14
@DeadMG: and yet they are not met in every program, or fulfilled to varying degrees, hence explicit specification. –  mrkafk Feb 7 '13 at 14:23
Python and haskell communication, both ways? –  Jimmy Hoffa Feb 7 '13 at 15:33
I'd recommend msgpack if you want performance or JSON otherwise. I haven't used protocol buffers with Haskell, but I would imagine it would work quite nicely, being typed. It has a space advantage, but be sure to benchmark it: I've come across protocol buffers implementations that are slower than JSON. –  dan_waterworth Feb 7 '13 at 16:08
add comment

closed as not a real question by Robert Harvey, Glenn Nelson, Walter, MichaelT, Martijn Pieters Feb 7 '13 at 17:27

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

I can't speak for that msgpack you linked, but the haskell usage looks quite simple and it sounds performant, I would definitely give it a shot until I found it inadequate.

Also there is protobuff which is a great protocol and haskell has a lib for it here: http://hackage.haskell.org/package/hprotoc

Alternatively you can always just use a more common serialization format: JSON is well supported on both sides.

If you are familiar with Attoparsec, and have a limited object structure you want to send back and forth, you could write your own Attoparsec parser in very quickly on the haskell side, but if it needs to go the other way too you would then have to do similar on Python which would take a lot more work.

I would generally avoid hand-writing this though if it were me, JSON is well supported and protobuff is a good standard as well (though I've not used it in Haskell so I can't vouch for the quality of it's APIs in Haskell)

share|improve this answer
add comment

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