instance Alternative ZipList
The paper "From monoids to near-semirings:
the essence of MonadPlus
and Alternative
" mentions
Perhaps surprisingly,
ZipList
s have anAlternative
instance. Like theAlternative
instance forMaybe
, the one forZipList
has a left bias.instance Alternative ZipList where empty :: ZipList a empty = ZL [] (<|>) :: ZipList a -> ZipList a -> ZipList a ZL xs <|> ZL ys = ZL (xs ++ drop (length xs) ys)
Has this been considered for base?