What's the type of LazyIO.readFile?

78 Views Asked by At

I am trying to find the type of privacyContents in

privacyContents <- LazyIO.readFile $ markdownPath ++ "PRIVACY.md"

Is the type of this variable defined by the return type of LazyIO.readFile? And if the answer is yes, what is the return type of LazyIO.readFile?

1

There are 1 best solutions below

5
ErikR On

You can have GHC tell you what the type is by using a type hole.

Just add a let statement after the assignment:

...
privacyContents <- LazyIO.readFile $ markdownPath ++ "PRIVACY.md"
let _ = privacyContents :: _
...

When you compile the program or load it into ghci you will be told what the type of privacyContents is.

My guess is that LazyIO correpsonds to Data.Text.IO.Lazy which would make privacyContents a lazy Text value (i.e. type Data.Text.Lazy.Text).