{-# LANGUAGE TemplateHaskell #-}
module Database.SQLite.Simple.QQ
( sql
) where
import Data.String (fromString)
import Database.SQLite.Simple.Types (Query)
import Language.Haskell.TH (Exp, Q, appE, stringE)
import Language.Haskell.TH.Quote (QuasiQuoter (..))
sql :: QuasiQuoter
sql = QuasiQuoter
{ quotePat = error "Database.SQLite.Simple.QQ.sql: quasiquoter used in pattern context"
, quoteType = error "Database.SQLite.Simple.QQ.sql: quasiquoter used in type context"
, quoteDec = error "Database.SQLite.Simple.QQ.sql: quasiquoter used in declaration context"
, quoteExp = sqlExp
}
sqlExp :: String -> Q Exp
sqlExp = appE [| fromString :: String -> Query |] . stringE