haskell - 使用 Haskell/Persistent 连接到 Sqlite3 数据库

标签 haskell sqlite libraries hackage

请原谅这个问题多么简单。

谷歌搜索,the documentation , 和 the Yesod book似乎只解释了如何数据库做事,但我还没有看到关于如何实际连接到一个数据库的直接解释。

如能提供正确方向的帮助或指导,我们将不胜感激。

编辑:我simplified the code sample来自 Yesod 书,使其更易于阅读和使用。

最佳答案

持久包的“主页”有一个示例显示如何连接到内存中的 sqlite 实例:

http://www.yesodweb.com/book/persistent

似乎您只需更改 withSqliteConn 调用即可。

关于haskell - 使用 Haskell/Persistent 连接到 Sqlite3 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13552721/

相关文章:

haskell - 在 haskell 中使用 foldl 时不需要参数?

javascript - 为什么不在 2017 年将 Array.prototype 方法添加到 NodeList.prototype 中?

python - 如何在 python 项目中包含库依赖项?

c++ - 在头文件中定义所有库是不好的做法吗?

haskell - 为什么一个简单的 Python/Haskell/etc 程序在导入时会卡住/挂起?

Haskell:过滤器应用于太多参数

java - 创建的数据库出错

javascript - javascript 中的异步等待 sqlite

ios - 在 iOS 中存储两个用户定义的字符串

list - 如何更新 Haskell 中的列表元素