Encountering error while adding MaybeT dependency

2020-04-14 02:47发布

问题:

I am following this tutorial webScrapper using HXT. I am using Stack here.

While adding dependency for MaybeT, it asked to:

Recommended action: try adding the following to your extra-deps in /Users/***/Haskell Development/Scrapper/stack.yaml: - MaybeT-0.1.2

Now doing so to ended up with this message on running stack build:

In the dependencies for MaybeT-0.1.2: base-4.9.0.0 must match <4.8 (latest applicable is 4.7.0.2) needed due to Scrapper-0.1.0.0 -> MaybeT-0.1.2

Being new to Stack, I am unable to solve the problem, in my cabal file the the dependency:

  build-depends:       base >= 4.7 && < 5
                    ,  hxt
                    ,  url
                    ,  HTTP
                    ,  MaybeT

In stack.yaml

resolver: lts-7.12
extra-deps: [MaybeT-0.1.2]

What is it that I have missed. How can I solve this?

回答1:

The solution for your concrete problem is switching from the outdated MaybeT package to the MaybeT transformer offered by the transformers package in Control.Monad.Trans.Maybe.


That said, note that the version mismatch involves base. If you actually needed to use the MaybeT package, you would have to switch the Stack resolver to a snapshot such as lts-6.26, which uses base-4.8 or below (i.e. GHC 7.10.3 or below). base versions are coupled to GHC versions, and everything else depends on base, so there is no easy way of switching just base to an older version, as it might be possible, given some luck, with other packages.