[Haskell-cafe] How does one create an input handle bound to a string instead of a file?
John D. Ramsdell
ramsdell0 at gmail.com
Thu Feb 28 14:42:55 CET 2013
I couldn't find the mkHandle function in the source linked to the
specified Haddock generated documentation page.
If there is a consensus that others besides myself would like a
function with the signature
stringHandle :: String -> IO (Handle)
I'd be happy to contribute code. I'd need help as I haven't ever
contributed this kind of code.
John
On Wed, Feb 27, 2013 at 10:05 PM, Bob Ippolito <bob at redivi.com> wrote:
> I haven't had time to make an example yet but it looks like if you go down
> to GHC.IO.Handle.Internals there's a mkHandle function that takes a
> BufferedIO and some other stuff and gives you an IO Handle.
>
>
> On Wed, Feb 27, 2013 at 3:23 PM, Gregory Collins <greg at gregorycollins.net>
> wrote:
>>
>> Hm, perhaps I stand corrected. Then how exactly do you make the bytestring
>> Handle?
>>
>>
>> On Thu, Feb 28, 2013 at 12:15 AM, Don Stewart <dons00 at gmail.com> wrote:
>>>
>>> I don't think that's right - Simon's buffer class rewrite should have
>>> made this possible, I think.
>>>
>>>
>>> http://hackage.haskell.org/packages/archive/base/4.2.0.1/doc/html/GHC-IO-BufferedIO.html
>>>
>>> On Feb 27, 2013 10:52 PM, "Gregory Collins" <greg at gregorycollins.net>
>>> wrote:
>>>>
>>>> On Wed, Feb 27, 2013 at 9:38 PM, John D. Ramsdell <ramsdell0 at gmail.com>
>>>> wrote:
>>>>>
>>>>> How does one create a value of type System.IO.Handle for reading that
>>>>> takes its input from a string instead of a file? I'm looking for the
>>>>> equivalent of java.io.StringReader in Java. Thanks in advance.
>>>>
>>>>
>>>> You can't. There are several libraries that purport to provide better
>>>> interfaces for doing IO in Haskell, like conduit, pipes, enumerator, and my
>>>> own io-streams library (http://github.com/snapframework/io-streams, soon to
>>>> be released). You could try one of those.
>>>>
>>>> G
>>>> --
>>>> Gregory Collins <greg at gregorycollins.net>
>>>>
>>>> _______________________________________________
>>>> Haskell-Cafe mailing list
>>>> Haskell-Cafe at haskell.org
>>>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>>>
>>
>>
>>
>> --
>> Gregory Collins <greg at gregorycollins.net>
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
More information about the Haskell-Cafe
mailing list