0
fpcomplete.com에서 예선 양식 사용에 대한 자습서를 읽었습니다 : https://www.fpcomplete.com/school/advanced-haskell/building-a-file-hosting-service-in-yesod/part%202?show=tutorials. 튜토리얼을 바탕으로 내 주요 기능입니다runSqlite 및 newTVar에서 형식이 일치하지 않습니다.
main = do
titems <- atomically $ newTVar []
liftIO $ warpEnv (Links titems)
내가 메모리는 SQL 데이터베이스를 시작하면됩니다 다음 메모리에 양식에서 모든 데이터를 입력하고 싶습니다. 그러나 심지어 아주 간단한 예는 작동하지 않습니다
main = runSqlite ":memory:" $ do
-- runMigration migrateAll
-- michaelId <- insert $ Person "Michael" $ Just 26
-- michael <- get michaelId
-- liftIO $ print michael
titems <- atomically $ newTVar []
liftIO $ warpEnv (Links titems)
을 내가 오류가
src/[email protected]:13-39:36Couldn't match expected type `SqlPersistT
(Control.Monad.Logger.NoLoggingT
(Control.Monad.Trans.Resource.ResourceT m0))
t0'
with actual type `IO (TVar [a0])'
In a stmt of a 'do' block: titems <- atomically $ newTVar []
In the second argument of `($)', namely
`do { titems <- atomically $ newTVar [];
liftIO $ warpEnv (Links titems) }'
In the expression:
runSqlite ":memory:"
$ do { titems <- atomically $ newTVar [];
liftIO $ warpEnv (Links titems) }
입니다 어떻게 든 유형은 내가 위해 사용해야 할 것입니다 무슨 기능이 있는지 일치가 아닌 것으로 알고 있습니다 그것을 해결하기 위해. 누군가가 나에게 무엇이 일어나는지 설명 할 수 있다면 크게 감사 할 것입니다.