
7 Aug
2019
7 Aug
'19
6:49 p.m.
On Aug 7, 2019, at 5:52 AM, Dušan Kolář
wrote: So is there a nicer and working way, how to change my simple example? Is there a way, how to make it compile? Or is it useless to do that, original function is just fine...
The closest working version is: checkDup ns = fst $ foldr f (False, []) ns where f _ res@(True, _) = res f 0 res@(_, vs) = (False, vs) f v res@(_, vs) = (elem v vs, v : vs) replacing "mempty" with "[]" removes the ambiguity, which is was a logical inevitability, and not some limitation of GHC's type inference... -- Viktor.