Could not find module ‘Text.Regex.Posix’

我们两清 提交于 2020-01-02 00:58:10

问题


I want to try doing regexes in GHCi. I tried loading the module

 :mod +Text.Regex.Posix

But got this error instead

<no location info>:
    Could not find module ‘Text.Regex.Posix’
    It is not a module in the current program, or in any known package.

But I should have Text installed

ghc-pkg find-module Text.Regex.Posix would give me

/usr/local/Cellar/ghc/7.8.4/lib/ghc-7.8.4/package.conf.d
/Users/a/.ghc/x86_64-darwin-7.8.4/package.conf.d

What do I do?

I have no problem with this though:

import Text.Read

Why?


回答1:


The problem is that you simply don't have the regex-posix package installed. This is the package that exports the Text.Regex.Posix module. Text.Read is exported by the base package which comes with every Haskell distribution.

You can see this by running ghc-pkg find-module Text.Read. To install the regex-posix package globally run the command cabal install regex-posix. If you don't want to install it globally or run into problems getting it to install, it would be better to try installing it with the same command in a sandbox after running cabal sandbox init in the directory of your choice.



来源:https://stackoverflow.com/questions/29563020/could-not-find-module-text-regex-posix

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!