1

I'm using the Haskell Time Library. I'm trying to use the ISO-8601 date formatters.

In my code, I can import the Data.Time module and use it without any problems. However, when I import the Data.Time.Format.ISO8601 functions and definitions I get the following error: Could not find module.

I'm new to Haskell and I'm not confident in my ability to understand dependencies in the package manager yet. I have a Java oriented background.

Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286
MMacphail
  • 541
  • 3
  • 19
  • What are the installed packages, what does it print for `cabal freeze`? – Willem Van Onsem Aug 09 '18 at 08:51
  • Using cabal freeze returns no dependencies... I guess `my-project.cabal` file is not correctly configured? I put the time library under the : `executable my-project-exe` part in the `build-depends` section. – MMacphail Aug 09 '18 at 09:09
  • Just to be clear running `cabal freeze` only prints `Resolving dependencies...` and nothing else – MMacphail Aug 09 '18 at 11:25
  • 1
    time includes ISO8601 at version 1.9., so you need to figure out if your version number. – trevor cook Aug 09 '18 at 11:42

1 Answers1

2

I finally manage to understand what was going on thanks to Trevor Cook's comment.

Stack pulls dependencies from Stackage by default, which did not contain the latest time package version. So I needed to specify the version to force stack to use Hackage instead of Stackage for my time package resolution by adding an extra-dep in my stack.yaml file:

extra-deps:
- time-1.9.2

After running stack build the compiler was able to find the ISO 8601 Date Format module.

MMacphail
  • 541
  • 3
  • 19