
4 Dec
2016
4 Dec
'16
12:22 a.m.
On Sat, Dec 3, 2016 at 2:32 PM, David Feuer
You can also sift monomorphic containers using my class, which should probably be called MonoSiftable.
data IntList = Cons !Int IntList | Nil
instance Siftable Int IntList where sift _ Nil = Nil sift p (Cons x xs) | p x = Cons x (sift p xs) | otherwise = sift p xs
You can also use it with contra-variant or invariant type constructors,
e.g.,
instance Siftable a (a -> Bool) where
sift f g = \x -> f x && g x
--
Dave Menendez