Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

A Question on Functional Programming Language

I know that not too many people are going to see this but I think this
is probably the place to post the message.

I'm writing a program in Haskell to test out some text formatting
functions and I want the text to be in a text file as opposed to being
hardcoded within the program.
So how do I convert an IO String to a String.

The language will not treat IO String and String the same way.
I did figure out how to test the text functions on an IO String,
which would look like
string1 = do line <- readFile "sample.txt"
putStrLn (textprocedure... line)

I just think it would be easier to convert the IO String to a String
and then simply call
textprocedure string1.


Comments

  • goliathgoliath Posts: 9Member
    : I know that not too many people are going to see this but I think this
    : is probably the place to post the message.
    :
    : I'm writing a program in Haskell to test out some text formatting
    : functions and I want the text to be in a text file as opposed to being
    : hardcoded within the program.
    : So how do I convert an IO String to a String.
    :
    : The language will not treat IO String and String the same way.
    : I did figure out how to test the text functions on an IO String,
    : which would look like
    : string1 = do line <- readFile "sample.txt"
    : putStrLn (textprocedure... line)
    :
    : I just think it would be easier to convert the IO String to a String
    : and then simply call
    : textprocedure string1.
    :
    :
    :
    I don't know how to help you, but maybe you can post the message on the messageboard "Programming for AI"
    Programming Languages -> Other languages -> Programming for AI
    Hopefully someone will read it and be able to help you there...



Sign In or Register to comment.