Haskell: 'No instance for' arising from a trivial usage of Regex library

Posted by artemave on Stack Overflow See other posts from Stack Overflow or by artemave
Published on 2010-03-23T17:26:36Z Indexed on 2010/03/31 10:13 UTC
Read the original article Hit count: 1123

Filed under:

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

© Stack Overflow or respective owner

Related posts about haskell