GHC.Generics: Ensure some, many for U1 don't bottom
authorBen Gamari <bgamari.foss@gmail.com>
Fri, 26 Feb 2016 22:02:31 +0000 (23:02 +0100)
committerBen Gamari <ben@smart-cactus.org>
Fri, 26 Feb 2016 22:02:37 +0000 (23:02 +0100)
Reviewers: austin, hvr, ekmett, RyanGlScott

Reviewed By: RyanGlScott

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1952

GHC Trac Issues: #11650

libraries/base/GHC/Generics.hs

index 4e01c13..f723127 100644 (file)
@@ -745,6 +745,9 @@ instance Applicative U1 where
 instance Alternative U1 where
   empty = U1
   U1 <|> U1 = U1
+  -- The defaults will otherwise bottom; see #11650.
+  some U1 = U1
+  many U1 = U1
 
 instance Monad U1 where
   U1 >>= _ = U1