
17 Nov
2018
17 Nov
'18
11:01 p.m.
Hi, everyone, Is it possible to make combine the following "f" and "g" into one function? f:: a -> b -> b f x y = y g:: a -> a -> a g x y = x Or similarly, "eq1" and "eq2" into one function? eq1 :: (Eq a)=>a->a->Bool eq1 = (==) eq2 :: (Eq a,Eq b)=>a->b->Bool eq2 _ _ = False Looks like it would require some typeclasses, but at least in the first case, "a" and "b" should be any types. Best!