Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data Triple a = Tr a a a deriving (Eq,Show)
- instance Functor Triple where
- fmap f (Tr x y z) = Tr (f x) (f y) (f z)
- instance Applicative Triple where
- pure f = Tr f f f
- (<*>) (Tr fx fy fz) (Tr x y z) = (Tr (fx x) (fy y) (fz z))
- instance Foldable Triple where
- foldr ff ini (Tr a b c) = ff a (ff b (ff c ini))
- instance Traversable Triple where
- --traverse :: (a -> f b) -> t a -> f (t b)
- traverse g (Tr a b c) = Tr <$> g a <*> g b <*> g c
Advertisement
Add Comment
Please, Sign In to add comment