Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6957713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:02:36+00:00 2026-05-27T15:02:36+00:00

I am trying to compile a regexp and get an error message that can

  • 0

I am trying to compile a regexp and get an error message that can be presented to the user. I tried this with Text.Regex.TDFA and Text.Regex.Posix and it seems to behave the same:

Prelude Text.Regex.TDFA Data.Maybe Data.Either.Utils> fromLeft $ (makeRegexM ".[" :: Either String Regex)
"*** Exception: parseRegex for Text.Regex.TDFA.String failed:".[" (line 1, column 3):
unexpected end of input
expecting "^", "]", "-" or Failed to parse bracketed string
Prelude Text.Regex.TDFA Data.Maybe Data.Either.Utils> isJust $ (makeRegexM ".[" :: Maybe Regex)
False
Prelude Text.Regex.TDFA Data.Maybe Data.Either.Utils> isJust $ (makeRegexM "." :: Maybe Regex)
True

The Maybe monad seems to work; the Either does not. However the documentation says, it should use ‘fail’ – which, as far as I know, is defined in Either monad. Am I doing something wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T15:02:37+00:00Added an answer on May 27, 2026 at 3:02 pm

    The reason probably is that the monad instance for Either e recently changed. In mtl-1.*, there used to be an

    instance Error e => Monad (Either e) where
        ...
        fail msg = Left (strMsg msg)  -- I may misremember the exact names
    

    so calling fail there didn’t cause an exception. Now, there is a monad instance in base (Control.Monad.Instances)

    instance Monad (Either e) where
        ...
        fail s = error s  -- implicitly from the default method for fail
    

    so you get the above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to compile a iPhone/iPad application with SDK3.2 and am getting this error: Undefined
When trying to compile a file that include winnt.h via windows.h, I get the
When trying to compile my class I get an error: The constant 'NamespaceName.ClassName.CONST_NAME' cannot
I'm trying to figure out a Java regex problem that I'm having. This is
When trying to compile GNU software on HP-UX (binutils for example) I'm getting error
When trying to compile the following code, I am getting a warning that line
While trying to compile my project, that uses some third party headers, with mingw
I'm trying to compile a Delphi 7 project that I've inherited, and I'm getting
I'm trying to compile using a compiled Boost libs. I can compile using header-only
I'm trying to get all the words in a sentence with regex but only

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.