Commits

Maxime Henrion  committed eec3a70

The U1 instance for DeepSeq must pattern match on the U1 constructor instead of
using _. Otherwise, deepseq wouldn't diverge when called on (undefined :: T)
for some type T without arguments, while seq does. In other words, with this
correction, the following now holds:

data Unit = Unit deriving Generic

instance DeepSeq Unit

x `seq` () == x `deepseq` () == _|_
where x = undefined :: Unit

  • Participants
  • Parent commits 05aafc5

Comments (0)

Files changed (1)

File src/Control/DeepSeq.hs

   grnf :: f a -> ()
 
 instance GDeepSeq U1 where
-  grnf _ = ()
+  grnf U1 = ()
 
 instance DeepSeq a => GDeepSeq (K1 i a) where
   grnf = rnf . unK1