Make <|> for ZipLists lazy for infinite lists

박신환 ndospark320 at naver.com
Tue Jun 5 03:36:34 UTC 2018


Current definion of (<|>) for ZipLists:
ZipList xs <|> ZipList ys = ZipList (xs ++ drop (length xs) ys)

doesn't work if the left argument is infinite. It should be:

ZipList [] <|> ys = ys
xs <|> ZipList [] = xs
ZipList (x:xs) <|> ZipList (_:ys) = ZipList (x : (ZipList xs <|> ZipList ys))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20180605/2c35bca0/attachment.html>


More information about the Libraries mailing list