Skip to content

Fix GNFData instance for V1 #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 16, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix GNFData instance for V1
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 committed Jul 18, 2016
commit 75cac8b89cc1c0de61bcbc06ec0841b0f981c86c
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