[Haskell-cafe] [newbie] How to test this function?

Bulat Ziganshin bulat.ziganshin at gmail.com
Thu Sep 21 04:30:34 EDT 2006


Hello Bruno,

Thursday, September 21, 2006, 8:28:23 AM, you wrote:

> First, how do I fix the identation of the if then else?

http://haskell.org/haskellwiki/IO_inside contains a lot of information
about using IO monad

> Second, I want to test this function, without hitting the filesystem.  In
> C++ I would use a istringstream.  I couldn't find a function that returns
> a Handle from a String.

http://haskell.org/haskellwiki/Library/Streams

although you will need to slightly change your program using v*
operations instead of h*, in return you will get ability to use String
as Stream:

h1 <- openFile "test" ReadMode
vGetChar h1
h2 <- newStringReader "input"
vGetChar h2



-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list