@@ -104,9 +104,9 @@ unzip ((l, r)::xs) with (unzip xs)
105--------------------------------------------------------------------------------
105--------------------------------------------------------------------------------
107−map : (a -> b) -> Vect n a -> Vect n b
107+instance Functor (Vect n) where
108−map f [] = []
108+ map f [] = []
109−map f (x::xs) = f x :: map f xs
109+ map f (x::xs) = f x :: map f xs
111-- XXX: causes Idris to enter an infinite loop when type checking in the REPL
111-- XXX: causes Idris to enter an infinite loop when type checking in the REPL
112--mapMaybe : (a -> Maybe b) -> Vect n a -> (p ** Vect b p)
112--mapMaybe : (a -> Maybe b) -> Vect n a -> (p ** Vect b p)
@@ -145,10 +145,10 @@ total or : Vect m Bool -> Bool
145or = foldr (||) False
145or = foldr (||) False
147total any : (a -> Bool) -> Vect m a -> Bool
147total any : (a -> Bool) -> Vect m a -> Bool
148−any p = Vect.or . Vect.map p
148+any p = Vect.or . map p
150total all : (a -> Bool) -> Vect m a -> Bool
150total all : (a -> Bool) -> Vect m a -> Bool
151−all p = Vect.and . Vect.map p
151+all p = Vect.and . map p
153--------------------------------------------------------------------------------
153--------------------------------------------------------------------------------
154-- Transformations
154-- Transformations
@@ -317,6 +317,10 @@ catMaybes (Nothing::xs) = catMaybes xs
317catMaybes ((Just j)::xs) with (catMaybes xs)
317catMaybes ((Just j)::xs) with (catMaybes xs)
318 | (_ ** tail) = (_ ** j::tail)
318 | (_ ** tail) = (_ ** j::tail)
320+diag : Vect n (Vect n a) -> Vect n a
322+diag ((x::xs)::xss) = x :: diag (map tail xss)
320range : Vect n (Fin n)
324range : Vect n (Fin n)
322 reverse range_
326 reverse range_