In the paper attached to my last post, I proved that any data store is a monad. Then I proved that if the data was a monoid (so it has a zero and addition) then the store is a monoid too. And then I asserted that if the data is a monad, then so is the store. And said I wasn’t going to prove it.

Well, it didn’t fit in that paper, but I thought it was worth writing down. So, without further ado, I have written a very short note that:

- Describes how any data store can be made into a general monad transformer
- Shows how, in the case of the trivial monad, this reduces to the simple storage monad described in the other post
- Shows that if the underlying data is an additive monad, then so is the data store (which is basically just saying that it’s a monoid with >>=).

And here it is: note on storage as a monad transformer.

### Like this:

Like Loading...

*Related*

## Published by Julian Porter

Mathematician, Philosopher, Musician, Writer, Computer Scientist. Whatever I do I do it with passion, if not well.
View all posts by Julian Porter

This is very useful; I am experimenting with monads for storing data (ultimately in some kind of a database–I’m a reformed JEE guy) in Scalad with a little help from Scalaz monads.

In that case you might want to look here: Distributed storage in Haskell. In this I introduce the basic storage monad and show that (a) if the data is a monoid then so is the store, (b) if the data is a monoid, it doesn’t matter whether you do monoidal addition on the data or the store.

If you’re interested in the database angle, something I would like to do is to convert the simple in-memory store described in that paper to a store backed by a database.