[Haskell-cafe] [newbie] How to test this function?
Bulat Ziganshin
bulat.ziganshin at gmail.com
Thu Sep 21 14:41:35 EDT 2006
Hello Bruno,
Thursday, September 21, 2006, 6:16:49 PM, you wrote:
>>> 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
> I'll give this a try.
btw, although this may be considered as bug, it's possible to use
Streams to combine getContents and other I/O on the same stream:
h <- openFD "test" ReadMode
str <- vGetContents h
print (take 5 str)
c <- vGetChar h
print с
print (take 5 str)
:) so it's possible to use Streams to simplify your program. of
course, you should understand how it works in order to use it in safe
manner and that means that you should understand how
unsafeInterleaveIO works. look at my today message in haskell list and
expalanation of unsafePerformIO in "IO inside"
--
Best regards,
Bulat mailto:Bulat.Ziganshin at gmail.com
More information about the Haskell-Cafe
mailing list