-1

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?

4

1 回答 1

3

您可以让 GHC 使用类型孔告诉您类型是什么。

只需在赋值后添加一个 let 语句:

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

当您编译程序或将其加载到 ghci 中时,您将被告知类型privacyContents是什么。

我的猜测是 LazyIO 对应于Data.Text.IO.Lazy它会产生privacyContents一个惰性文本值(即类型 Data.Text.Lazy.Text)。

于 2016-08-26T16:18:25.173 回答