{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_HADDOCK hide #-}
module Data.Array.Accelerate.AST.Var
where
import Data.Array.Accelerate.Representation.Type
import Data.Array.Accelerate.AST.Idx
import Language.Haskell.TH
data Var s env t = Var (s t) (Idx env t)
type Vars s env = TupR (Var s env)
varsType :: Vars s env t -> TupR s t
varsType :: Vars s env t -> TupR s t
varsType Vars s env t
TupRunit = TupR s t
forall (s :: * -> *). TupR s ()
TupRunit
varsType (TupRsingle (Var s t
t Idx env t
_)) = s t -> TupR s t
forall (s :: * -> *) a. s a -> TupR s a
TupRsingle s t
t
varsType (TupRpair TupR (Var s env) a
a TupR (Var s env) b
b) = TupR s a -> TupR s b -> TupR s (a, b)
forall (s :: * -> *) a b. TupR s a -> TupR s b -> TupR s (a, b)
TupRpair (TupR (Var s env) a -> TupR s a
forall (s :: * -> *) env t. Vars s env t -> TupR s t
varsType TupR (Var s env) a
a) (TupR (Var s env) b -> TupR s b
forall (s :: * -> *) env t. Vars s env t -> TupR s t
varsType TupR (Var s env) b
b)
rnfVar :: (forall b. s b -> ()) -> Var s env t -> ()
rnfVar :: (forall b. s b -> ()) -> Var s env t -> ()
rnfVar forall b. s b -> ()
f (Var s t
t Idx env t
idx) = s t -> ()
forall b. s b -> ()
f s t
t () -> () -> ()
`seq` Idx env t -> ()
forall env t. Idx env t -> ()
rnfIdx Idx env t
idx
rnfVars :: (forall b. s b -> ()) -> Vars s env t -> ()
rnfVars :: (forall b. s b -> ()) -> Vars s env t -> ()
rnfVars forall b. s b -> ()
f = (forall b. Var s env b -> ()) -> Vars s env t -> ()
forall (s :: * -> *) a. (forall b. s b -> ()) -> TupR s a -> ()
rnfTupR ((forall b. s b -> ()) -> Var s env b -> ()
forall (s :: * -> *) env t.
(forall b. s b -> ()) -> Var s env t -> ()
rnfVar forall b. s b -> ()
f)
liftVar :: (forall b. s b -> Q (TExp (s b))) -> Var s env t -> Q (TExp (Var s env t))
liftVar :: (forall b. s b -> Q (TExp (s b)))
-> Var s env t -> Q (TExp (Var s env t))
liftVar forall b. s b -> Q (TExp (s b))
f (Var s t
s Idx env t
idx) = [|| Var $$(f s) $$(liftIdx idx) ||]
liftVars :: (forall b. s b -> Q (TExp (s b))) -> Vars s env t -> Q (TExp (Vars s env t))
liftVars :: (forall b. s b -> Q (TExp (s b)))
-> Vars s env t -> Q (TExp (Vars s env t))
liftVars forall b. s b -> Q (TExp (s b))
f = (forall b. Var s env b -> Q (TExp (Var s env b)))
-> Vars s env t -> Q (TExp (Vars s env t))
forall (s :: * -> *) a.
(forall b. s b -> Q (TExp (s b)))
-> TupR s a -> Q (TExp (TupR s a))
liftTupR ((forall b. s b -> Q (TExp (s b)))
-> Var s env b -> Q (TExp (Var s env b))
forall (s :: * -> *) env t.
(forall b. s b -> Q (TExp (s b)))
-> Var s env t -> Q (TExp (Var s env t))
liftVar forall b. s b -> Q (TExp (s b))
f)