#define DO_TRACE 0
#define WARN_IGNORED_SUBPATTERNS 1
#define NEVER_IGNORE_SUBPATTERNS 0
#define USE_GENERICQ 0
#if USE_SOP
#if __GLASGOW_HASKELL__ < 708
#endif
#endif
module Control.DeepSeq.Bounded.NFDataPDyn
(
rnfpDyn
, deepseqpDyn
, forcepDyn
, rnfpDyn'
, deepseqpDyn'
, forcepDyn'
, rnfpDyn''
, deepseqpDyn''
, forcepDyn''
, module Control.DeepSeq.Bounded.NFDataP
)
where
import Control.DeepSeq.Bounded.NFDataP
import Control.DeepSeq.Bounded.NFDataN
#if USE_WW_DEEPSEQ
import Control.DeepSeq ( NFData )
#endif
import Data.Data ( Data )
#if USE_GENERICQ
import Data.Generics ( GenericQ )
#endif
#if 1
import Data.Typeable ( Typeable )
import Data.Typeable ( typeOf )
#else
#if __GLASGOW_HASKELL__ >= 781
import Data.Typeable ( typeRep )
#else
import Data.Typeable ( typeOf )
#endif
#endif
import Debug.Trace ( trace )
#if USE_SOP
import Generics.SOP hiding ( Shape )
#endif
#if DO_TRACE
mytrace = trace
#else
mytrace _ = id
#endif
deepseqpDyn :: forall a b. (Show a, NFDataP a, Generic a, Data a
, All2 Show (Code a)
, All2 NFData (Code a)
, All2 NFDataN (Code a)
, All2 NFDataP (Code a)
, All2 Data (Code a)
#if USE_GENERICQ
) => GenericQ PatNode -> a -> b -> b
#else
) => (forall c. Data c => c -> PatNode) -> a -> b -> b
#endif
deepseqpDyn fg a b = rnfpDyn fg a `seq` b
deepseqpDyn'' :: forall a b. (Show a, NFDataP a, Generic a, Data a
, All2 Show (Code a)
, All2 NFData (Code a)
, All2 NFDataN (Code a)
, All2 NFDataP (Code a)
) => (forall c. Typeable c => c -> PatNode) -> a -> b -> b
deepseqpDyn'' fg a b = rnfpDyn'' fg a `seq` b
deepseqpDyn' :: forall a b. (Show a, NFDataP a, Generic a, Data a
, All2 Generic (Code a)
, All2 Show (Code a)
, All2 NFData (Code a)
, All2 NFDataN (Code a)
, All2 NFDataP (Code a)
) => (forall c. Generic c => c -> PatNode) -> a -> b -> b
deepseqpDyn' fg a b = rnfpDyn' fg a `seq` b
forcepDyn :: forall a. (Show a, NFDataP a, Generic a, Data a
, All2 Show (Code a)
, All2 NFData (Code a)
, All2 NFDataN (Code a)
, All2 NFDataP (Code a)
, All2 Data (Code a)
#if USE_GENERICQ
) => GenericQ PatNode -> a -> a
#else
) => (forall c. Data c => c -> PatNode) -> a -> a
#endif
forcepDyn fg x = deepseqpDyn fg x x
forcepDyn'' :: forall a. (Show a, NFDataP a, Generic a, Data a
, All2 Show (Code a)
, All2 NFData (Code a)
, All2 NFDataN (Code a)
, All2 NFDataP (Code a)
) => (forall c. Typeable c => c -> PatNode) -> a -> a
forcepDyn'' fg x = deepseqpDyn'' fg x x
forcepDyn' :: forall a. (Show a, NFDataP a, Generic a, Data a
, All2 Generic (Code a)
, All2 Show (Code a)
, All2 NFData (Code a)
, All2 NFDataN (Code a)
, All2 NFDataP (Code a)
) => (forall c. Generic c => c -> PatNode) -> a -> a
forcepDyn' fg x = deepseqpDyn' fg x x
#if USE_SOP
#if 1
rnfpDyn' :: forall a. (
Generic a
, All2 Generic (Code a)
, All2 Show (Code a)
, All2 NFData (Code a)
, All2 NFDataN (Code a)
, All2 NFDataP (Code a)
) =>
( forall c. (
Generic c
) => c -> PatNode
)
-> a
-> ()
rnfpDyn' fg d = rnfpDynS' fg (from d)
rnfpDynS' :: forall xss. (
All2 Generic xss
, All2 Show xss
, All2 NFData xss
, All2 NFDataN xss
, All2 NFDataP xss
) =>
( forall c. (
Generic c
) => c -> PatNode
)
-> SOP I xss
-> ()
rnfpDynS' fg (SOP (Z xs)) = rnfpDynP' fg xs
rnfpDynS' fg (SOP (S xss)) = rnfpDynS' fg (SOP xss)
rnfpDynP' :: forall xs. (
All Generic xs
, All Show xs
, All NFData xs
, All NFDataN xs
, All NFDataP xs
) =>
( forall c. (
Generic c
) => c -> PatNode
)
-> NP I xs
-> ()
rnfpDynP' fg Nil = ()
rnfpDynP' fg (I x :* xs)
| trace (show $ typeOf x) False = undefined
| WI{} <- pn = trace ("Boo A " ) $ rnfpDynP' fg xs `seq` ()
| otherwise = trace ("Boo B "++show x) $ rnfpDynP' fg xs `seq` x `seq` ()
where
pn = fg x
pat = Node pn []
rnfpDyn :: forall a. (
Generic a
, All2 Show (Code a)
, All2 NFData (Code a)
, All2 NFDataN (Code a)
, All2 NFDataP (Code a)
, All2 Data (Code a)
) =>
#if 0
a
#else
#if USE_GENERICQ
GenericQ PatNode
#else
( forall c. (
#if 1
Data c
#else
Generic c
#endif
) => c -> PatNode
)
#endif
-> a
#endif
-> ()
#if 0
rnfpDyn d = ()
#else
rnfpDyn fg d = rnfpDynS fg (from d)
#endif
rnfpDynS :: forall xss. (
All2 Show xss
, All2 NFData xss
, All2 NFDataN xss
, All2 NFDataP xss
, All2 Data xss
) =>
#if 0
SOP I xss
#else
#if USE_GENERICQ
GenericQ PatNode
#else
( forall c. (
Data c
) => c -> PatNode
)
#endif
-> SOP I xss
#endif
-> ()
rnfpDynS fg (SOP (Z xs)) = rnfpDynP fg xs
rnfpDynS fg (SOP (S xss)) = rnfpDynS fg (SOP xss)
rnfpDynP :: forall xs. (
All Show xs
, All NFData xs
, All NFDataN xs
, All NFDataP xs
, All Data xs
) =>
#if 0
NP I xs
#else
#if USE_GENERICQ
GenericQ PatNode
#else
( forall c. (
Data c
) => c -> PatNode
)
#endif
-> NP I xs
#endif
-> ()
rnfpDynP fg Nil = ()
rnfpDynP fg (I x :* xs)
| trace (show $ typeOf x) False = undefined
#if 0
| WI{} <- pn = trace ("AAA "++show x) $ ()
| otherwise = trace ("BBB "++show x) $ ()
#else
| WI{} <- pn = trace ("AAA " ) $ rnfpDynP fg xs `seq` ()
| otherwise = trace ("BBB "++show x) $ rnfpDynP fg xs `seq` x `seq` ()
#endif
where
#if 0
pn = WR emptyPatNodeAttrs
#else
pn = trace (show $ fg x) $ fg x
#endif
pat = Node pn []
#if 0
proxy_a = Proxy :: Proxy a
#endif
rnfpDyn'' :: forall a. (
Generic a
, All2 Show (Code a)
, All2 NFData (Code a)
, All2 NFDataN (Code a)
, All2 NFDataP (Code a)
) =>
( forall c. (
Typeable c
) => c -> PatNode
)
-> a
-> ()
rnfpDyn'' fg d = rnfpDyn''S fg (from d)
rnfpDyn''S :: forall xss. (
All2 Show xss
, All2 NFData xss
, All2 NFDataN xss
, All2 NFDataP xss
) =>
( forall c. (
Typeable c
) => c -> PatNode
)
-> SOP I xss
-> ()
rnfpDyn''S fg (SOP (Z xs)) = rnfpDyn''P fg xs
rnfpDyn''S fg (SOP (S xss)) = rnfpDyn''S fg (SOP xss)
rnfpDyn''P :: forall xs. (
All Show xs
, All NFData xs
, All NFDataN xs
, All NFDataP xs
) =>
( forall c. (
Typeable c
) => c -> PatNode
)
-> NP I xs
-> ()
rnfpDyn''P fg Nil = ()
rnfpDyn''P fg (I x :* xs)
| trace (show $ typeOf x) False = undefined
| WI{} <- pn = trace ("AAA " ) $ rnfpDyn''P fg xs `seq` ()
| otherwise = trace ("BBB "++show x) $ rnfpDyn''P fg xs `seq` x `seq` ()
where
pn = trace (show $ fg x) $ fg x
pat = Node pn []
#else
#if 0
Generic a
, HasDatatypeInfo a
, All2 NFDataP (Code a)
, All2 Show (Code a)
, Typeable a
, NFDataN a
, NFDataP a
#endif
rnfpDyn :: forall a. (
Generic a
, All2 Show (Code a)
, All2 NFDataP (Code a)
, All2 NFData (Code a)
, NFDataP a
, NFData a
) =>
#if 1
a
#else
( forall b. (
Generic b
, All2 Show (Code b)
) => b -> PatNode
)
-> a
#endif
-> ()
#if 1
rnfpDyn d
#else
rnfpDyn fg d
#endif
#if 1
= (rnfp pat . hcollapse . hcliftA (Proxy :: Proxy a) (\ (I x) -> K (rnfpDyn x)) . from) d
#else
= (rnfp pat . hcollapse . hcliftA (Proxy :: Proxy NFDataP) (\ (I x) -> K (rnfpDyn fg x)) . from) d
#endif
where
#if 1
pn = WR emptyPatNodeAttrs
#else
pn = fg d
#endif
pat = Node pn []
proxy_a = Proxy :: Proxy a
#endif
#else
#error Cannot use NFDataPDyn without flag USE_SOP being True (at least at this time).
#endif