A Question on Functional Programming Language - Programmers Heaven

Howdy, Stranger!

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

Categories

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.