将persistent-mongoDB-2.9.0添加到堆栈项目时生成错误

我的系统和环境是:

操作系统:

ProductName:    Mac OS X
ProductVersion: 10.14.6
BuildVersion:   18G95

堆栈:

Version 2.1.3,Git revision 0fa51b9925decd937e4a993ad90cb686f88fa282 (7739 commits) x86_64 hpack-0.31.2

GHC:

The Glorious Glasgow Haskell Compilation System,version 8.6.5

我在package.yaml中添加了以下依赖项:

executables:
  example-app-exe:
    main:                Main.hs
    source-dirs:         app
    ghc-options:
    - -threaded
    - -rtsopts
    - -with-rtsopts=-N
    dependencies:
    - example-app
    - yesod
    - persistent >= 2.9 && < 3.0
    - persistent-mongoDB >= 2.9 && < 3.0

stack build提示我以下错误:

persistent-mongoDB> configure
persistent-mongoDB> Configuring persistent-mongoDB-2.9.0...
persistent-mongoDB> Warning: Packages using 'cabal-version: >= 1.10' must specify the
persistent-mongoDB> 'default-language' field for each component (e.g. Haskell98 or Haskell2010).
persistent-mongoDB> If a component uses different languages in different modules then list the
persistent-mongoDB> other ones in the 'other-languages' field.
persistent-mongoDB> build
persistent-mongoDB> Preprocessing library for persistent-mongoDB-2.9.0..
persistent-mongoDB> Building library for persistent-mongoDB-2.9.0..
persistent-mongoDB> [1 of 1] Compiling Database.Persist.MongoDB
persistent-mongoDB> 
persistent-mongoDB> /private/var/folders/1b/8z8bqn7s4l552fg3fpkkgnwr0000gn/T/stack16982/persistent-mongoDB-2.9.0/Database/Persist/MongoDB.hs:811:17: error:
persistent-mongoDB>     Not in scope: type constructor or class ‘FilterValue’
persistent-mongoDB>     |
persistent-mongoDB> 811 |              -> FilterValue a
persistent-mongoDB>     |                 ^^^^^^^^^^^
persistent-mongoDB> 
persistent-mongoDB> /private/var/folders/1b/8z8bqn7s4l552fg3fpkkgnwr0000gn/T/stack16982/persistent-mongoDB-2.9.0/Database/Persist/MongoDB.hs:885:41: error:
persistent-mongoDB>     Not in scope: type constructor or class ‘FilterValue’
persistent-mongoDB>     |
persistent-mongoDB> 885 | toValue :: forall a.  PersistField a => FilterValue a -> DB.Value
persistent-mongoDB>     |                                         ^^^^^^^^^^^
persistent-mongoDB> 
persistent-mongoDB> /private/var/folders/1b/8z8bqn7s4l552fg3fpkkgnwr0000gn/T/stack16982/persistent-mongoDB-2.9.0/Database/Persist/MongoDB.hs:888:7: error:
persistent-mongoDB>     Not in scope: data constructor ‘FilterValue’
persistent-mongoDB>     Perhaps you meant variable ‘filterValue’ (imported from Database.Persist)
persistent-mongoDB>     |
persistent-mongoDB> 888 |       FilterValue v   -> DB.val $ toPersistvalue v
persistent-mongoDB>     |       ^^^^^^^^^^^
persistent-mongoDB> 
persistent-mongoDB> /private/var/folders/1b/8z8bqn7s4l552fg3fpkkgnwr0000gn/T/stack16982/persistent-mongoDB-2.9.0/Database/Persist/MongoDB.hs:889:7: error:
persistent-mongoDB>     Not in scope: data constructor ‘UnsafeValue’
persistent-mongoDB>     |
persistent-mongoDB> 889 |       UnsafeValue v   -> DB.val $ toPersistvalue v
persistent-mongoDB>     |       ^^^^^^^^^^^
persistent-mongoDB> 
persistent-mongoDB> /private/var/folders/1b/8z8bqn7s4l552fg3fpkkgnwr0000gn/T/stack16982/persistent-mongoDB-2.9.0/Database/Persist/MongoDB.hs:890:7: error:
persistent-mongoDB>     Not in scope: data constructor ‘FilterValues’
persistent-mongoDB>     Perhaps you meant variable ‘filterValue’ (imported from Database.Persist)
persistent-mongoDB>     |
persistent-mongoDB> 890 |       FilterValues vs -> DB.val $ map toPersistvalue vs
persistent-mongoDB>     |       ^^^^^^^^^^^^
persistent-mongoDB> 
persistent-mongoDB> /private/var/folders/1b/8z8bqn7s4l552fg3fpkkgnwr0000gn/T/stack16982/persistent-mongoDB-2.9.0/Database/Persist/MongoDB.hs:1043:8: error:
persistent-mongoDB>     Not in scope: data constructor ‘PersistArray’
persistent-mongoDB>     Perhaps you meant one of these:
persistent-mongoDB>       ‘PersistError’ (imported from Database.Persist),persistent-mongoDB>       ‘PersistDay’ (imported from Database.Persist)
persistent-mongoDB>      |
persistent-mongoDB> 1043 |   val (PersistArray a)      = DB.val $ PersistList a
persistent-mongoDB>      |        ^^^^^^^^^^^^
persistent-mongoDB> 
persistent-mongoDB> /private/var/folders/1b/8z8bqn7s4l552fg3fpkkgnwr0000gn/T/stack16982/persistent-mongoDB-2.9.0/Database/Persist/MongoDB.hs:1234:55: error:
persistent-mongoDB>     Not in scope: type constructor or class ‘FilterValue’
persistent-mongoDB>      |
persistent-mongoDB> 1234 | data MongoFilterOperator typ = PersistFilterOperator (FilterValue typ) PersistFilter
persistent-mongoDB>      |                                                       ^^^^^^^^^^^
persistent-mongoDB> 

我正在猜测某些缺失或错误的依赖关系?不过,我无法弄清楚。

我试图将persistent的依赖关系更改为>= 2.10而不是>= 2.9,但这会导致不同的问题。

如果将persistent-mongoDB的依存关系更改为< 2.9,我似乎会与persistent-mongoDB本身的依存关系发生冲突。另外,如果不是绝对必要,我真的不想使用旧版本。

任何帮助将不胜感激。

wang312627 回答:将persistent-mongoDB-2.9.0添加到堆栈项目时生成错误

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3145994.html

大家都在问