Idris2/tests/idris2/error/error029/Issue34.idr
Guillaume Allais 0c030020de [ re #3314, #34 ] Tighten the location information for implicits
When implicitly binding a variable, use the location of the head
function/constructor that expects it. This way we can differentiate
multiple implicits bound on the same LHS.

Note that this does not resolve the issue 34: there the location
is then further muddled by the fact that where-bound functions
are lifted to the toplevel.
2024-06-17 16:32:24 +01:00

10 lines
269 B
Idris

data T : Type -> Type where
Leaf : T a
Node : Ord a => a -> T a -> T a -> T a
zipWith : (a -> a -> a) -> T a -> T a -> T a
zipWith f Leaf _ = Leaf
zipWith f _ Leaf = Leaf
zipWith f (Node x lx rx) (Node y ly ry)
= Node (f x y) (zipWith f lx ly) (zipWith f rx ry)