For example:
intersectBy : (a -> a -> Bool) -> List a -> List a -> List a
intersectBy _ [] _ = []
intersectBy _ _ [] = []
intersectBy eq xs ys = [x | x <- xs, any (eq x) ys]
There are extra patterns for []
and seems like they are used in Haskell Data.List
but what kind of optimization is that? And where is difference with Idris here?
I ask because I heard that "it will make reasoning about it more difficult" and person who said me that had no time to fully explain it.
I doubt if I can understand it doing "reduce the proof" of function.
May someone explain me the politics of extra patterns here from positions of Haskell and Idris so I will be able to understand and see the difference.