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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T13:28:17+00:00 2026-05-20T13:28:17+00:00

In the context of deciding which Exception instance to handle for GHC versions >=

  • 0

In the context of deciding which Exception instance to handle for GHC versions >= 6.10, and given documentation for getDirectoryContents, can it be assumed that getDirectoryContents will only throw IOExceptions? E.g. no exceptions will get past

let handler = (const $ return []) :: IOException -> IO [FilePath]
contents <- handle handler $ getDirectoryContents dir

… well, apart from stack overflows and so on, but no exception thrown specifically by getDirectoryContents? It seems to me, that this should be the case, but I don’t see it explicated in the documentation, so I just want to make sure.

  • 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-20T13:28:18+00:00Added an answer on May 20, 2026 at 1:28 pm

    Well, I’ve never tried to read the code for System.Directory before, but looking at the code suggests that that’s true. The only code related to error handling in the function definition is a call to modifyIOError which seems to add specific details like the function name and directory path to any IO error which is thrown. I had a quick look at the System.Posix.Directory module as well, and there are no obvious signs of errors other than IO errors being thrown there.

    I just had a quick look though, so it’s possible I missed something…

    On the other hand, do you really care what kind of error it is at all? You appear to be trying to say “If something goes wrong, just return an empty list and carry on regardless”. If that’s all you want, why don’t you just catch any error that gets thrown, instead of IO errors specifically?

    What I mean to say is that the primary purpose of your error handler seems to be just to ignore errors, so why not just ignore them in general?

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

Sidebar

Related Questions

Context: I can create a shared object library which is linked to a static
Context: I have a WPF App that uses certain unmanaged DLLs in the D:\WordAutomation\MyApp_Source\Executables\MyApp
in context of SQL Server 2005, I have a table for which the primary
I keep getting stuck conceptually on deciding an Exception-handling structure for my project. Suppose
I have created a method in my data context that is mapped to a
Context: C# 3.0, .Net 3.5 Suppose I have a method that generates random numbers
In context of recent trends in interviews i have noticed that this question arises
Context: I'm building a little site that reads an rss feed, and updates/checks the
The context is in a Mac's Safari. I'm creating a HTML button that has
Here is the context for Spring Batch: <beans:beans xmlns:beans=http://www.springframework.org/schema/beans xmlns:b=http://www.springframework.org/schema/batch xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation= http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

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.