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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With