module Foo where {-@ filterElts :: forall
Prop>. Eq a => [a
] -> [a] -> [a
] @-} filterElts :: Eq a => [a] -> [a] -> [a] filterElts xs ys = go xs xs ys {-@ go :: forall
Prop>. Eq a => xs:[a
] -> ws:[a
] -> zs:[a] -> [a
] /[(len zs), (len ws)] @-} go :: Eq a => [a] -> [a] -> [a] -> [a] go xs (w:ws) (z:zs) | w == z = z : go xs xs zs | otherwise = go xs ws (z:zs) go xs [] (z:zs) = go xs xs zs go xs ws [] = []