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

  • Home
  • SEARCH
  • 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 8239929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:18:53+00:00 2026-06-07T20:18:53+00:00

I had to write 3 functions: one to convert Fahrenheit to Celsius, one to

  • 0

I had to write 3 functions: one to convert Fahrenheit to Celsius, one to convert Celsius to Kelvin and a third that converts Fahrenheit to Kelvin using the two first functions.

I’ve never played with Haskell before so this took me a relatively long amount of time, although now I see that it is pretty simple.

Anyway, I am required to create interactive Haskell programs for the first two functions and use them to compose and executable with pipes in order to get an equivalent to the third function. I have been reading on pipes and it seems simple enough. My main problem seems to be making the functions interactive.

Any help, tips and resources is greatly appreciated!

  • 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-06-07T20:18:55+00:00Added an answer on June 7, 2026 at 8:18 pm

    The interact function should be pretty useful when solving your problem. Because the UNIX convention is that processes should communicate using text (and not numbers, like temperatures), it means that the interact function wraps functions that take Strings and return Strings. This means that you have to wrap your fahrenheit/celsius functions in new functions that take and return strings instead of numbers.

    As an example to get you started, this program upper-cases all strings that are given to it:

    module Main (main) where
    
    import Data.Char (toUpper)
    
    main :: IO ()
    main = interact upperCase
    
    upperCase :: String -> String
    upperCase = map toUpper
    

    You can compile it with:

    ghc uppercase.hs
    

    …and then you can use it (on Linux) by doing this:

    echo "bla" | ./uppercase
    # Result: "BLA"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanted to write two one-line functions which will trim white spaces from left
I had a task to write simple game simulating two players picking up 1-3
I had a task to write simple game simulating two players picking up 1-3
I've had these functions in my .emacs.el file for years: (defun dos2unix () Convert
I have some code that I had to write to replace a function that
In my android app I had one class doing the following functions: storing data
Recently I had to write an oracle function, and the error ora-06575 popped up
I have experience with OCaml. You had to write a stub for every function
I've not had to write much batch file code in the past and I'm
I just finished creating several models and a had to separately write all of

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.