Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
YesSOD和MySQL连接问题_Mysql_Haskell_Yesod - Fatal编程技术网

YesSOD和MySQL连接问题

YesSOD和MySQL连接问题,mysql,haskell,yesod,Mysql,Haskell,Yesod,我一直在网上寻找一个可以将Yesod-Persistent连接到MySQL数据库的工作示例,我发现了这个 当我使用ghci尝试此代码时,我得到以下错误: Prelude> :l test3.hs [1 of 1] Compiling Main ( test3.hs, interpreted ) test3.hs:35:27: Couldn't match type `persistent-2.2.2.1:Database.Persist.Sql.Type

我一直在网上寻找一个可以将
Yesod
-
Persistent
连接到MySQL数据库的工作示例,我发现了这个

当我使用
ghci
尝试此代码时,我得到以下错误:

Prelude> :l test3.hs 
[1 of 1] Compiling Main             ( test3.hs, interpreted )

test3.hs:35:27:
    Couldn't match type `persistent-2.2.2.1:Database.Persist.Sql.Types.SqlBackend'
                  with `SqlBackend'
    Expected type: Migration
      Actual type: persistent-2.2.2.1:Database.Persist.Sql.Types.Migration
    In the first argument of `printMigration', namely `migrateAll'
    In a stmt of a 'do' block: printMigration migrateAll
    In the second argument of `($)', namely
      `do { printMigration migrateAll }'
Failed, modules loaded: none.
我被困在里面了


我的另一个问题是:有人有Yesod+MySQL的经验吗?如果是,我想知道这是一个好的选择还是一个有问题的选择。

看起来您安装了两个版本的软件包。如果使用Stack安装,它将确保范围内每个包只有一个版本。我在中详细描述了这种情况。

请阅读和@RiggsFolly它可能对其他用户有用,网络上关于这方面的资源很少。没关系,4个其他人必须同意我的观点才能采取行动这里的一个实际问题是:GHC(Haskell编译器)的原因是什么错误消息“无法将类型包foo:Bar与Bar匹配”。
Prelude> :l test3.hs 
[1 of 1] Compiling Main             ( test3.hs, interpreted )

test3.hs:35:27:
    Couldn't match type `persistent-2.2.2.1:Database.Persist.Sql.Types.SqlBackend'
                  with `SqlBackend'
    Expected type: Migration
      Actual type: persistent-2.2.2.1:Database.Persist.Sql.Types.Migration
    In the first argument of `printMigration', namely `migrateAll'
    In a stmt of a 'do' block: printMigration migrateAll
    In the second argument of `($)', namely
      `do { printMigration migrateAll }'
Failed, modules loaded: none.