[Haskell-cafe] why does Data.Text.Lazy.IO.readFile return the internal type Data.Text.Lazy.Internal.Text, when Data.Text.IO.readFile returns plain IO Data.Text.Text?

Edward Kmett ekmett at gmail.com
Fri Apr 30 17:00:47 EDT 2010

Data.Text.Lazy.Internal.Text = Data.Text.Lazy.Text
Data.Text.Internal.Text = Data.Text.Text

You can use fromChunks/toChunks from Data.Text.Lazy to break it up into
strict Text fragments.

The lazy version returns a Lazy Text value, which is isomorphic to
[Data.Text.Text]. The strict version just returns a single strict Text

On Fri, Apr 30, 2010 at 4:37 PM, Thomas Hartman <tphyahoo at gmail.com> wrote:

> *Main> :t Data.Text.IO.readFile
> Data.Text.IO.readFile :: FilePath -> IO T.Text
> but
> *Main> :t Data.Text.Lazy.IO.readFile
> Data.Text.Lazy.IO.readFile
>  :: FilePath -> IO text-
> why does the lazy version use the internal type, whereas the strict
> version of Text IO just using plain Data.Text type?
> and how can I get from internal type to regular type when using Data.Text?
> also the internal type doesn't appear to be reflected in the haddock:
> http://hackage.haskell.org/packages/archive/text/
> ghc-pkg list | grep -i text
>    text-
> thanks for any help!
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100430/093704d4/attachment.html

More information about the Haskell-Cafe mailing list