0

The code

rayTraceP (p2 (0, 0)) (r2 (1, 0)) (circle 1)

causes the error message

 Could not deduce: V a0 ~ V2
      from the context: (Traced a, TrailLike a, Transformable a,
                         V a ~ V2)
        bound by the inferred type for ‘it’:
                   forall a.
                   (Traced a, TrailLike a, Transformable a, V a ~ V2) =>
                   Maybe (Point (V a) (N a))
        at <interactive>:1:1-44
      The type variable ‘a0’ is ambiguous

I can't figure out why this happens. It seems that rayTraceP is used similarly in the manual. I use diagrams-cairo-1.4.1 .

4

1 回答 1

1

这种错误通常是由类型推断时的类型不明确引起的,可以通过添加一个或多个类型签名来修复。在这种情况下,我认为问题很可能是它无法弄清楚'circle 1'调用应该有什么类型。如果您显示所有代码,我可以就在何处添加类型签名提供一些更好的建议。

有关更多信息,请参阅用户手册的第 5.5 节:https ://diagrams.github.io/doc/manual.html#tips-and-tricks

于 2019-07-28T22:54:26.747 回答