0

Using stack version 1.9.3 and GHCI version 8.6.3, I follow these steps:

  • create a new project with stack new "myproject"

  • cd into myproject

  • run stack install regex which returns the following

base-compat-0.10.5: using precompiled package hashable-1.2.7.0: using precompiled package time-locale-compat-0.1.1.5: using precompiled package utf8-string-1.0.1.1: using precompiled package regex-base-0.93.2: using precompiled package unordered-containers-0.2.9.0: using precompiled package regex-pcre-builtin-0.94.4.8.8.35: using precompiled package regex-tdfa-1.2.3.2: using precompiled package regex-tdfa-text-1.0.0.3: using precompiled package regex-1.0.2.0: using precompiled package Completed 10 action(s).

At this point I assume the regex package is correctly installed.

But then in my code when I try to import the regex package with import Text.RE I get the following error

Could not load module ‘Text.RE’ It is a member of the hidden package ‘regex-1.0.2.0’. You can run ‘:set -package regex’ to expose it. (Note: this unloads all the modules in the current scope.) Use -v to see a list of the files searched for.

What am I missing out on ?

duplode
  • 33,731
  • 7
  • 79
  • 150
Lev
  • 13,856
  • 14
  • 52
  • 84
  • 1
    You probably need to edit the generated cabal file of your project to add `regex` as a dependency. – chi Jun 17 '19 at 20:24
  • If you are using stack you probably have a `package.yaml` file, from which the `xxxxx.cabal` file is generated. You can edit the `package.yaml` file to add the dependency, so that `stack build` should work. – chi Jun 17 '19 at 20:53
  • The second suggested question ("How do I add...") addresses the point about `package.yaml` mentioned by chi. – duplode Jun 17 '19 at 21:01

0 Answers0