Would you use haskell to build a database? Or is Rust/C++ a better fit?

I’m trying to pick a language for a project I’m working on. Think of something like distributed redis with more persistent data structures and a schema. If you had to pick, would you build something like this with Haskell or would you stick with something like Rust or C++? Especially considering the query language for the database is more functional (term level haskell-like).

1 Like

For everything except the low level memory-management features of a DB, I think Haskell is a great choice.

For working with a DB’s own notion of a page table, etc I think there are possibly better languages to write a custom allocation system in, track pages, etc. However, I would probably not want to write that stuff at all and lean instead on binding to something like LMDB or BerkeleyDB for managing the storage layer operations.

3 Likes

That makes sense. Thanks

Haskell has a foreign function interface to C. So you could presumably do what you want in C and interface between the two languages with the FFI

1 Like

I agree with the two-pronged approach. For the data layer: If you like Haskell you have found a way to embrace compile time errors. Congratulations! Unlike what might be “a bad reputation” for ease of use, you will likely find yourself being pretty productive on short-order in Rust. That was my experience. Perhaps check out crates.io to get a feel for how quickly you might be able to jump-start the effort.

1 Like