Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cereal versus Binary

The two major competing packages for serializing and deserializing data in Haskell that I am aware of are binary and cereal. When should one choose one of these packages over the other? Or are there other choices that I am neglecting?

like image 998
Gregory Crosswhite Avatar asked Feb 02 '13 02:02

Gregory Crosswhite


1 Answers

They aren't competing, they are complementary. cereal works on strict bytestrings while binary works on lazy. Because of its lazy nature, binary depends on throwing an exception on parse error while cereal can fail via Either.

Also, to imply there are "only" two main packages is a misrepresentation. At the very least you should look at blaze-builder too.

like image 165
Thomas M. DuBuisson Avatar answered Sep 21 '22 17:09

Thomas M. DuBuisson