У меня проблема при попытке удалить полную таблицу в sqlite, может кто-нибудь мне помочь?
код:
{-# LANGUAGE OverloadedStrings #-}
import Control.Applicative
import Database.SQLite.Simple
import Database.SQLite.Simple.FromRow
data TestField = TestField Int String deriving (Show)
instance FromRow TestField where
fromRow = TestField <$> field <*> field
main :: IO()
main = do
conn <- open "db1.sqlite"
execute conn "DROP TABLE tabela"
close conn
Возврат ошибки:
delete.hs:14:3: error:
• Couldn't match expected type ‘IO a0’
with actual type ‘q0 -> IO ()’
• Probable cause: ‘execute’ is applied to too few arguments
In a stmt of a 'do' block: execute conn "DROP TABLE tabela"
In the expression:
do { conn <- open "db1.sqlite";
execute conn "DROP TABLE tabela";
close conn }
In an equation for ‘main’:
main
= do { conn <- open "db1.sqlite";
execute conn "DROP TABLE tabela";
close conn }
Failed, modules loaded: none.