{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeOperators #-}
module Data.Comp.DeepSeq
(
NFDataF(..)
)
where
import Control.DeepSeq
import Data.Comp.Annotation
import Data.Comp.Derive
import Data.Comp.Term
instance (NFDataF f, NFData a) => NFData (Cxt h f a) where
rnf (Hole x) = rnf x
rnf (Term x) = rnfF x
instance (NFDataF f, NFData a) => NFDataF (f :&: a) where
rnfF (f :&: a) = rnfF f `seq` rnf a
$(derive [liftSum] [''NFDataF])
$(derive [makeNFDataF] [''Maybe, ''[], ''(,)])