@@ -256,10 +256,18 @@ instance Monad (Vect n) where
257---- Traversable instances
257---- Traversable instances
259+instance Traversable Maybe where
260+ traverse f Nothing = pure Nothing
261+ traverse f (Just x) = [| Just (f x) |]
259instance Traversable List where
263instance Traversable List where
260 traverse f [] = pure List.Nil
264 traverse f [] = pure List.Nil
261 traverse f (x::xs) = [| List.(::) (f x) (traverse f xs) |]
265 traverse f (x::xs) = [| List.(::) (f x) (traverse f xs) |]
267+instance Traversable (Vect n) where
268+ traverse f [] = pure Vect.Nil
269+ traverse f (x::xs) = [| Vect.(::) (f x) (traverse f xs) |]
263---- some mathematical operations
271---- some mathematical operations
265%include C "math.h"
273%include C "math.h"