[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?

Daniel Fischer daniel.is.fischer at web.de
Fri Apr 30 19:28:23 EDT 2010

Am Samstag 01 Mai 2010 00:58:23 schrieb Felipe Lessa:
> It depends on what is on your scope:
>   Prelude> :t Data.Text.Lazy.IO.readFile
>   Data.Text.Lazy.IO.readFile
>     :: FilePath -> IO text-
>   Prelude> :m Data.Text.Lazy
>   Prelude Data.Text.Lazy> :t Data.Text.Lazy.IO.readFile
>   Data.Text.Lazy.IO.readFile :: FilePath -> IO Text
> HTH,

Indirectly. From the original post:

>> *Main> :t Data.Text.IO.readFile
>> Data.Text.IO.readFile :: FilePath -> IO T.Text

So the scope is the top level of the Main module. I didn't immediately 
figure out why it was displayed as T.Text. I couldn't reproduce that with a 
couple of different imports, but I only  tried
"import [qualified] Data.Text.IO as T".
When I saw

>   Prelude> :m Data.Text.Lazy

it became clear, he had "import qualified Data.Text as T" in Main, thanks 

> --
> Felipe.

More information about the Haskell-Cafe mailing list