Use sharing in the Alternative instance of Maybe
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
Trac metadata
Trac field | Value |
---|---|
Version | 7.2.1 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | libraries/base |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |