English 中文(简体)
难道有人能向我解释,我应如何确定这种签名?
原标题:Could someone explain to me how I should go about fixing this type signature?

在这里,我试图让步的推论表明职能类型。 虽然该法典汇编成册,但它在时间上还是失败。

Ambiguous type variables `b0 , `m0  in the constraint:
  (PersistBackend b0 m0) arising from a use of `isFree 
Probable fix: add a type signature that fixes these type variable(s)
In the expression: isFree testDay
In an equation for `it : it = isFree testDay

:t isFree

isfree * PersistBackend b m => C.Day -> b m Bool

>isFree day = do
   match <- selectList [TestStartDate ==. day,
                        TestStatus !=. Passed,
                        TestStatus !=. Failed] []
   if (L.null match) then (liftIO $ return True) else (liftIO $ return False)
最佳回答

这令人难堪。 一方面,这一问题确实使我深入了解好魔.的深度。 另一方面,我已经回答了这个问题。 当你管理数据库行动时,将结果照样转行。

>isFree day = do
   match <- runDB $ selectList [TestStartDate ==. day,
                                TestStatus !=. Passed,
                                TestStatus !=. Failed] []
   if (L.null match) then (liftIO $ return True) else (liftIO $ return False)
问题回答

缩略语告诉你,它不知道选择哪类词语来打<条码>b和<条码>。 各位必须做的是,

isFree testDay :: Foo Bar Bool

在实际方案中,这些类型的变数通常在使用地点确定,因此,你很少必须具体说明哪类表述。 因此,情况就消失了,因此,你常常不得不这样做。

与此无关的是,最后一条自由线最好有return$ L.nullcomp

“虽然该守则汇编成册,但该守则在运行期间失败,即<>不大可能<>>>>,成为提供这种功能的一种错误。

“失败”的含义是什么?





相关问题
Euler Problem in Haskell -- Can Someone Spot My Error

I m trying my hand at Euler Problem 4 in Haskell. It asks for that largest palindrome formed by multiplying two three-digit numbers. The problem was simple enough, and I thought my Haskell-fu was up ...

How does foldr work?

Can anybody explain how does foldr work? Take these examples: Prelude> foldr (-) 54 [10, 11] 53 Prelude> foldr (x y -> (x+y)/2) 54 [12, 4, 10, 6] 12.0 I am confused about these executions....

Efficient queue in Haskell

How can I efficiently implement a list data structure where I can have 2 views to the head and end of the list, that always point to a head a tail of a list without expensive calls to reverse. i.e: ...

Problem detecting cyclic numbers in Haskell

I am doing problem 61 at project Euler and came up with the following code (to test the case they give): p3 n = n*(n+1) `div` 2 p4 n = n*n p5 n = n*(3*n -1) `div` 2 p6 n = n*(2*n -1) p7 n = n*(5*n -3)...

Ways to get the middle of a list in Haskell?

I ve just started learning about Functional Programming, using Haskel. I m slowly getting through Erik Meijer s lectures on Channel 9 (I ve watched the first 4 so far) and in the 4th video Erik ...

haskell grouping problem

group :: Ord a => [(a, [b])] -> [(a, [b])] I want to look up all pairs that have the same fst, and merge them, by appending all the list of bs together where they have the same a and discarding ...

Closest equivalent to subprocess.communicate in Haskell

I want to do a popen() / python s subprocess.communicate from Haskell - start a program, give it stdin, and get its stdout/stderr. What s the most direct / Haskellish way to do this?

热门标签