Closed amano-kenji closed 1 year ago
This question has a relevant discussion. One unique point about SQLite is that it is itself dynamically typed unlike PostgreSQL. This would make a Squeal adaptation of SQLite less straightforward and useful.
Which libraries would you recommend for SQLite?
I've used sqlite-simple with good effect in the past. It's probably what I'd reach for if I was working on a commercial project. But if you want something more Squeal-like, it looks like both Selda and Beam have SQLite backends. For a personal project, those might be more interesting to play with.
How does sqlite-simple compare with higher abstraction libraries like squeal?
In use it's sort of similar to using Squeal or feels so to me, but with much less compile time checking, which sometimes necessitates more testing. A lot of the abstractions in Squeal are meant to allow you to compose together a Query
(or a Manipulation
), where in sqlite-simple, the Query
type is most often constructed as a literal SQL string.
-- Squeal --
type DB = '["public" ::: '["tab" ::: '["col" ::: 'NotNull 'PGint4]]]
session :: PQ DB DB IO ()
session =
manipulate_ $ insertInto_ #tab (Values (1 `as` #col) [2 `as` #col, 3 `as` #col])
-- sqlite-simple --
session :: Connection -> IO ()
session conn =
execute_ conn "INSERT INTO tab(col) VALUES (1), (2), (3);"
Okay. I am satisfied. Closing this.
Is SQLite support planned? Or, is there something like squeal for SQLite?
It seems squeal is at the right level of abstraction, but I want to use SQLite.
I want to write SQL in haskell constructs.