为什么 F# 突然从函数返回值作为 @+行号?
我在 F# 中有一些代码工作正常,但现在有任何函数返回与 @ + 行号绑定的 let 名称吗?所以之前当我做这样的事情时:
let sqlData = GetSummary 2011
我会获取数据。现在我得到 sqlData@160 作为返回类型,这会破坏其他需要特定类型的函数。任何关于为什么会突然发生这种情况的帮助将不胜感激。
更新: 所以我将 GetSummary 代码更改为这样,只是为了看看会发生什么:
let GetSummary fiscalYear =
let g = 22
g
没有任何改变。我得到了完全相同的结果,即使我有一个断点,它也不会中断函数。它也不会进入 GetSummary。为什么它会忽略某些功能而不忽略其他功能?
I have some code in F# that was working fine, but now any function returns the name of the let binding with @ + line number? So before when I did something like this:
let sqlData = GetSummary 2011
I would get the data. Now I get sqlData@160 as the return type, which break other functions expecting a specific type. Any help as to why this suddenly started happening would be appreciated.
UPDATE:
So I changed the GetSummary code to this just to see what would happen:
let GetSummary fiscalYear =
let g = 22
g
And nothing changed. I got the exact same results and it would not break in the function even though I have a breakpoint. It also would not step into GetSummary either. Why would it ignore the some functions and not others?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的猜测是您已经更改了 GetSummary 函数中的某些内容,以便它实际上返回一个函数而不是返回数据(当您给它一个参数时)。例如,此代码片段的行为有点相似 - 它返回一些内部内容,并且不进入
bar
函数内部:My guess is that you've changed something in the
GetSummary
function, so that it actually returns a function instead of returning the data (when you give it a single argument). For example, this snippet behaves a bit similarly - it returns some internal things and it doesn't step inside thebar
function:好吧,现在我觉得自己真的很蠢。我回去发现我已经将 GetSummary 的定义更改为
由于我没有传递名称,它认为我正在柯里化该函数,因此出现了奇怪的行为。
感谢您的投入!
Okay, now I feel really stupid. I went back and realized that I had changed the definition of GetSummary to
Since I was not passing in the name, it thought that I was currying the function, hence the odd behavior.
Thanks for your input!!!