Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I can easily write you pickle in Haskell. In fact you can easily embed Python's single type in Haskell and thus do everything you can do in python.

The difference to Java has nothing to do with reflection, really, but rather with a uniform object representation (in Java you know the shape of all values by default).



I don’t believe one can write pickle.load in Haskell. Please show me how!

A Java pickle.load would need to lean heavily on its dynamic features including reflection. For example, looking up a class by name.


Have a look at this typeclass, for instance:

https://hackage.haskell.org/package/base-4.12.0.0/docs/Type-...

If that's to complicated, just create an ADT of all the python values and translate Pickle's implementation directly.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: