Search code examples
haskellghcghci

Was ‘Text.Regex.Posix’ renamed or replaced?


I have the same problem as this question. However, both answers rely on the module Text.Regex.Posix. When I try to import it, I get

<no location info>:
    Could not find module ‘Text.Regex.Posix’
    Perhaps you meant
      Text.Regex.Base (from regex-base-0.93.2@5g5YXZiScrKLs2R8SL8lg0)
      Text.Regex.PCRE (from regex-pcre-builtin-0.94.4.8.8.35@B6GE2pWicek5lhKiWDiitR)

I've tried installing regex-posix as suggested in this answer, but the module still can't be found. So I was wondering if the functionality of Text.Regex.Posix was moved to the suggested modules Text.Regex.Base and Text.Regex.PCRE. My GHCi version is 7.10.3.

I'm a beginner in Haskell, so I might be missing something trivial.


Solution

  • When you install a package, make sure you are installing it to the appropriate location (globally, or in a sandbox). If cabal detects a sandbox, it will automatically install the package there (and it should say something to the effect of "detected sandbox at path/to/sandbox".)

    You can always check which packages are installed in the global package index by running ghc-pkg list, or if cabal is using a sandbox, then cabal sandbox hc-pkg list.

    Once you find out which package index cabal is using to compile a particular program, you can verify in the Hackage documentation that the desired functionality is present in the version you have installed.