Haskell:从 Data.Random 中的 RVar 中获取值
如何编写具有类型签名的函数,例如:
mySample :: StdGen -> Int -> [a] -> [a]
根据
sample :: Int -> [a] -> RVar [a]
Data.Random.Extras?这里,sample 是一个函数,它从给定列表中返回一个随机子列表。
How do I write a function with a type signature like:
mySample :: StdGen -> Int -> [a] -> [a]
in terms of
sample :: Int -> [a] -> RVar [a]
where sample is defined in Data.Random.Extras? Here, sample is a function which returns a random sublist from the given list.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据文档< /a>,这应该可以工作:
但是,在尝试编译它时,我遇到了重叠的实例错误。不过,我得到了这个编译:
According to the documentation, this should work:
However, I get overlapping instance errors when trying to compile it. I got this to compile, though: