Why zipWith (-) [6,5,4] [1,2,3] n't zipWith (-) [6,5,4] [1,2,3] work in Idris? Can this error be avoided 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]
Mistake:
*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]
idris
2426021684
source share