Ticket #5699 (closed feature request: fixed)
Use sharing in the Alternative instance of Maybe
| Reported by: | basvandijk | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.6.1 |
| Component: | libraries/base | Version: | 7.2.1 |
| Keywords: | Cc: | ||
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | None/Unknown | Difficulty: | Unknown |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description
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
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

