Skip to content

Commit

Permalink
Fix GNFData instance for V1 (#20)
Browse files Browse the repository at this point in the history
Make `grnf` for `V1` a well-defined function that forces its
(bottom) argument rather than making the function itself bottom.

Fixes #19
  • Loading branch information
treeowl authored and RyanGlScott committed Aug 16, 2016
1 parent cb66aa8 commit 6ca510a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Control/DeepSeq.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#if __GLASGOW_HASKELL__ >= 706
{-# LANGUAGE PolyKinds #-}
#endif
#if __GLASGOW_HASKELL__ >= 708
{-# LANGUAGE EmptyCase #-}
#endif
-----------------------------------------------------------------------------
-- |
-- Module : Control.DeepSeq
Expand Down Expand Up @@ -114,7 +117,11 @@ class GNFData f where
grnf :: f a -> ()

instance GNFData V1 where
grnf = error "Control.DeepSeq.rnf: uninhabited type"
#if __GLASGOW_HASKELL__ >= 708
grnf x = case x of {}
#else
grnf !_ = error "Control.DeepSeq.rnf: uninhabited type"
#endif

instance GNFData U1 where
grnf U1 = ()
Expand Down

0 comments on commit 6ca510a

Please sign in to comment.