私がこのコードを持っていると仮定します( 「概要」から簡略化)
{-# LANGUAGE QuasiQuotes, TemplateHaskell, TypeFamilies, OverloadedStrings #-}
{-# LANGUAGE GADTs, FlexibleContexts #-}
import Database.Persist
import Database.Persist.Sqlite
import Database.Persist.TH
import Control.Monad.IO.Class (liftIO)
import Control.Monad.Trans.Resource (runResourceT)
share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persist|
Person
name String
|]
main :: IO ()
main = runResourceT $ withSqliteConn ":memory:" $ runSqlConn $ do
runMigration migrateAll
johnID <- insert $ Person "John Doe"
janeID <- insert $ Person "Jane Doe"
liftIO $ print johnID
liftIO $ print janeID
return ()
input = [Person "John Doe", Person "Jane Doe"]
input
リストを挿入してIDのリストを受け取るにはどうすればよいですか?