4 Dec
2016
4 Dec
'16
1:22 p.m.
On Sat, Dec 3, 2016 at 2:32 PM, David Feuer <david.feuer@gmail.com> wrote:
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 <dave@zednenem.com> <http://www.eyrie.org/~zednenem/>