Ticket #5699: 0001-Use-sharing-in-the-Alternative-instance-of-Maybe.patch

File 0001-Use-sharing-in-the-Alternative-instance-of-Maybe.patch, 0.7 KB (added by basvandijk, 18 months ago)
  • Control/Applicative.hs

    From 415dfe780ac6bdf8c517532d86346f5ae739c404 Mon Sep 17 00:00:00 2001
    From: Bas van Dijk <v.dijk.bas@gmail.com>
    Date: Wed, 14 Dec 2011 12:24:38 +0100
    Subject: [PATCH] Use sharing in the Alternative instance of Maybe
    
    ---
     Control/Applicative.hs |    4 ++--
     1 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/Control/Applicative.hs b/Control/Applicative.hs
    index 248bbac..e69b56e 100644
    a b  
    157157 
    158158instance Alternative Maybe where 
    159159    empty = Nothing 
    160     Nothing <|> p = p 
    161     Just x <|> _ = Just x 
     160    Nothing <|> r = r 
     161    l       <|> _ = l 
    162162 
    163163instance Applicative [] where 
    164164    pure = return