Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL with Haskell

Tags:

mysql

haskell

I'm C# developer and I'm learning Haskell right now. I want to rewrite one of my projects in Haskell just for fun. In this project I have some work to do with MySQL so I want to ask: what is the best tool to use MySQL in Haskell. Also it will be awesome to look at some code how can I use it (I have Windows 7).

like image 882
franza Avatar asked Nov 14 '11 05:11

franza


2 Answers

There are plenty of different bindings and libraries for interaction with databases in Haskell, most of them are described on the Haskell wiki.

If you're looking for a relatively simple binding to MySQL, then I'd recommend you have a look at either of the following:

  • HDBC
  • mysql-simple

There's a good chapter on how to use the HDBC interface in the Using Databases chapter of the Real World Haskell book, which should be enough to get you started: there are plenty of examples of code there.

like image 85
Nicolas Wu Avatar answered Oct 27 '22 21:10

Nicolas Wu


Also if you are interested in a more high-level library, take a look at HaskellDB. I also wrote a tutorial on how to set it up in here. And also chrisdones' HaskellDB: A long tutorial is a good resource.

like image 35
Masse Avatar answered Oct 27 '22 22:10

Masse