
Am Freitag 30 April 2010 22:37:38 schrieb Thomas Hartman:
*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-0.7.1.0:Data.Text.Lazy.Internal.Text
Hmm, Prelude> :t Data.Text.Lazy.IO.readFile Data.Text.Lazy.IO.readFile :: FilePath -> IO text-0.7.1.0:Data.Text.Lazy.Internal.Text Prelude> :t Data.Text.IO.readFile Data.Text.IO.readFile :: FilePath -> IO text-0.7.1.0:Data.Text.Internal.Text
why does the lazy version use the internal type, whereas the strict version of Text IO just using plain Data.Text type?
Both are using the type from the corresponding .Internal, because that's where the type is defined (note that, as with ByteStrings, the strict and lazy types are different, lazy is basically a list of strict). Now, the interesting question is, why is the one displayed as T.Text? It must be what you import to your Main, but I don't know how to produce that effect.
and how can I get from internal type to regular type when using Data.Text?
Use id :: a -> a ;)
also the internal type doesn't appear to be reflected in the haddock:
http://hackage.haskell.org/packages/archive/text/0.7.1.0/doc/html/Data-T ext-Lazy-IO.html
Follow the 'Source' link at Data.Text.Lazy.Text, that sends you to http://hackage.haskell.org/packages/archive/text/0.7.1.0/doc/html/src/Data- Text-Lazy-Internal.html#Text
ghc-pkg list | grep -i text text-0.7.1.0
thanks for any help!