Re:Is Haskell a Good Choice for Web Applications? (2009)
by ps8ed on Friday December 02, 2011 @05:03AM
(#3303413)
Also, if you aren't wedded to SQL, Haskell now has acid-state, a memory resident database written in Haskell (formerly happstack-state).
Re:Is Haskell a Good Choice for Web Applications? (2009)
by gujk on Friday December 02, 2011 @11:03AM
(#3304364)
How does a memory resident database satisfy the D in ACID?
Re:Is Haskell a Good Choice for Web Applications? (2009)
by jfoutz on Friday December 02, 2011 @01:29PM
(#3305060)
IIRC happstack-state has a journaling system. You don't have the state on disk, but you can reconstruct it. you could also journal to a remote machine for a live failover.
Re:Is Haskell a Good Choice for Web Applications? (2009)
by scottostler on Friday December 02, 2011 @01:28PM
(#3305054)
Presumably it writes to a transaction log, and is memory-resident in the same sense that Redis is. Which is to say that the dataset is kept entirely in memory, but also has a persistent representation on disk.
One of the points of critique has been addressed now is database access. For instance, Persistent provides type-safe database access:
http://www.yesodweb.com/book/persistent
The author also mentions the problem that exceptions can only be caught in the IO monad. But this has become less of a problem, since more people started using monad transformers (such as ErrorT) to add error handling to their monads. ErrorT allows you to catch exceptions within that monad. For instance, quoting from one of my own projects:
readEntry is a function that takes a Corpus and a String, and returns Text in a monad of the class MonadIO if the function is successful. Otherwise it reports errors in the form of a CorpusError. You could now, for instance, run this function with runErrorT, and it will return an ordinary Either value in the given monad (Left CorpusError in the case of an error, Right Text when the call is successful).