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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:08:05+00:00 2026-05-30T05:08:05+00:00

I’ve got a Haskell program that needs to execute a separate (third party) binary;

  • 0

I’ve got a Haskell program that needs to execute a separate (third party) binary; this binary will write its output to a file provided as a command-line argument (it does not seem willing to write to STDOUT). I see that System.Cmd will allow me to call this binary, but I’m quite mystified by the type of withTemporaryDirectory. Namely:

withTemporaryDirectory :: FilePath -> (FilePath -> IO a) -> IO a

whereas System.Cmd merely gives me:

rawSystem :: String -> [String] -> IO ExitCode

(as well as system, which isn’t usefully different in this case).

I’m just stuck figuring out how to wire these up; I want to create a temp directory (this binary likes to vomit all over its CWD), run the binary, read from its output file (I’ll know its name as I provide that as an argument to the binary in question) and then blow away the temp directory and its contents.

So, should I be writing a function whose type is (Filepath -> IO a) in order to do all the stuff I described? Are there any good examples anyone can provide to this effect?

In this case, the binary being used is PsiPred (protein secondary structure prediction) and while its source is available, I’d rather not have to modify it. This software we’re working on is a computational biology program for remote homology detection in proteins.

  • 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-30T05:08:06+00:00Added an answer on May 30, 2026 at 5:08 am

    FilePath is typdefed as a String. withTemporaryDirectory works as if you called mkdtemp(3) with its first argument, and then used its result to call the second argument (a function taking a path with the template applied, and running an IO action with it). After the inner function terminates, the directory is deleted.

    In your case, I would assume you should use withTemporaryDirectory, and then inside the function you pass to it, change directories to the temporary one, actually run PsiPred, and then change back into your old one.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I need a function that will clean a strings' special characters. I do NOT
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.