此问题涉及另一个帖子中的评论:取消实体框架查询
为清楚起见,我将从那里重现代码示例:
var thread = new Thread((param) =>
{
var currentString = param as string;
if (currentString == null)
{
// TODO OMG exception
throw new Exception();
}
AdventureWorks2008R2Entities entities = null;
try // Don't use using because it can cause race condition
{
entities = new AdventureWorks2008R2Entities();
ObjectQuery<Person> query = entities.People
.Include("Password")
.Include("PersonPhone")
.Include("EmailAddress")
.Include("BusinessEntity")
.Include("BusinessEntityContact");
// Improves performance of readonly query where
// objects do not have to be tracked by context
// Edit: But it doesn't …Run Code Online (Sandbox Code Playgroud) 在这里的一半......
https://en.wikibooks.org/wiki/Haskell/Laziness
...是一个练习,询问更改对head使用无可辩驳模式的函数的替代实现的影响.它提供了head'如下定义,指出它将始终undefined由于第一个等式的无可辩驳的匹配而返回:
head' :: [a] -> a
head' ~[] = undefined
head' ~(x:xs) = x
Run Code Online (Sandbox Code Playgroud)
然后它问:
head'帮助这里?head'仍然会不同于head?如果是这样,怎么样?在GHC 7.8.4中,似乎更改顺序"帮助"至少使得此函数的行为类似于常规的部分版本head,尽管在空列表情况下有不同的例外.第二个问题的答案在我看来是"不",但考虑到"如果是这样,如何"的附录,我觉得我在这里也必须遗漏一些东西.任何人都可以开导我吗?不幸的是,页面上的解决方案链接并未涵盖此练习.