#5699: Use sharing in the Alternative instance of Maybe
------------------------------+---------------------------------------------
Reporter: basvandijk | Owner:
Type: feature request | Status: new
Priority: normal | Component: libraries/base
Version: 7.2.1 | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: None/Unknown | Testcase:
Blockedby: | Blocking:
Related: |
------------------------------+---------------------------------------------
The `<|>` method of the `Alternative` instance of `Maybe` does not share
its first argument when it could:
{{{
instance Alternative Maybe where
empty = Nothing
Nothing <|> p = p
Just x <|> _ = Just x
}}}
I propose to share this argument:
{{{
instance Alternative Maybe where
empty = Nothing
Nothing <|> r = r
l <|> _ = l
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5699>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs