madmonk
madmonk

Reputation: 25

haskell stack won't install dates

In a standalone module I'm using the dates package http://hackage.haskell.org/package/dates installed via cabal and it works fine. But a problem emerges when I try to make a small package out of this module using stack. The dates package is appropriately listed in dependencies and all but it doesn't work. When I try to manually install the package using stack in the project sandbox, I get the below error. Meanwhile I can install this package with cabal outside the stack sandbox without issues.

VERSIONS IN THE SANDBOX: ghc-8.4.3 stack-1.7.1

SYSTEM VERSIONS: ghc-8.0.2 cabal-1.24.0.2 (compiled 1.24.2.0)

error message:

Configuring dates-0.2.2.1...
Preprocessing library for dates-0.2.2.1..
Building library for dates-0.2.2.1..
[1 of 4] Compiling Data.Dates.Internal ( Data/Dates/Internal.hs, .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/Data/Dates/Internal.o )
[2 of 4] Compiling Data.Dates.Types ( Data/Dates/Types.hs, .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/Data/Dates/Types.o )

/tmp/stack16211/dates-0.2.2.1/Data/Dates/Types.hs:62:10: error:
    • No instance for (Semigroup DateTime)
        arising from the superclasses of an instance declaration
    • In the instance declaration for ‘Monoid DateTime’
   |
62 | instance Monoid DateTime where
   |          ^^^^^^^^^^^^^^^

Upvotes: 0

Views: 130

Answers (1)

madmonk
madmonk

Reputation: 25

In the end I needed to change the resolver in the stack.yaml file to an older version (lts-8.24) which would enforce the use of ghc-8.0.2. Using

stack --resolver ghc-8.0.2 setup/build

did not prevent stack from using the latest ghc version when I did

stack exec blah-exe

which raised the conflict.

Upvotes: 1

Related Questions