
#13520: instance Alternative ZipList -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: | Version: 8.0.1 libraries/base | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The paper "From monoids to near-semirings: the essence of MonadPlus and Alternative`" mentions
Perhaps surprisingly, `ZipList`s have an `Alternative` instance. Like the `Alternative` instance for `Maybe`, the one for `ZipList` has a left bias.
{{{#!hs 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? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13520 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler