4

Python has this magical shelve which is like a dict except it's automatically backed by a file. It allows you to persist a large data structure between runs of a program. The really amazing thing is that it doesn't even load the whole thing from disk each time you run but waits for you to ask for a key and then gives you just that key's value.

So, the obvious question: Can Haskell compete?

Michael Fox
  • 3,632
  • 1
  • 17
  • 27
  • 5
    Haskell programmers rarely want things, especially I/O things like saving and loading, to happen transparently (i.e. automagically). Idiomatic Haskell code explicates I/O. There are powerful file-backed stores; `acid-state` jumps to mind. But none are "magical," for many reasons. (Among other things, idiomatic Haskell data structures are often infinite!) – Christian Conkle Oct 03 '14 at 21:54
  • 2
    Not just infinite, but immutable! The value of a transparent write-through cache to disk seems pretty pale when writes aren't allowed. – amalloy Oct 03 '14 at 22:22

1 Answers1

3

Persistent along with one of it's more general backends like map, refs, protobuf, or cereal?

  • 3
    None of the "backends" you link to are actually backends. Two aren't related to `persistent`; the others are helpers (and out of date). Michael may be interested in `persistent-sqlite` though. – Christian Conkle Oct 03 '14 at 22:02
  • I played with Persistent and the thing I don't like is that you have to define a SQL table structure though I think with more effort I think you could make a table with columns that look like an Aeson Value. However, since my use case is read heavy, write rarely, I find that Cerial and Map meet my needs. – Michael Fox Oct 24 '14 at 21:42