[Haskell-cafe] All-fail case in asum

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Fri Jun 10 14:57:23 UTC 2016


On Fri, Jun 10, 2016 at 05:37:41PM +0300, Юрий Сыровецкий (Yuriy Syrovetskiy) wrote:
> It is so because in base library
> 
>     asum = foldr (<|>) empty
> 
> What if it was defined
> 
>     asum [] = empty
>     asum [x:xs] = x <|> asum xs

Those are the same (assuming you mean (x:xs) instead of [x:xs]).

Tom


More information about the Haskell-Cafe mailing list