Why does zipWith (-) [6,5,4] [1,2,3]
fail in Idris? Is it possible to avoid that error without writing a specialized zipWith function?
main8.idr:
module Main
import Data.HVect
import Data.Vect
import Data.Vect.Quantifiers
t : Vect 3 Nat
t = zipWith (-) [6,5,4] [1,2,3]
Error:
*main8> :load main8.idr
Type checking ./main8.idr
main8.idr:8:3:When checking right hand side of t with expected type
Vect 3 Nat
When checking argument f to function Data.Vect.zipWith:
Can't disambiguate since no name has a suitable type:
Prelude.Interfaces.-, Prelude.Nat.-
Holes: Main.t
This file works:
module Main
import Data.HVect
import Data.Vect
import Data.Vect.Quantifiers
vm : (ms : Vect l Nat) -> (ns : Vect l Nat) -> {auto p : All (uncurry LTE) (zip ns ms)} -> Vect l Nat
vm [] [] = []
vm {p = _ :: _} (m::ms) (n::ns) = m - n :: vm ms ns
t : Vect 3 Nat
t = vm [6,5,4] [1,2,3]