在haskell中读取二进制文件
我怎样才能编写一个具有类似定义的函数...
readBinaryFile :: Filename -> IO Data.ByteString
我已经掌握了 Haskell 的功能部分,但类型系统和 monad 仍然让我头疼。有人可以写下并解释一下该功能如何对我起作用吗?
How could I write a function with a definition something like...
readBinaryFile :: Filename -> IO Data.ByteString
I've got the functional parts of Haskell down, but the type system and monads still make my head hurt. Can someone write and explain how that function works to me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
像馅饼人一样容易。如果您不希望字符串变得懒惰,请关闭懒惰。
easy as pie man. Knock off the lazy if you don't want the string to be lazy.
这只是
Data.ByteString.readFile
函数,您永远不必编写该函数,因为它位于bytestring
中包裹。This is simply the
Data.ByteString.readFile
function, which you should never have to write, since it is in thebytestring
package.