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 6167183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:28:02+00:00 2026-05-23T22:28:02+00:00

I have a Haskell program which uses Data.Map.! at several places. After executing the

  • 0

I have a Haskell program which uses Data.Map.! at several places. After executing the program, there is error message saying element not in the map.
I am wondering how can I know at which line of the program that uses the Data.Map.! that emits the error message and what element is not found in the map?

  • 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-23T22:28:02+00:00Added an answer on May 23, 2026 at 10:28 pm

    The (!) operator is not intended for looking up things that might not be in the map. While you can catch the resulting error in the IO monad, it would be very bad style.

    Instead, use lookup, which returns Maybe a, and in particular, returns Nothing when the element isn’t in the map.

    Edit: Okay, I misread your question. Leaving the original answer in case it’s useful, but supposing that (!) really was what you wanted and you’re debugging, there are a couple things you could do:

    1. You can temporarily hide (!) in the imports, and instead define your own version that uses lookup and throws a more useful error (perhaps containing the key that you tried to look up, if it has a Show instance).

    2. You can run the code in the GHCi debugger, and use -fbreak-on-exception to stop the code where the lookup occurs.

    3. You can use the Debug.Trace module to add trace statements to your code.

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

Sidebar

Related Questions

Have you ever seen any of there error messages? -- SQL Server 2000 Could
I just have started to learn Haskell and combine reading books and tutorials with
C++ does not have native support for lazy evaluation (as Haskell does). I'm wondering
I'm currently working on project with Haskell, and have found myself some trouble. I'm
Have just started using Visual Studio Professional's built-in unit testing features, which as I
Have a n-tire web application and search often times out after 30 secs. How
I have several USB mass storage flash drives connected to a Ubuntu Linux computer
I have a login.jsp page which contains a login form. Once logged in the
i have a input tag which is non editable, but some times i need
Have just started using Google Chrome , and noticed in parts of our site,

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.