    {-# LANGUAGE CPP #-}
    #if __GLASGOW_HASKELL__ >= 704
    {-# LANGUAGE Safe         #-}
    #elif __GLASGOW_HASKELL__ >= 702
    {-# LANGUAGE Trustworthy  #-}
    #endif
    module Data.GADT.DeepSeq (
        GNFData (..),
        ) where

    import Data.Functor.Product (Product (..))
    import Data.Functor.Sum     (Sum (..))

    class GNFData f where
        grnf :: f a -> ()

    instance (GNFData a, GNFData b) => GNFData (Product a b) where
        grnf :: Product a b a -> ()
    grnf (Pair a :: a a
    a b :: b a
    b) = a a -> ()
    forall (f :: * -> *) a. GNFData f => f a -> ()
    grnf a a
    a () -> () -> ()
    forall a b. a -> b -> b
    `seq` b a -> ()
    forall (f :: * -> *) a. GNFData f => f a -> ()
    grnf b a
    b

    instance (GNFData a, GNFData b) => GNFData (Sum a b) where
        grnf :: Sum a b a -> ()
    grnf (InL x :: a a
    x) = a a -> ()
    forall (f :: * -> *) a. GNFData f => f a -> ()
    grnf a a
    x
        grnf (InR y :: b a
    y) = b a -> ()
    forall (f :: * -> *) a. GNFData f => f a -> ()
    grnf b a
    y