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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:12:41+00:00 2026-05-23T17:12:41+00:00

What I want is to write a Haskell function to return the files of

  • 0

What I want is to write a Haskell function to return the files of current directory e.g

Change the current directory to

 :cd c:/code/haskell

Then write a function which returns the files in a set e.g

 [x | x <-getDirectoryContents ]

Edited:

I have wrote a function sth like this which lists files
(ref: http://zvon.org/other/haskell/Outputdirectory/index.html)

import Directory 

main = _dir "/tmp/FOO"

_dir _path =do
    setCurrentDirectory _path
    _cd <- getCurrentDirectory
    print _cd
    _file <- getDirectoryContents _cd
    print _file

so calling _dir “c:/code/haskell” will list all files + directory names (non-recursive) . What I want now is to call this in a predicate function, for example:

[ x| x <- _dir  "c:/code/haskell" | x start with 'haskell_' ]  

so I can apply a filter on file name

  • 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-23T17:12:41+00:00Added an answer on May 23, 2026 at 5:12 pm

    It seems you are looking for:

    getDirectoryContents :: FilePath -> IO [FilePath]
    

    Refer : http://www.haskell.org/ghc/docs/6.12.2/html/libraries/directory-1.0.1.1/System-Directory.html#1

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

Sidebar

Related Questions

I want to write a function in haskell which would not mind in what
I want to write a function in Python that returns different fixed values based
I am teaching myself Haskell. I want to write a function that recursively finds
I'm trying to learn Haskell and want to write a small program which prints
I want to write a little DBQuery function in perl so I can have
I want to write a function that takes an array of letters as an
I want to write some JavaScript that will change the onmousedown of a div
suppose we have two numbers i want write program which print common bits subsequent
I am new to Haskell,I should write a function that takes a function among
I'm trying to write the Haskell function 'splitEvery' in Python. Here is it's definition:

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.