Haskell: 'No instance for' arising from a trivial usage of Regex library
- by artemave
Following the (accepted) answer from this question, I am expecting the following to work:
Prelude Text.Regex.Posix Text.Regex.Base.RegexLike Text.Regex.Posix.String> makeRegex ".*"
(makeRegex is a shortcut for makeRegexOpts with predefined options)
However, it doesn't:
<interactive>:1:0:
No instance for (RegexMaker regex compOpt execOpt [Char])
arising from a use of `makeRegex' at <interactive>:1:0-13
Possible fix:
add an instance declaration for
(RegexMaker regex compOpt execOpt [Char])
In the expression: makeRegex ".*"
In the definition of `it': it = makeRegex ".*"
Prelude Text.Regex.Posix Text.Regex.Base.RegexLike Text.Regex.Posix.String> make
Regex ".*"::Regex
<interactive>:1:0:
No instance for (RegexMaker Regex compOpt execOpt [Char])
arising from a use of `makeRegex' at <interactive>:1:0-13
Possible fix:
add an instance declaration for
(RegexMaker Regex compOpt execOpt [Char])
In the expression: makeRegex ".*" :: Regex
In the definition of `it': it = makeRegex ".*" :: Regex
And I really don't understand why.
EDIT
Haskell Platform 2009.02.02 (GHC 6.10.4) on Windows
EDIT2
Prelude Text.Regex.Base.RegexLike Text.Regex.Posix.String> :i RegexMaker
class (RegexOptions regex compOpt execOpt) => RegexMaker regex compOpt execOpt source | regex -> compOpt execOpt, compOpt -> regex execOpt, execOpt -> regex compOpt where
makeRegex :: source -> regex
makeRegexOpts :: compOpt -> execOpt -> source -> regex
makeRegexM :: (Monad m) => source -> m regex
makeRegexOptsM ::
(Monad m) => compOpt -> execOpt -> source -> m regex
-- Defined in Text.Regex.Base.RegexLike