{-# LANGUAGE TemplateHaskell #-}
module Feldspar.Run.Compile where
import Control.Monad.Identity
import Control.Monad.Reader
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Constraint (Dict (..))
import Data.Default.Class
import Language.Syntactic hiding ((:+:) (..), (:<:) (..))
import Language.Syntactic.Functional hiding (Binding (..))
import Language.Syntactic.Functional.Tuple
import qualified Control.Monad.Operational.Higher as Oper
import Language.Embedded.Expression
import Language.Embedded.Imperative hiding ((:+:) (..), (:<:) (..))
import Language.Embedded.Concurrent
import qualified Language.Embedded.Imperative as Imp
import Language.Embedded.Backend.C (ExternalCompilerOpts (..))
import qualified Language.Embedded.Backend.C as Imp
import Data.TypedStruct
import Data.Selection
import Feldspar.Primitive.Representation
import Feldspar.Primitive.Backend.C ()
import Feldspar.Representation
import Feldspar.Run.Representation
import Feldspar.Optimize
type VExp = Struct PrimType' Prim
data VExp'
where
VExp' :: Struct PrimType' Prim a -> VExp'
newRefV :: Monad m => TypeRep a -> String -> TargetT m (Struct PrimType' Imp.Ref a)
newRefV :: TypeRep a -> String -> TargetT m (Struct PrimType' Ref a)
newRefV TypeRep a
t String
base = ProgramT
TargetCMD (Param2 Prim PrimType') m (Struct PrimType' Ref a)
-> TargetT m (Struct PrimType' Ref a)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (ProgramT
TargetCMD (Param2 Prim PrimType') m (Struct PrimType' Ref a)
-> TargetT m (Struct PrimType' Ref a))
-> ProgramT
TargetCMD (Param2 Prim PrimType') m (Struct PrimType' Ref a)
-> TargetT m (Struct PrimType' Ref a)
forall a b. (a -> b) -> a -> b
$ (forall a.
PrimType' a =>
PrimTypeRep a
-> ProgramT TargetCMD (Param2 Prim PrimType') m (Ref a))
-> TypeRep a
-> ProgramT
TargetCMD (Param2 Prim PrimType') m (Struct PrimType' Ref a)
forall (m :: * -> *) (pred :: * -> Constraint) (c1 :: * -> *)
(c2 :: * -> *) b.
Applicative m =>
(forall a. pred a => c1 a -> m (c2 a))
-> Struct pred c1 b -> m (Struct pred c2 b)
mapStructA (ProgramT TargetCMD (Param2 Prim PrimType') m (Ref a)
-> PrimTypeRep a
-> ProgramT TargetCMD (Param2 Prim PrimType') m (Ref a)
forall a b. a -> b -> a
const (String -> ProgramT TargetCMD (Param2 Prim PrimType') m (Ref a)
forall (pred :: * -> Constraint) a
(instr :: (* -> *, (* -> *, (* -> Constraint, *))) -> * -> *)
(exp :: * -> *) (m :: * -> *).
(pred a, RefCMD :<: instr) =>
String -> ProgramT instr (Param2 exp pred) m (Ref a)
newNamedRef String
base)) TypeRep a
t
initRefV :: Monad m => String -> VExp a -> TargetT m (Struct PrimType' Imp.Ref a)
initRefV :: String -> VExp a -> TargetT m (Struct PrimType' Ref a)
initRefV String
base = ProgramT
TargetCMD (Param2 Prim PrimType') m (Struct PrimType' Ref a)
-> TargetT m (Struct PrimType' Ref a)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (ProgramT
TargetCMD (Param2 Prim PrimType') m (Struct PrimType' Ref a)
-> TargetT m (Struct PrimType' Ref a))
-> (VExp a
-> ProgramT
TargetCMD (Param2 Prim PrimType') m (Struct PrimType' Ref a))
-> VExp a
-> TargetT m (Struct PrimType' Ref a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall a.
PrimType' a =>
Prim a -> ProgramT TargetCMD (Param2 Prim PrimType') m (Ref a))
-> VExp a
-> ProgramT
TargetCMD (Param2 Prim PrimType') m (Struct PrimType' Ref a)
forall (m :: * -> *) (pred :: * -> Constraint) (c1 :: * -> *)
(c2 :: * -> *) b.
Applicative m =>
(forall a. pred a => c1 a -> m (c2 a))
-> Struct pred c1 b -> m (Struct pred c2 b)
mapStructA (String
-> Prim a -> ProgramT TargetCMD (Param2 Prim PrimType') m (Ref a)
forall (pred :: * -> Constraint) a
(instr :: (* -> *, (* -> *, (* -> Constraint, *))) -> * -> *)
(exp :: * -> *) (m :: * -> *).
(pred a, RefCMD :<: instr) =>
String -> exp a -> ProgramT instr (Param2 exp pred) m (Ref a)
initNamedRef String
base)
getRefV :: Monad m => Struct PrimType' Imp.Ref a -> TargetT m (VExp a)
getRefV :: Struct PrimType' Ref a -> TargetT m (VExp a)
getRefV = ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a)
-> TargetT m (VExp a)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a)
-> TargetT m (VExp a))
-> (Struct PrimType' Ref a
-> ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a))
-> Struct PrimType' Ref a
-> TargetT m (VExp a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall a.
PrimType' a =>
Ref a -> ProgramT TargetCMD (Param2 Prim PrimType') m (Prim a))
-> Struct PrimType' Ref a
-> ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a)
forall (m :: * -> *) (pred :: * -> Constraint) (c1 :: * -> *)
(c2 :: * -> *) b.
Applicative m =>
(forall a. pred a => c1 a -> m (c2 a))
-> Struct pred c1 b -> m (Struct pred c2 b)
mapStructA forall a.
PrimType' a =>
Ref a -> ProgramT TargetCMD (Param2 Prim PrimType') m (Prim a)
forall (pred :: * -> Constraint) a (exp :: * -> *)
(instr :: (* -> *, (* -> *, (* -> Constraint, *))) -> * -> *)
(m :: * -> *).
(pred a, FreeExp exp, FreePred exp a, RefCMD :<: instr, Monad m) =>
Ref a -> ProgramT instr (Param2 exp pred) m (exp a)
getRef
setRefV :: Monad m => Struct PrimType' Imp.Ref a -> VExp a -> TargetT m ()
setRefV :: Struct PrimType' Ref a -> VExp a -> TargetT m ()
setRefV Struct PrimType' Ref a
r = ProgramT TargetCMD (Param2 Prim PrimType') m () -> TargetT m ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (ProgramT TargetCMD (Param2 Prim PrimType') m () -> TargetT m ())
-> (VExp a -> ProgramT TargetCMD (Param2 Prim PrimType') m ())
-> VExp a
-> TargetT m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [ProgramT TargetCMD (Param2 Prim PrimType') m ()]
-> ProgramT TargetCMD (Param2 Prim PrimType') m ()
forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, Monad m) =>
t (m a) -> m ()
sequence_ ([ProgramT TargetCMD (Param2 Prim PrimType') m ()]
-> ProgramT TargetCMD (Param2 Prim PrimType') m ())
-> (VExp a -> [ProgramT TargetCMD (Param2 Prim PrimType') m ()])
-> VExp a
-> ProgramT TargetCMD (Param2 Prim PrimType') m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall a.
PrimType' a =>
Ref a -> Prim a -> ProgramT TargetCMD (Param2 Prim PrimType') m ())
-> Struct PrimType' Ref a
-> VExp a
-> [ProgramT TargetCMD (Param2 Prim PrimType') m ()]
forall (pred :: * -> Constraint) (c1 :: * -> *) (c2 :: * -> *) b r.
(forall a. pred a => c1 a -> c2 a -> r)
-> Struct pred c1 b -> Struct pred c2 b -> [r]
zipListStruct forall a.
PrimType' a =>
Ref a -> Prim a -> ProgramT TargetCMD (Param2 Prim PrimType') m ()
forall (pred :: * -> Constraint) a
(instr :: (* -> *, (* -> *, (* -> Constraint, *))) -> * -> *)
(exp :: * -> *) (m :: * -> *).
(pred a, RefCMD :<: instr) =>
Ref a -> exp a -> ProgramT instr (Param2 exp pred) m ()
setRef Struct PrimType' Ref a
r
unsafeFreezeRefV :: Monad m => Struct PrimType' Imp.Ref a -> TargetT m (VExp a)
unsafeFreezeRefV :: Struct PrimType' Ref a -> TargetT m (VExp a)
unsafeFreezeRefV = ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a)
-> TargetT m (VExp a)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a)
-> TargetT m (VExp a))
-> (Struct PrimType' Ref a
-> ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a))
-> Struct PrimType' Ref a
-> TargetT m (VExp a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall a.
PrimType' a =>
Ref a -> ProgramT TargetCMD (Param2 Prim PrimType') m (Prim a))
-> Struct PrimType' Ref a
-> ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a)
forall (m :: * -> *) (pred :: * -> Constraint) (c1 :: * -> *)
(c2 :: * -> *) b.
Applicative m =>
(forall a. pred a => c1 a -> m (c2 a))
-> Struct pred c1 b -> m (Struct pred c2 b)
mapStructA forall a.
PrimType' a =>
Ref a -> ProgramT TargetCMD (Param2 Prim PrimType') m (Prim a)
forall (pred :: * -> Constraint) a (exp :: * -> *)
(instr :: (* -> *, (* -> *, (* -> Constraint, *))) -> * -> *)
(m :: * -> *).
(pred a, FreeExp exp, FreePred exp a, RefCMD :<: instr, Monad m) =>
Ref a -> ProgramT instr (Param2 exp pred) m (exp a)
unsafeFreezeRef
data CompilerOpts = CompilerOpts
{ CompilerOpts -> Selection AssertionLabel
compilerAssertions :: Selection AssertionLabel
}
instance Default CompilerOpts
where
def :: CompilerOpts
def = CompilerOpts :: Selection AssertionLabel -> CompilerOpts
CompilerOpts
{ compilerAssertions :: Selection AssertionLabel
compilerAssertions = Selection AssertionLabel
forall a. Selection a
universal
}
data Env = Env
{ Env -> Map Name VExp'
envAliases :: Map Name VExp'
, Env -> CompilerOpts
envOptions :: CompilerOpts
}
env0 :: Env
env0 :: Env
env0 = Map Name VExp' -> CompilerOpts -> Env
Env Map Name VExp'
forall k a. Map k a
Map.empty CompilerOpts
forall a. Default a => a
def
localAlias :: MonadReader Env m
=> Name
-> VExp a
-> m b
-> m b
localAlias :: Name -> VExp a -> m b -> m b
localAlias Name
v VExp a
e =
(Env -> Env) -> m b -> m b
forall r (m :: * -> *) a. MonadReader r m => (r -> r) -> m a -> m a
local (\Env
env -> Env
env {envAliases :: Map Name VExp'
envAliases = Name -> VExp' -> Map Name VExp' -> Map Name VExp'
forall k a. Ord k => k -> a -> Map k a -> Map k a
Map.insert Name
v (VExp a -> VExp'
forall a. Struct PrimType' Prim a -> VExp'
VExp' VExp a
e) (Env -> Map Name VExp'
envAliases Env
env)})
lookAlias :: MonadReader Env m => TypeRep a -> Name -> m (VExp a)
lookAlias :: TypeRep a -> Name -> m (VExp a)
lookAlias TypeRep a
t Name
v = do
Map Name VExp'
env <- (Env -> Map Name VExp') -> m (Map Name VExp')
forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks Env -> Map Name VExp'
envAliases
VExp a -> m (VExp a)
forall (m :: * -> *) a. Monad m => a -> m a
return (VExp a -> m (VExp a)) -> VExp a -> m (VExp a)
forall a b. (a -> b) -> a -> b
$ case Name -> Map Name VExp' -> Maybe VExp'
forall k a. Ord k => k -> Map k a -> Maybe a
Map.lookup Name
v Map Name VExp'
env of
Maybe VExp'
Nothing -> String -> VExp a
forall a. HasCallStack => String -> a
error (String -> VExp a) -> String -> VExp a
forall a b. (a -> b) -> a -> b
$ String
"lookAlias: variable " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Name -> String
forall a. Show a => a -> String
show Name
v String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" not in scope"
Just (VExp' Struct PrimType' Prim a
e) -> case TypeRep a -> TypeRep a -> Maybe (Dict (a ~ a))
forall a b. TypeRep a -> TypeRep b -> Maybe (Dict (a ~ b))
typeEq TypeRep a
t (Struct PrimType' Prim a -> TypeRep a
forall (c :: * -> *) a. Struct PrimType' c a -> TypeRep a
toTypeRep Struct PrimType' Prim a
e) of Just Dict (a ~ a)
Dict -> VExp a
Struct PrimType' Prim a
e
type TargetCMD
= RefCMD
Imp.:+: ArrCMD
Imp.:+: ControlCMD
Imp.:+: ThreadCMD
Imp.:+: ChanCMD
Imp.:+: PtrCMD
Imp.:+: FileCMD
Imp.:+: C_CMD
type TargetT m = ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m)
type ProgC = Program TargetCMD (Param2 Prim PrimType')
translateExp :: forall m a . Monad m => Data a -> TargetT m (VExp a)
translateExp :: Data a -> TargetT m (VExp a)
translateExp Data a
a = do
Selection AssertionLabel
cs <- (Env -> Selection AssertionLabel)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Selection AssertionLabel)
forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks (CompilerOpts -> Selection AssertionLabel
compilerAssertions (CompilerOpts -> Selection AssertionLabel)
-> (Env -> CompilerOpts) -> Env -> Selection AssertionLabel
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Env -> CompilerOpts
envOptions)
ASTF FeldDomain a -> TargetT m (VExp a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST (ASTF FeldDomain a -> TargetT m (VExp a))
-> ASTF FeldDomain a -> TargetT m (VExp a)
forall a b. (a -> b) -> a -> b
$ Selection AssertionLabel -> ASTF FeldDomain a -> ASTF FeldDomain a
forall a.
Selection AssertionLabel -> ASTF FeldDomain a -> ASTF FeldDomain a
optimize Selection AssertionLabel
cs (ASTF FeldDomain a -> ASTF FeldDomain a)
-> ASTF FeldDomain a -> ASTF FeldDomain a
forall a b. (a -> b) -> a -> b
$ Data a -> ASTF FeldDomain a
forall a. Data a -> ASTF FeldDomain a
unData Data a
a
where
goAST :: ASTF FeldDomain b -> TargetT m (VExp b)
goAST :: ASTF FeldDomain b -> TargetT m (VExp b)
goAST = (forall sig.
(b ~ DenResult sig) =>
FeldDomain sig -> Args (AST FeldDomain) sig -> TargetT m (VExp b))
-> ASTF FeldDomain b -> TargetT m (VExp b)
forall (sym :: * -> *) a b.
(forall sig.
(a ~ DenResult sig) =>
sym sig -> Args (AST sym) sig -> b)
-> ASTF sym a -> b
simpleMatch (\(s :&: ValT t) -> TypeRep (DenResult sig)
-> FeldConstructs sig
-> Args (AST FeldDomain) sig
-> TargetT m (VExp (DenResult sig))
forall sig.
TypeRep (DenResult sig)
-> FeldConstructs sig
-> Args (AST FeldDomain) sig
-> TargetT m (VExp (DenResult sig))
go TypeRep b
TypeRep (DenResult sig)
t FeldConstructs sig
s)
goSmallAST :: PrimType' b => ASTF FeldDomain b -> TargetT m (Prim b)
goSmallAST :: ASTF FeldDomain b -> TargetT m (Prim b)
goSmallAST = (Struct PrimType' Prim b -> Prim b)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim b)
-> TargetT m (Prim b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Struct PrimType' Prim b -> Prim b
forall (pred :: * -> Constraint) a (c :: * -> *).
pred a =>
Struct pred c a -> c a
extractSingle (ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim b)
-> TargetT m (Prim b))
-> (ASTF FeldDomain b
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim b))
-> ASTF FeldDomain b
-> TargetT m (Prim b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ASTF FeldDomain b
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim b)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST
go :: TypeRep (DenResult sig)
-> FeldConstructs sig
-> Args (AST FeldDomain) sig
-> TargetT m (VExp (DenResult sig))
go :: TypeRep (DenResult sig)
-> FeldConstructs sig
-> Args (AST FeldDomain) sig
-> TargetT m (VExp (DenResult sig))
go TypeRep (DenResult sig)
t FeldConstructs sig
lit Args (AST FeldDomain) sig
Nil
| Just (Lit a
a) <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
lit
= Struct PrimType' Prim a
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (m :: * -> *) a. Monad m => a -> m a
return (Struct PrimType' Prim a
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a))
-> Struct PrimType' Prim a
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall a b. (a -> b) -> a -> b
$ (forall a. PrimType' a => Identity a -> Prim a)
-> Struct PrimType' Identity a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) (c1 :: * -> *) (c2 :: * -> *) b.
(forall a. pred a => c1 a -> c2 a)
-> Struct pred c1 b -> Struct pred c2 b
mapStruct (a -> Prim a
forall (exp :: * -> *) a.
(FreeExp exp, FreePred exp a) =>
a -> exp a
constExp (a -> Prim a) -> (Identity a -> a) -> Identity a -> Prim a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Identity a -> a
forall a. Identity a -> a
runIdentity) (Struct PrimType' Identity a -> Struct PrimType' Prim a)
-> Struct PrimType' Identity a -> Struct PrimType' Prim a
forall a b. (a -> b) -> a -> b
$ Struct PrimType' PrimTypeRep a -> a -> Struct PrimType' Identity a
forall (p :: * -> Constraint) (c :: * -> *) a.
Struct p c a -> a -> Struct p Identity a
toStruct Struct PrimType' PrimTypeRep a
TypeRep (DenResult sig)
t a
a
go TypeRep (DenResult sig)
t FeldConstructs sig
var Args (AST FeldDomain) sig
Nil
| Just (VarT Name
v) <- FeldConstructs sig -> Maybe (BindingT sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
var
= TypeRep a
-> Name
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
forall (m :: * -> *) a.
MonadReader Env m =>
TypeRep a -> Name -> m (VExp a)
lookAlias TypeRep a
TypeRep (DenResult sig)
t Name
v
go TypeRep (DenResult sig)
t FeldConstructs sig
lt (AST FeldDomain (Full a)
a :* (AST FeldDomain (a :-> Full a)
lam :$ AST FeldDomain (Full a)
body) :* Args (AST FeldDomain) sig1
Nil)
| Just (Let String
tag) <- FeldConstructs sig -> Maybe (Let sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
lt
, Just (LamT Name
v) <- AST FeldDomain (a :-> Full a) -> Maybe (BindingT (a :-> Full a))
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj AST FeldDomain (a :-> Full a)
lam
= do let base :: String
base = if String -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null String
tag then String
"let" else String
tag
Struct PrimType' Ref a
r <- String -> VExp a -> TargetT m (Struct PrimType' Ref a)
forall (m :: * -> *) a.
Monad m =>
String -> VExp a -> TargetT m (Struct PrimType' Ref a)
initRefV String
base (VExp a -> TargetT m (Struct PrimType' Ref a))
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
-> TargetT m (Struct PrimType' Ref a)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< AST FeldDomain (Full a)
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
VExp a
a' <- Struct PrimType' Ref a
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
forall (m :: * -> *) a.
Monad m =>
Struct PrimType' Ref a -> TargetT m (VExp a)
unsafeFreezeRefV Struct PrimType' Ref a
r
Name
-> VExp a
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
forall (m :: * -> *) a b.
MonadReader Env m =>
Name -> VExp a -> m b -> m b
localAlias Name
v VExp a
a' (ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a))
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
forall a b. (a -> b) -> a -> b
$ AST FeldDomain (Full a)
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
body
go TypeRep (DenResult sig)
t FeldConstructs sig
tup (AST FeldDomain (Full a)
a :* AST FeldDomain (Full a)
b :* Args (AST FeldDomain) sig1
Nil)
| Just Tuple sig
Pair <- FeldConstructs sig -> Maybe (Tuple sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
tup = Struct PrimType' Prim a
-> Struct PrimType' Prim a -> Struct PrimType' Prim (a, a)
forall (pred :: * -> Constraint) (con :: * -> *) a b.
Struct pred con a -> Struct pred con b -> Struct pred con (a, b)
Two (Struct PrimType' Prim a
-> Struct PrimType' Prim a -> Struct PrimType' Prim (a, a))
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim (a, a))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim (a, a))
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim (a, a))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
b
go TypeRep (DenResult sig)
t FeldConstructs sig
sel (AST FeldDomain (Full a)
ab :* Args (AST FeldDomain) sig1
Nil)
| Just Tuple sig
Fst <- FeldConstructs sig -> Maybe (Tuple sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
sel = do
VExp a
ast <- AST FeldDomain (Full a) -> TargetT m (VExp a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
ab
case VExp a
ast of
Two Struct PrimType' Prim a
a Struct PrimType' Prim b
_ -> Struct PrimType' Prim a
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (m :: * -> *) a. Monad m => a -> m a
return Struct PrimType' Prim a
a
| Just Tuple sig
Snd <- FeldConstructs sig -> Maybe (Tuple sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
sel = do
VExp a
ast <- AST FeldDomain (Full a) -> TargetT m (VExp a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
ab
case VExp a
ast of
Two Struct PrimType' Prim a
_ Struct PrimType' Prim b
b -> Struct PrimType' Prim b
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim b)
forall (m :: * -> *) a. Monad m => a -> m a
return Struct PrimType' Prim b
b
go TypeRep (DenResult sig)
_ FeldConstructs sig
c Args (AST FeldDomain) sig
Nil
| Just Primitive sig
Pi <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
c = Struct PrimType' Prim a
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (m :: * -> *) a. Monad m => a -> m a
return (Struct PrimType' Prim a
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a))
-> Struct PrimType' Prim a
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall a b. (a -> b) -> a -> b
$ Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a (con :: * -> *).
pred a =>
con a -> Struct pred con a
Single (Prim a -> Struct PrimType' Prim a)
-> Prim a -> Struct PrimType' Prim a
forall a b. (a -> b) -> a -> b
$ Primitive (Full a) -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (Full a)
forall a. (Floating a, PrimType' a) => Primitive (Full a)
Pi
go TypeRep (DenResult sig)
_ FeldConstructs sig
op (AST FeldDomain (Full a)
a :* Args (AST FeldDomain) sig1
Nil)
| Just Primitive sig
Neg <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a)
-> Struct PrimType' Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (a :-> Full a) -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> Full a)
forall a. (Num a, PrimType' a) => Primitive (a :-> Full a)
Neg) (Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
| Just Primitive sig
Abs <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a)
-> Struct PrimType' Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (a :-> Full a) -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> Full a)
forall a. (Num a, PrimType' a) => Primitive (a :-> Full a)
Abs) (Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
| Just Primitive sig
Sign <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a)
-> Struct PrimType' Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (a :-> Full a) -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> Full a)
forall a. (Num a, PrimType' a) => Primitive (a :-> Full a)
Sign) (Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
| Just Primitive sig
Exp <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a)
-> Struct PrimType' Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (a :-> Full a) -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> Full a)
forall a. (Floating a, PrimType' a) => Primitive (a :-> Full a)
Exp) (Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
| Just Primitive sig
Log <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a)
-> Struct PrimType' Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (a :-> Full a) -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> Full a)
forall a. (Floating a, PrimType' a) => Primitive (a :-> Full a)
Log) (Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
| Just Primitive sig
Sqrt <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a)
-> Struct PrimType' Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (a :-> Full a) -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> Full a)
forall a. (Floating a, PrimType' a) => Primitive (a :-> Full a)
Sqrt) (Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
| Just Primitive sig
Sin <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a)
-> Struct PrimType' Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (a :-> Full a) -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> Full a)
forall a. (Floating a, PrimType' a) => Primitive (a :-> Full a)
Sin) (Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
| Just Primitive sig
Cos <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a)
-> Struct PrimType' Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (a :-> Full a) -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> Full a)
forall a. (Floating a, PrimType' a) => Primitive (a :-> Full a)
Cos) (Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
| Just Primitive sig
Tan <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a)
-> Struct PrimType' Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (a :-> Full a) -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> Full a)
forall a. (Floating a, PrimType' a) => Primitive (a :-> Full a)
Tan) (Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
| Just Primitive sig
Asin <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a)
-> Struct PrimType' Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (a :-> Full a) -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> Full a)
forall a. (Floating a, PrimType' a) => Primitive (a :-> Full a)
Asin) (Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
| Just Primitive sig
Acos <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a)
-> Struct PrimType' Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (a :-> Full a) -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> Full a)
forall a. (Floating a, PrimType' a) => Primitive (a :-> Full a)
Acos) (Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
| Just Primitive sig
Atan <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a)
-> Struct PrimType' Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (a :-> Full a) -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> Full a)
forall a. (Floating a, PrimType' a) => Primitive (a :-> Full a)
Atan) (Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
| Just Primitive sig
Sinh <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a)
-> Struct PrimType' Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (a :-> Full a) -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> Full a)
forall a. (Floating a, PrimType' a) => Primitive (a :-> Full a)
Sinh) (Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
| Just Primitive sig
Cosh <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a)
-> Struct PrimType' Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (a :-> Full a) -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> Full a)
forall a. (Floating a, PrimType' a) => Primitive (a :-> Full a)
Cosh) (Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
| Just Primitive sig
Tanh <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a)
-> Struct PrimType' Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (a :-> Full a) -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> Full a)
forall a. (Floating a, PrimType' a) => Primitive (a :-> Full a)
Tanh) (Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
| Just Primitive sig
Asinh <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a)
-> Struct PrimType' Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (a :-> Full a) -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> Full a)
forall a. (Floating a, PrimType' a) => Primitive (a :-> Full a)
Asinh) (Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
| Just Primitive sig
Acosh <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a)
-> Struct PrimType' Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (a :-> Full a) -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> Full a)
forall a. (Floating a, PrimType' a) => Primitive (a :-> Full a)
Acosh) (Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
| Just Primitive sig
Atanh <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a)
-> Struct PrimType' Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (a :-> Full a) -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> Full a)
forall a. (Floating a, PrimType' a) => Primitive (a :-> Full a)
Atanh) (Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
| Just Primitive sig
Real <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a)
-> Struct PrimType' Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (Complex a :-> Full a) -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (Complex a :-> Full a)
forall a.
(PrimType' a, PrimType' (Complex a)) =>
Primitive (Complex a :-> Full a)
Real) (Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
| Just Primitive sig
Imag <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a)
-> Struct PrimType' Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (Complex a :-> Full a) -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (Complex a :-> Full a)
forall a.
(PrimType' a, PrimType' (Complex a)) =>
Primitive (Complex a :-> Full a)
Imag) (Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
| Just Primitive sig
Magnitude <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a)
-> Struct PrimType' Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (Complex a :-> Full a) -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (Complex a :-> Full a)
forall a.
(RealFloat a, PrimType' a, PrimType' (Complex a)) =>
Primitive (Complex a :-> Full a)
Magnitude) (Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
| Just Primitive sig
Phase <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a)
-> Struct PrimType' Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (Complex a :-> Full a) -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (Complex a :-> Full a)
forall a.
(RealFloat a, PrimType' a, PrimType' (Complex a)) =>
Primitive (Complex a :-> Full a)
Phase) (Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
| Just Primitive sig
Conjugate <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim (Complex a))
-> Struct PrimType' Prim a -> Struct PrimType' Prim (Complex a)
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (Complex a :-> Full (Complex a))
-> Prim a -> Prim (Complex a)
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (Complex a :-> Full (Complex a))
forall a.
(Num a, PrimType' (Complex a)) =>
Primitive (Complex a :-> Full (Complex a))
Conjugate) (Struct PrimType' Prim a -> Struct PrimType' Prim (Complex a))
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim (Complex a))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
| Just Primitive sig
I2N <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a)
-> Struct PrimType' Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (a :-> Full a) -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> Full a)
forall a a.
(Integral a, Num a, PrimType' a, PrimType' a) =>
Primitive (a :-> Full a)
I2N) (Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
| Just Primitive sig
I2B <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim Bool)
-> Struct PrimType' Prim a -> Struct PrimType' Prim Bool
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (a :-> Full Bool) -> Prim a -> Prim Bool
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> Full Bool)
forall a. (Integral a, PrimType' a) => Primitive (a :-> Full Bool)
I2B) (Struct PrimType' Prim a -> Struct PrimType' Prim Bool)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim Bool)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
| Just Primitive sig
B2I <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a)
-> Struct PrimType' Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (Bool :-> Full a) -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (Bool :-> Full a)
forall a. (Integral a, PrimType' a) => Primitive (Bool :-> Full a)
B2I) (Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
| Just Primitive sig
Round <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a)
-> Struct PrimType' Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (a :-> Full a) -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> Full a)
forall a a.
(RealFrac a, Num a, PrimType' a, PrimType' a) =>
Primitive (a :-> Full a)
Round) (Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
| Just Primitive sig
Not <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim Bool)
-> Struct PrimType' Prim a -> Struct PrimType' Prim Bool
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (Bool :-> Full Bool) -> Prim a -> Prim Bool
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (Bool :-> Full Bool)
Not) (Struct PrimType' Prim a -> Struct PrimType' Prim Bool)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim Bool)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
| Just Primitive sig
BitCompl <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a)
-> Struct PrimType' Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b (con :: * -> *).
(pred a, pred b) =>
(con a -> con b) -> Struct pred con a -> Struct pred con b
liftStruct (Primitive (a :-> Full a) -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> Full a)
forall a. (Bits a, PrimType' a) => Primitive (a :-> Full a)
BitCompl) (Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
go TypeRep (DenResult sig)
_ FeldConstructs sig
op (AST FeldDomain (Full a)
a :* AST FeldDomain (Full a)
b :* Args (AST FeldDomain) sig1
Nil)
| Just Primitive sig
Add <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a -> Prim a)
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b c (con :: * -> *).
(pred a, pred b, pred c) =>
(con a -> con b -> con c)
-> Struct pred con a -> Struct pred con b -> Struct pred con c
liftStruct2 (Primitive (a :-> (a :-> Full a)) -> Prim a -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> (a :-> Full a))
forall a. (Num a, PrimType' a) => Primitive (a :-> (a :-> Full a))
Add) (Struct PrimType' Prim a
-> Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
b
| Just Primitive sig
Sub <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a -> Prim a)
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b c (con :: * -> *).
(pred a, pred b, pred c) =>
(con a -> con b -> con c)
-> Struct pred con a -> Struct pred con b -> Struct pred con c
liftStruct2 (Primitive (a :-> (a :-> Full a)) -> Prim a -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> (a :-> Full a))
forall a. (Num a, PrimType' a) => Primitive (a :-> (a :-> Full a))
Sub) (Struct PrimType' Prim a
-> Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
b
| Just Primitive sig
Mul <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a -> Prim a)
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b c (con :: * -> *).
(pred a, pred b, pred c) =>
(con a -> con b -> con c)
-> Struct pred con a -> Struct pred con b -> Struct pred con c
liftStruct2 (Primitive (a :-> (a :-> Full a)) -> Prim a -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> (a :-> Full a))
forall a. (Num a, PrimType' a) => Primitive (a :-> (a :-> Full a))
Mul) (Struct PrimType' Prim a
-> Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
b
| Just Primitive sig
FDiv <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a -> Prim a)
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b c (con :: * -> *).
(pred a, pred b, pred c) =>
(con a -> con b -> con c)
-> Struct pred con a -> Struct pred con b -> Struct pred con c
liftStruct2 (Primitive (a :-> (a :-> Full a)) -> Prim a -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> (a :-> Full a))
forall a.
(Fractional a, PrimType' a) =>
Primitive (a :-> (a :-> Full a))
FDiv) (Struct PrimType' Prim a
-> Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
b
| Just Primitive sig
Quot <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a -> Prim a)
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b c (con :: * -> *).
(pred a, pred b, pred c) =>
(con a -> con b -> con c)
-> Struct pred con a -> Struct pred con b -> Struct pred con c
liftStruct2 (Primitive (a :-> (a :-> Full a)) -> Prim a -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> (a :-> Full a))
forall a.
(Integral a, PrimType' a) =>
Primitive (a :-> (a :-> Full a))
Quot) (Struct PrimType' Prim a
-> Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
b
| Just Primitive sig
Rem <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a -> Prim a)
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b c (con :: * -> *).
(pred a, pred b, pred c) =>
(con a -> con b -> con c)
-> Struct pred con a -> Struct pred con b -> Struct pred con c
liftStruct2 (Primitive (a :-> (a :-> Full a)) -> Prim a -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> (a :-> Full a))
forall a.
(Integral a, PrimType' a) =>
Primitive (a :-> (a :-> Full a))
Rem) (Struct PrimType' Prim a
-> Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
b
| Just Primitive sig
Div <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a -> Prim a)
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b c (con :: * -> *).
(pred a, pred b, pred c) =>
(con a -> con b -> con c)
-> Struct pred con a -> Struct pred con b -> Struct pred con c
liftStruct2 (Primitive (a :-> (a :-> Full a)) -> Prim a -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> (a :-> Full a))
forall a.
(Integral a, PrimType' a) =>
Primitive (a :-> (a :-> Full a))
Div) (Struct PrimType' Prim a
-> Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
b
| Just Primitive sig
Mod <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a -> Prim a)
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b c (con :: * -> *).
(pred a, pred b, pred c) =>
(con a -> con b -> con c)
-> Struct pred con a -> Struct pred con b -> Struct pred con c
liftStruct2 (Primitive (a :-> (a :-> Full a)) -> Prim a -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> (a :-> Full a))
forall a.
(Integral a, PrimType' a) =>
Primitive (a :-> (a :-> Full a))
Mod) (Struct PrimType' Prim a
-> Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
b
| Just Primitive sig
Complex <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a -> Prim (Complex a))
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
-> Struct PrimType' Prim (Complex a)
forall (pred :: * -> Constraint) a b c (con :: * -> *).
(pred a, pred b, pred c) =>
(con a -> con b -> con c)
-> Struct pred con a -> Struct pred con b -> Struct pred con c
liftStruct2 (Primitive (a :-> (a :-> Full (Complex a)))
-> Prim a -> Prim a -> Prim (Complex a)
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> (a :-> Full (Complex a)))
forall a.
(Num a, PrimType' a, PrimType' (Complex a)) =>
Primitive (a :-> (a :-> Full (Complex a)))
Complex) (Struct PrimType' Prim a
-> Struct PrimType' Prim a -> Struct PrimType' Prim (Complex a))
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim (Complex a))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim (Complex a))
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim (Complex a))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
b
| Just Primitive sig
Polar <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a -> Prim (Complex a))
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
-> Struct PrimType' Prim (Complex a)
forall (pred :: * -> Constraint) a b c (con :: * -> *).
(pred a, pred b, pred c) =>
(con a -> con b -> con c)
-> Struct pred con a -> Struct pred con b -> Struct pred con c
liftStruct2 (Primitive (a :-> (a :-> Full (Complex a)))
-> Prim a -> Prim a -> Prim (Complex a)
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> (a :-> Full (Complex a)))
forall a.
(Floating a, PrimType' a, PrimType' (Complex a)) =>
Primitive (a :-> (a :-> Full (Complex a)))
Polar) (Struct PrimType' Prim a
-> Struct PrimType' Prim a -> Struct PrimType' Prim (Complex a))
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim (Complex a))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim (Complex a))
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim (Complex a))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
b
| Just Primitive sig
Pow <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a -> Prim a)
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b c (con :: * -> *).
(pred a, pred b, pred c) =>
(con a -> con b -> con c)
-> Struct pred con a -> Struct pred con b -> Struct pred con c
liftStruct2 (Primitive (a :-> (a :-> Full a)) -> Prim a -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> (a :-> Full a))
forall a.
(Floating a, PrimType' a) =>
Primitive (a :-> (a :-> Full a))
Pow) (Struct PrimType' Prim a
-> Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
b
| Just Primitive sig
Eq <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a -> Prim Bool)
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
-> Struct PrimType' Prim Bool
forall (pred :: * -> Constraint) a b c (con :: * -> *).
(pred a, pred b, pred c) =>
(con a -> con b -> con c)
-> Struct pred con a -> Struct pred con b -> Struct pred con c
liftStruct2 (Primitive (a :-> (a :-> Full Bool))
-> Prim a -> Prim a -> Prim Bool
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> (a :-> Full Bool))
forall a.
(Eq a, PrimType' a) =>
Primitive (a :-> (a :-> Full Bool))
Eq) (Struct PrimType' Prim a
-> Struct PrimType' Prim a -> Struct PrimType' Prim Bool)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim Bool)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim Bool)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim Bool)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
b
| Just Primitive sig
And <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a -> Prim Bool)
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
-> Struct PrimType' Prim Bool
forall (pred :: * -> Constraint) a b c (con :: * -> *).
(pred a, pred b, pred c) =>
(con a -> con b -> con c)
-> Struct pred con a -> Struct pred con b -> Struct pred con c
liftStruct2 (Primitive (Bool :-> (Bool :-> Full Bool))
-> Prim a -> Prim a -> Prim Bool
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (Bool :-> (Bool :-> Full Bool))
And) (Struct PrimType' Prim a
-> Struct PrimType' Prim a -> Struct PrimType' Prim Bool)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim Bool)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim Bool)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim Bool)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
b
| Just Primitive sig
Or <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a -> Prim Bool)
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
-> Struct PrimType' Prim Bool
forall (pred :: * -> Constraint) a b c (con :: * -> *).
(pred a, pred b, pred c) =>
(con a -> con b -> con c)
-> Struct pred con a -> Struct pred con b -> Struct pred con c
liftStruct2 (Primitive (Bool :-> (Bool :-> Full Bool))
-> Prim a -> Prim a -> Prim Bool
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (Bool :-> (Bool :-> Full Bool))
Or) (Struct PrimType' Prim a
-> Struct PrimType' Prim a -> Struct PrimType' Prim Bool)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim Bool)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim Bool)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim Bool)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
b
| Just Primitive sig
Lt <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a -> Prim Bool)
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
-> Struct PrimType' Prim Bool
forall (pred :: * -> Constraint) a b c (con :: * -> *).
(pred a, pred b, pred c) =>
(con a -> con b -> con c)
-> Struct pred con a -> Struct pred con b -> Struct pred con c
liftStruct2 (Primitive (a :-> (a :-> Full Bool))
-> Prim a -> Prim a -> Prim Bool
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> (a :-> Full Bool))
forall a.
(Ord a, PrimType' a) =>
Primitive (a :-> (a :-> Full Bool))
Lt) (Struct PrimType' Prim a
-> Struct PrimType' Prim a -> Struct PrimType' Prim Bool)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim Bool)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim Bool)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim Bool)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
b
| Just Primitive sig
Gt <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a -> Prim Bool)
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
-> Struct PrimType' Prim Bool
forall (pred :: * -> Constraint) a b c (con :: * -> *).
(pred a, pred b, pred c) =>
(con a -> con b -> con c)
-> Struct pred con a -> Struct pred con b -> Struct pred con c
liftStruct2 (Primitive (a :-> (a :-> Full Bool))
-> Prim a -> Prim a -> Prim Bool
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> (a :-> Full Bool))
forall a.
(Ord a, PrimType' a) =>
Primitive (a :-> (a :-> Full Bool))
Gt) (Struct PrimType' Prim a
-> Struct PrimType' Prim a -> Struct PrimType' Prim Bool)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim Bool)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim Bool)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim Bool)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
b
| Just Primitive sig
Le <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a -> Prim Bool)
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
-> Struct PrimType' Prim Bool
forall (pred :: * -> Constraint) a b c (con :: * -> *).
(pred a, pred b, pred c) =>
(con a -> con b -> con c)
-> Struct pred con a -> Struct pred con b -> Struct pred con c
liftStruct2 (Primitive (a :-> (a :-> Full Bool))
-> Prim a -> Prim a -> Prim Bool
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> (a :-> Full Bool))
forall a.
(Ord a, PrimType' a) =>
Primitive (a :-> (a :-> Full Bool))
Le) (Struct PrimType' Prim a
-> Struct PrimType' Prim a -> Struct PrimType' Prim Bool)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim Bool)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim Bool)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim Bool)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
b
| Just Primitive sig
Ge <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a -> Prim Bool)
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
-> Struct PrimType' Prim Bool
forall (pred :: * -> Constraint) a b c (con :: * -> *).
(pred a, pred b, pred c) =>
(con a -> con b -> con c)
-> Struct pred con a -> Struct pred con b -> Struct pred con c
liftStruct2 (Primitive (a :-> (a :-> Full Bool))
-> Prim a -> Prim a -> Prim Bool
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> (a :-> Full Bool))
forall a.
(Ord a, PrimType' a) =>
Primitive (a :-> (a :-> Full Bool))
Ge) (Struct PrimType' Prim a
-> Struct PrimType' Prim a -> Struct PrimType' Prim Bool)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim Bool)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim Bool)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim Bool)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
b
| Just Primitive sig
BitAnd <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a -> Prim a)
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b c (con :: * -> *).
(pred a, pred b, pred c) =>
(con a -> con b -> con c)
-> Struct pred con a -> Struct pred con b -> Struct pred con c
liftStruct2 (Primitive (a :-> (a :-> Full a)) -> Prim a -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> (a :-> Full a))
forall a. (Bits a, PrimType' a) => Primitive (a :-> (a :-> Full a))
BitAnd) (Struct PrimType' Prim a
-> Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
b
| Just Primitive sig
BitOr <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a -> Prim a)
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b c (con :: * -> *).
(pred a, pred b, pred c) =>
(con a -> con b -> con c)
-> Struct pred con a -> Struct pred con b -> Struct pred con c
liftStruct2 (Primitive (a :-> (a :-> Full a)) -> Prim a -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> (a :-> Full a))
forall a. (Bits a, PrimType' a) => Primitive (a :-> (a :-> Full a))
BitOr) (Struct PrimType' Prim a
-> Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
b
| Just Primitive sig
BitXor <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a -> Prim a)
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b c (con :: * -> *).
(pred a, pred b, pred c) =>
(con a -> con b -> con c)
-> Struct pred con a -> Struct pred con b -> Struct pred con c
liftStruct2 (Primitive (a :-> (a :-> Full a)) -> Prim a -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> (a :-> Full a))
forall a. (Bits a, PrimType' a) => Primitive (a :-> (a :-> Full a))
BitXor) (Struct PrimType' Prim a
-> Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
b
| Just Primitive sig
ShiftL <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a -> Prim a)
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b c (con :: * -> *).
(pred a, pred b, pred c) =>
(con a -> con b -> con c)
-> Struct pred con a -> Struct pred con b -> Struct pred con c
liftStruct2 (Primitive (a :-> (a :-> Full a)) -> Prim a -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> (a :-> Full a))
forall a b.
(Bits a, PrimType' a, Integral b, PrimType' b) =>
Primitive (a :-> (b :-> Full a))
ShiftL) (Struct PrimType' Prim a
-> Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
b
| Just Primitive sig
ShiftR <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
op = (Prim a -> Prim a -> Prim a)
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b c (con :: * -> *).
(pred a, pred b, pred c) =>
(con a -> con b -> con c)
-> Struct pred con a -> Struct pred con b -> Struct pred con c
liftStruct2 (Primitive (a :-> (a :-> Full a)) -> Prim a -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> (a :-> Full a))
forall a b.
(Bits a, PrimType' a, Integral b, PrimType' b) =>
Primitive (a :-> (b :-> Full a))
ShiftR) (Struct PrimType' Prim a
-> Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
b
go TypeRep (DenResult sig)
_ FeldConstructs sig
arrIx (AST FeldDomain (Full a)
i :* Args (AST FeldDomain) sig1
Nil)
| Just (ArrIx IArr Index a
arr) <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
arrIx = do
Prim a
i' <- AST FeldDomain (Full a) -> TargetT m (Prim a)
forall b. PrimType' b => ASTF FeldDomain b -> TargetT m (Prim b)
goSmallAST AST FeldDomain (Full a)
i
Struct PrimType' Prim a
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (m :: * -> *) a. Monad m => a -> m a
return (Struct PrimType' Prim a
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a))
-> Struct PrimType' Prim a
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall a b. (a -> b) -> a -> b
$ Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a (con :: * -> *).
pred a =>
con a -> Struct pred con a
Single (Prim a -> Struct PrimType' Prim a)
-> Prim a -> Struct PrimType' Prim a
forall a b. (a -> b) -> a -> b
$ Primitive (Index :-> Full a) -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim (IArr Index a -> Primitive (Index :-> Full a)
forall a.
PrimType' a =>
IArr Index a -> Primitive (Index :-> Full a)
ArrIx IArr Index a
arr) Prim a
i'
go TypeRep (DenResult sig)
ty FeldConstructs sig
cond (AST FeldDomain (Full a)
c :* AST FeldDomain (Full a)
t :* AST FeldDomain (Full a)
f :* Args (AST FeldDomain) sig1
Nil)
| Just Primitive sig
Cond <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
cond = do
Env
env <- ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) Env
forall r (m :: * -> *). MonadReader r m => m r
ask
case ((ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
-> Env -> ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a))
-> Env
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
-> ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a)
forall a b c. (a -> b -> c) -> b -> a -> c
flip ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
-> Env -> ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a)
forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
runReaderT Env
env (ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
-> ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a))
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
-> ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a)
forall a b. (a -> b) -> a -> b
$ AST FeldDomain (Full a)
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
t, (ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
-> Env -> ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a))
-> Env
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
-> ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a)
forall a b c. (a -> b -> c) -> b -> a -> c
flip ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
-> Env -> ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a)
forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
runReaderT Env
env (ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
-> ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a))
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
-> ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a)
forall a b. (a -> b) -> a -> b
$ AST FeldDomain (Full a)
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
f) of
(ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a)
t',ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a)
f') -> do
ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a)
tView <- ProgramT
TargetCMD
(Param2 Prim PrimType')
m
(ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a))
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a))
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (ProgramT
TargetCMD
(Param2 Prim PrimType')
m
(ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a))
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a)))
-> ProgramT
TargetCMD
(Param2 Prim PrimType')
m
(ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a))
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a))
forall a b. (a -> b) -> a -> b
$ m (ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a))
-> ProgramT
TargetCMD
(Param2 Prim PrimType')
m
(ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a))
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a))
-> ProgramT
TargetCMD
(Param2 Prim PrimType')
m
(ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a)))
-> m (ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a))
-> ProgramT
TargetCMD
(Param2 Prim PrimType')
m
(ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a))
forall a b. (a -> b) -> a -> b
$ ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a)
-> m (ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a))
forall k (m :: * -> *) (instr :: (* -> *, k) -> * -> *) (fs :: k)
a.
Monad m =>
ProgramT instr fs m a -> m (ProgramViewT instr fs m a)
Oper.viewT ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a)
t'
ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a)
fView <- ProgramT
TargetCMD
(Param2 Prim PrimType')
m
(ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a))
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a))
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (ProgramT
TargetCMD
(Param2 Prim PrimType')
m
(ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a))
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a)))
-> ProgramT
TargetCMD
(Param2 Prim PrimType')
m
(ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a))
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a))
forall a b. (a -> b) -> a -> b
$ m (ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a))
-> ProgramT
TargetCMD
(Param2 Prim PrimType')
m
(ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a))
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a))
-> ProgramT
TargetCMD
(Param2 Prim PrimType')
m
(ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a)))
-> m (ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a))
-> ProgramT
TargetCMD
(Param2 Prim PrimType')
m
(ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a))
forall a b. (a -> b) -> a -> b
$ ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a)
-> m (ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a))
forall k (m :: * -> *) (instr :: (* -> *, k) -> * -> *) (fs :: k)
a.
Monad m =>
ProgramT instr fs m a -> m (ProgramViewT instr fs m a)
Oper.viewT ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a)
f'
case (ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a)
tView,ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a)
fView) of
(Oper.Return (Single Prim a
tExp), Oper.Return (Single Prim a
fExp)) -> do
Prim a
c' <- AST FeldDomain (Full a) -> TargetT m (Prim a)
forall b. PrimType' b => ASTF FeldDomain b -> TargetT m (Prim b)
goSmallAST AST FeldDomain (Full a)
c
VExp a
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
forall (m :: * -> *) a. Monad m => a -> m a
return (VExp a
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a))
-> VExp a
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
forall a b. (a -> b) -> a -> b
$ Prim a -> VExp a
forall (pred :: * -> Constraint) a (con :: * -> *).
pred a =>
con a -> Struct pred con a
Single (Prim a -> VExp a) -> Prim a -> VExp a
forall a b. (a -> b) -> a -> b
$ Primitive (Bool :-> (a :-> (a :-> Full a)))
-> Prim a -> Prim a -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (Bool :-> (a :-> (a :-> Full a)))
forall a. Primitive (Bool :-> (a :-> (a :-> Full a)))
Cond Prim a
c' Prim a
tExp Prim a
fExp
(ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a),
ProgramViewT TargetCMD (Param2 Prim PrimType') m (VExp a))
_ -> do
Prim a
c' <- AST FeldDomain (Full a) -> TargetT m (Prim a)
forall b. PrimType' b => ASTF FeldDomain b -> TargetT m (Prim b)
goSmallAST AST FeldDomain (Full a)
c
Struct PrimType' Ref a
res <- TypeRep a -> String -> TargetT m (Struct PrimType' Ref a)
forall (m :: * -> *) a.
Monad m =>
TypeRep a -> String -> TargetT m (Struct PrimType' Ref a)
newRefV TypeRep a
TypeRep (DenResult sig)
ty String
"v"
(Env -> ProgramT TargetCMD (Param2 Prim PrimType') m ())
-> ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ()
forall r (m :: * -> *) a. (r -> m a) -> ReaderT r m a
ReaderT ((Env -> ProgramT TargetCMD (Param2 Prim PrimType') m ())
-> ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ())
-> (Env -> ProgramT TargetCMD (Param2 Prim PrimType') m ())
-> ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ()
forall a b. (a -> b) -> a -> b
$ \Env
env -> Prim Bool
-> ProgramT TargetCMD (Param2 Prim PrimType') m ()
-> ProgramT TargetCMD (Param2 Prim PrimType') m ()
-> ProgramT TargetCMD (Param2 Prim PrimType') m ()
forall (instr :: (* -> *, (* -> *, (* -> Constraint, *)))
-> * -> *)
(exp :: * -> *) (pred :: * -> Constraint) (m :: * -> *).
(ControlCMD :<: instr) =>
exp Bool
-> ProgramT instr (Param2 exp pred) m ()
-> ProgramT instr (Param2 exp pred) m ()
-> ProgramT instr (Param2 exp pred) m ()
iff Prim a
Prim Bool
c'
((ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ()
-> Env -> ProgramT TargetCMD (Param2 Prim PrimType') m ())
-> Env
-> ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ()
-> ProgramT TargetCMD (Param2 Prim PrimType') m ()
forall a b c. (a -> b -> c) -> b -> a -> c
flip ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ()
-> Env -> ProgramT TargetCMD (Param2 Prim PrimType') m ()
forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
runReaderT Env
env (ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ()
-> ProgramT TargetCMD (Param2 Prim PrimType') m ())
-> (VExp a
-> ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ())
-> VExp a
-> ProgramT TargetCMD (Param2 Prim PrimType') m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Struct PrimType' Ref a
-> VExp a
-> ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ()
forall (m :: * -> *) a.
Monad m =>
Struct PrimType' Ref a -> VExp a -> TargetT m ()
setRefV Struct PrimType' Ref a
res (VExp a -> ProgramT TargetCMD (Param2 Prim PrimType') m ())
-> ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a)
-> ProgramT TargetCMD (Param2 Prim PrimType') m ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a)
t')
((ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ()
-> Env -> ProgramT TargetCMD (Param2 Prim PrimType') m ())
-> Env
-> ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ()
-> ProgramT TargetCMD (Param2 Prim PrimType') m ()
forall a b c. (a -> b -> c) -> b -> a -> c
flip ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ()
-> Env -> ProgramT TargetCMD (Param2 Prim PrimType') m ()
forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
runReaderT Env
env (ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ()
-> ProgramT TargetCMD (Param2 Prim PrimType') m ())
-> (VExp a
-> ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ())
-> VExp a
-> ProgramT TargetCMD (Param2 Prim PrimType') m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Struct PrimType' Ref a
-> VExp a
-> ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ()
forall (m :: * -> *) a.
Monad m =>
Struct PrimType' Ref a -> VExp a -> TargetT m ()
setRefV Struct PrimType' Ref a
res (VExp a -> ProgramT TargetCMD (Param2 Prim PrimType') m ())
-> ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a)
-> ProgramT TargetCMD (Param2 Prim PrimType') m ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a)
ProgramT TargetCMD (Param2 Prim PrimType') m (VExp a)
f')
Struct PrimType' Ref a
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
forall (m :: * -> *) a.
Monad m =>
Struct PrimType' Ref a -> TargetT m (VExp a)
unsafeFreezeRefV Struct PrimType' Ref a
res
go TypeRep (DenResult sig)
t FeldConstructs sig
divBal (AST FeldDomain (Full a)
a :* AST FeldDomain (Full a)
b :* Args (AST FeldDomain) sig1
Nil)
| Just ExtraPrimitive sig
DivBalanced <- FeldConstructs sig -> Maybe (ExtraPrimitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
divBal
= (Prim a -> Prim a -> Prim a)
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
-> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a b c (con :: * -> *).
(pred a, pred b, pred c) =>
(con a -> con b -> con c)
-> Struct pred con a -> Struct pred con b -> Struct pred con c
liftStruct2 (Primitive (a :-> (a :-> Full a)) -> Prim a -> Prim a -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim Primitive (a :-> (a :-> Full a))
forall a.
(Integral a, PrimType' a) =>
Primitive (a :-> (a :-> Full a))
Quot) (Struct PrimType' Prim a
-> Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a -> Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
b
go TypeRep (DenResult sig)
t FeldConstructs sig
guard (AST FeldDomain (Full a)
cond :* AST FeldDomain (Full a)
a :* Args (AST FeldDomain) sig1
Nil)
| Just (GuardVal AssertionLabel
c String
msg) <- FeldConstructs sig -> Maybe (ExtraPrimitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
guard
= do Selection AssertionLabel
cs <- (Env -> Selection AssertionLabel)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Selection AssertionLabel)
forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks (CompilerOpts -> Selection AssertionLabel
compilerAssertions (CompilerOpts -> Selection AssertionLabel)
-> (Env -> CompilerOpts) -> Env -> Selection AssertionLabel
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Env -> CompilerOpts
envOptions)
Bool
-> ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ()
-> ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Selection AssertionLabel
cs Selection AssertionLabel -> AssertionLabel -> Bool
forall a. Selection a -> a -> Bool
`includes` AssertionLabel
c) (ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ()
-> ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ())
-> ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ()
-> ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ()
forall a b. (a -> b) -> a -> b
$ do
Prim a
cond' <- Struct PrimType' Prim a -> Prim a
forall (pred :: * -> Constraint) a (c :: * -> *).
pred a =>
Struct pred c a -> c a
extractSingle (Struct PrimType' Prim a -> Prim a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (Prim a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AST FeldDomain (Full a)
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
cond
ProgramT TargetCMD (Param2 Prim PrimType') m ()
-> ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (ProgramT TargetCMD (Param2 Prim PrimType') m ()
-> ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ())
-> ProgramT TargetCMD (Param2 Prim PrimType') m ()
-> ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ()
forall a b. (a -> b) -> a -> b
$ Prim Bool
-> String -> ProgramT TargetCMD (Param2 Prim PrimType') m ()
forall (instr :: (* -> *, (* -> *, (* -> Constraint, *)))
-> * -> *)
(exp :: * -> *) (pred :: * -> Constraint) (m :: * -> *).
(ControlCMD :<: instr) =>
exp Bool -> String -> ProgramT instr (Param2 exp pred) m ()
assert Prim a
Prim Bool
cond' String
msg
AST FeldDomain (Full a) -> TargetT m (VExp a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
a
go TypeRep (DenResult sig)
t FeldConstructs sig
loop (AST FeldDomain (Full a)
len :* AST FeldDomain (Full a)
init :* (AST FeldDomain (a :-> Full a)
lami :$ (AST FeldDomain (a :-> Full a)
lams :$ AST FeldDomain (Full a)
body)) :* Args (AST FeldDomain) sig1
Nil)
| Just ForLoop sig
ForLoop <- FeldConstructs sig -> Maybe (ForLoop sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
loop
, Just (LamT Name
iv) <- AST FeldDomain (a :-> Full a) -> Maybe (BindingT (a :-> Full a))
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj AST FeldDomain (a :-> Full a)
lami
, Just (LamT Name
sv) <- AST FeldDomain (a :-> Full a) -> Maybe (BindingT (a :-> Full a))
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj AST FeldDomain (a :-> Full a)
lams
= do Prim a
len' <- AST FeldDomain (Full a) -> TargetT m (Prim a)
forall b. PrimType' b => ASTF FeldDomain b -> TargetT m (Prim b)
goSmallAST AST FeldDomain (Full a)
len
Struct PrimType' Ref a
state <- String -> VExp a -> TargetT m (Struct PrimType' Ref a)
forall (m :: * -> *) a.
Monad m =>
String -> VExp a -> TargetT m (Struct PrimType' Ref a)
initRefV String
"state" (VExp a -> TargetT m (Struct PrimType' Ref a))
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
-> TargetT m (Struct PrimType' Ref a)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< AST FeldDomain (Full a)
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
init
(Env -> ProgramT TargetCMD (Param2 Prim PrimType') m ())
-> ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ()
forall r (m :: * -> *) a. (r -> m a) -> ReaderT r m a
ReaderT ((Env -> ProgramT TargetCMD (Param2 Prim PrimType') m ())
-> ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ())
-> (Env -> ProgramT TargetCMD (Param2 Prim PrimType') m ())
-> ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ()
forall a b. (a -> b) -> a -> b
$ \Env
env -> IxRange (Prim a)
-> (Prim a -> ProgramT TargetCMD (Param2 Prim PrimType') m ())
-> ProgramT TargetCMD (Param2 Prim PrimType') m ()
forall (exp :: * -> *)
(instr :: (* -> *, (* -> *, (* -> Constraint, *))) -> * -> *) n
(pred :: * -> Constraint) (m :: * -> *).
(FreeExp exp, ControlCMD :<: instr, Integral n, pred n,
FreePred exp n) =>
IxRange (exp n)
-> (exp n -> ProgramT instr (Param2 exp pred) m ())
-> ProgramT instr (Param2 exp pred) m ()
for (Prim a
0, Int
1, Prim a -> Border (Prim a)
forall i. i -> Border i
Excl Prim a
len') ((Prim a -> ProgramT TargetCMD (Param2 Prim PrimType') m ())
-> ProgramT TargetCMD (Param2 Prim PrimType') m ())
-> (Prim a -> ProgramT TargetCMD (Param2 Prim PrimType') m ())
-> ProgramT TargetCMD (Param2 Prim PrimType') m ()
forall a b. (a -> b) -> a -> b
$ \Prim a
i -> (ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ()
-> Env -> ProgramT TargetCMD (Param2 Prim PrimType') m ())
-> Env
-> ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ()
-> ProgramT TargetCMD (Param2 Prim PrimType') m ()
forall a b c. (a -> b -> c) -> b -> a -> c
flip ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ()
-> Env -> ProgramT TargetCMD (Param2 Prim PrimType') m ()
forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
runReaderT Env
env (ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ()
-> ProgramT TargetCMD (Param2 Prim PrimType') m ())
-> ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ()
-> ProgramT TargetCMD (Param2 Prim PrimType') m ()
forall a b. (a -> b) -> a -> b
$ do
VExp a
s <- case TypeRep (DenResult sig)
t of
Single PrimTypeRep (DenResult sig)
_ -> Struct PrimType' Ref a
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
forall (m :: * -> *) a.
Monad m =>
Struct PrimType' Ref a -> TargetT m (VExp a)
unsafeFreezeRefV Struct PrimType' Ref a
state
TypeRep (DenResult sig)
_ -> Struct PrimType' Ref a
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
forall (m :: * -> *) a.
Monad m =>
Struct PrimType' Ref a -> TargetT m (VExp a)
getRefV Struct PrimType' Ref a
state
VExp a
s' <- Name
-> VExp a
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
forall (m :: * -> *) a b.
MonadReader Env m =>
Name -> VExp a -> m b -> m b
localAlias Name
iv (Prim a -> VExp a
forall (pred :: * -> Constraint) a (con :: * -> *).
pred a =>
con a -> Struct pred con a
Single Prim a
i) (ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a))
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
forall a b. (a -> b) -> a -> b
$
Name
-> VExp a
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
forall (m :: * -> *) a b.
MonadReader Env m =>
Name -> VExp a -> m b -> m b
localAlias Name
sv VExp a
s (ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a))
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
forall a b. (a -> b) -> a -> b
$
AST FeldDomain (Full a)
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
forall b. ASTF FeldDomain b -> TargetT m (VExp b)
goAST AST FeldDomain (Full a)
body
Struct PrimType' Ref a
-> VExp a
-> ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') m) ()
forall (m :: * -> *) a.
Monad m =>
Struct PrimType' Ref a -> VExp a -> TargetT m ()
setRefV Struct PrimType' Ref a
state VExp a
VExp a
s'
Struct PrimType' Ref a
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (VExp a)
forall (m :: * -> *) a.
Monad m =>
Struct PrimType' Ref a -> TargetT m (VExp a)
unsafeFreezeRefV Struct PrimType' Ref a
state
go TypeRep (DenResult sig)
_ FeldConstructs sig
free Args (AST FeldDomain) sig
Nil
| Just (FreeVar String
v) <- FeldConstructs sig -> Maybe (Primitive sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
free = Struct PrimType' Prim a
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall (m :: * -> *) a. Monad m => a -> m a
return (Struct PrimType' Prim a
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a))
-> Struct PrimType' Prim a
-> ReaderT
Env
(ProgramT TargetCMD (Param2 Prim PrimType') m)
(Struct PrimType' Prim a)
forall a b. (a -> b) -> a -> b
$ Prim a -> Struct PrimType' Prim a
forall (pred :: * -> Constraint) a (con :: * -> *).
pred a =>
con a -> Struct pred con a
Single (Prim a -> Struct PrimType' Prim a)
-> Prim a -> Struct PrimType' Prim a
forall a b. (a -> b) -> a -> b
$ Primitive (Full a) -> Prim a
forall sig fi (dom :: * -> *) f (sub :: * -> *).
(Signature sig, fi ~ SmartFun dom sig, sig ~ SmartSig fi,
dom ~ SmartSym fi, dom ~ PrimDomain, SyntacticN f fi,
sub :<: Primitive, PrimType' (DenResult sig)) =>
sub sig -> f
sugarSymPrim (Primitive (Full a) -> Prim a) -> Primitive (Full a) -> Prim a
forall a b. (a -> b) -> a -> b
$ String -> Primitive (Full a)
forall a. PrimType' a => String -> Primitive (Full a)
FreeVar String
v
go TypeRep (DenResult sig)
t FeldConstructs sig
unsPerf Args (AST FeldDomain) sig
Nil
| Just (UnsafePerform Comp (Data a)
prog) <- FeldConstructs sig -> Maybe (Unsafe sig)
forall (sub :: * -> *) (sup :: * -> *) a.
Project sub sup =>
sup a -> Maybe (sub a)
prj FeldConstructs sig
unsPerf
= Data a -> TargetT m (VExp a)
forall (m :: * -> *) a. Monad m => Data a -> TargetT m (VExp a)
translateExp (Data a -> TargetT m (VExp a))
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (Data a)
-> TargetT m (VExp a)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<<
(forall b.
Data b
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (Prim b))
-> ProgramT CompCMD '(Data, Param1 PrimType') m (Data a)
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (Data a)
forall k1 k2 (instr1 :: (* -> *, (k1 -> *, k2)) -> * -> *)
(instr2 :: (* -> *, (k1 -> *, k2)) -> * -> *) env (m :: * -> *)
(exp1 :: k1 -> *) (exp2 :: k1 -> *) (fs :: k2) a.
(Reexpressible instr1 instr2 env, Monad m) =>
(forall (b :: k1).
exp1 b -> ReaderT env (ProgramT instr2 '(exp2, fs) m) (exp2 b))
-> ProgramT instr1 '(exp1, fs) m a
-> ReaderT env (ProgramT instr2 '(exp2, fs) m) a
Oper.reexpressEnv forall b.
Data b
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') m) (Prim b)
forall (m :: * -> *) a. Monad m => Data a -> TargetT m (Prim a)
unsafeTransSmallExp (Program CompCMD '(Data, Param1 PrimType') (Data a)
-> ProgramT CompCMD '(Data, Param1 PrimType') m (Data a)
forall k (instr :: (* -> *, k) -> * -> *) (fs :: k) (m :: * -> *)
a.
(HFunctor instr, Monad m) =>
Program instr fs a -> ProgramT instr fs m a
Oper.liftProgram (Program CompCMD '(Data, Param1 PrimType') (Data a)
-> ProgramT CompCMD '(Data, Param1 PrimType') m (Data a))
-> Program CompCMD '(Data, Param1 PrimType') (Data a)
-> ProgramT CompCMD '(Data, Param1 PrimType') m (Data a)
forall a b. (a -> b) -> a -> b
$ Comp (Data a) -> Program CompCMD '(Data, Param1 PrimType') (Data a)
forall a. Comp a -> Program CompCMD '(Data, Param1 PrimType') a
unComp Comp (Data a)
prog)
go TypeRep (DenResult sig)
_ FeldConstructs sig
s Args (AST FeldDomain) sig
_ = String -> TargetT m (VExp (DenResult sig))
forall a. HasCallStack => String -> a
error (String -> TargetT m (VExp (DenResult sig)))
-> String -> TargetT m (VExp (DenResult sig))
forall a b. (a -> b) -> a -> b
$ String
"translateExp: no handling of symbol " String -> String -> String
forall a. [a] -> [a] -> [a]
++ FeldConstructs sig -> String
forall (sym :: * -> *) sig. Render sym => sym sig -> String
renderSym FeldConstructs sig
s
unsafeTransSmallExp :: Monad m => Data a -> TargetT m (Prim a)
unsafeTransSmallExp :: Data a -> TargetT m (Prim a)
unsafeTransSmallExp Data a
a = do
VExp a
exp <- Data a -> TargetT m (VExp a)
forall (m :: * -> *) a. Monad m => Data a -> TargetT m (VExp a)
translateExp Data a
a
case VExp a
exp of Single Prim a
b -> Prim a -> TargetT m (Prim a)
forall (m :: * -> *) a. Monad m => a -> m a
return Prim a
b
translate :: Env -> Run a -> ProgC a
translate :: Env -> Run a -> ProgC a
translate Env
env
= (forall b.
(:+:)
RefCMD
(ArrCMD
:+: (ControlCMD
:+: (ThreadCMD
:+: (ChanCMD :+: (PtrCMD :+: (FileCMD :+: C_CMD))))))
'(ProgramT TargetCMD (Param2 Prim PrimType') Identity,
Param2 Prim PrimType')
b
-> ProgramT TargetCMD (Param2 Prim PrimType') Identity b)
-> (forall b.
ProgramT TargetCMD (Param2 Prim PrimType') Identity b
-> ProgramT TargetCMD (Param2 Prim PrimType') Identity b)
-> ProgramT
TargetCMD
(Param2 Prim PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity)
a
-> ProgC a
forall k (instr :: (* -> *, k) -> * -> *) (fs :: k) (m :: * -> *)
(n :: * -> *) a.
(HFunctor instr, Monad m) =>
(forall b. instr '(m, fs) b -> m b)
-> (forall b. n b -> m b) -> ProgramT instr fs n a -> m a
Oper.interpretWithMonadT forall b.
(:+:)
RefCMD
(ArrCMD
:+: (ControlCMD
:+: (ThreadCMD
:+: (ChanCMD :+: (PtrCMD :+: (FileCMD :+: C_CMD))))))
'(ProgramT TargetCMD (Param2 Prim PrimType') Identity,
Param2 Prim PrimType')
b
-> ProgramT TargetCMD (Param2 Prim PrimType') Identity b
forall k (instr :: (* -> *, k) -> * -> *) (fs :: k) (m :: * -> *)
a.
instr '(ProgramT instr fs m, fs) a -> ProgramT instr fs m a
Oper.singleton forall a. a -> a
forall b.
ProgramT TargetCMD (Param2 Prim PrimType') Identity b
-> ProgramT TargetCMD (Param2 Prim PrimType') Identity b
id
(ProgramT
TargetCMD
(Param2 Prim PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity)
a
-> ProgC a)
-> (Run a
-> ProgramT
TargetCMD
(Param2 Prim PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity)
a)
-> Run a
-> ProgC a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ReaderT
Env
(ProgramT
TargetCMD
(Param2 Prim PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity))
a
-> Env
-> ProgramT
TargetCMD
(Param2 Prim PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity)
a)
-> Env
-> ReaderT
Env
(ProgramT
TargetCMD
(Param2 Prim PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity))
a
-> ProgramT
TargetCMD
(Param2 Prim PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity)
a
forall a b c. (a -> b -> c) -> b -> a -> c
flip ReaderT
Env
(ProgramT
TargetCMD
(Param2 Prim PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity))
a
-> Env
-> ProgramT
TargetCMD
(Param2 Prim PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity)
a
forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
runReaderT Env
env (ReaderT
Env
(ProgramT
TargetCMD
(Param2 Prim PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity))
a
-> ProgramT
TargetCMD
(Param2 Prim PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity)
a)
-> (Run a
-> ReaderT
Env
(ProgramT
TargetCMD
(Param2 Prim PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity))
a)
-> Run a
-> ProgramT
TargetCMD
(Param2 Prim PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity)
a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall b.
Data b
-> ReaderT
Env
(ProgramT
TargetCMD
(Param2 Prim PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity))
(Prim b))
-> ProgramT
(ControlCMD
:+: (PtrCMD :+: (ThreadCMD :+: (ChanCMD :+: (FileCMD :+: C_CMD)))))
'(Data, Param1 PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity)
a
-> ReaderT
Env
(ProgramT
TargetCMD
(Param2 Prim PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity))
a
forall k1 k2 (instr1 :: (* -> *, (k1 -> *, k2)) -> * -> *)
(instr2 :: (* -> *, (k1 -> *, k2)) -> * -> *) env (m :: * -> *)
(exp1 :: k1 -> *) (exp2 :: k1 -> *) (fs :: k2) a.
(Reexpressible instr1 instr2 env, Monad m) =>
(forall (b :: k1).
exp1 b -> ReaderT env (ProgramT instr2 '(exp2, fs) m) (exp2 b))
-> ProgramT instr1 '(exp1, fs) m a
-> ReaderT env (ProgramT instr2 '(exp2, fs) m) a
Oper.reexpressEnv forall b.
Data b
-> ReaderT
Env
(ProgramT
TargetCMD
(Param2 Prim PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity))
(Prim b)
forall (m :: * -> *) a. Monad m => Data a -> TargetT m (Prim a)
unsafeTransSmallExp
(ProgramT
(ControlCMD
:+: (PtrCMD :+: (ThreadCMD :+: (ChanCMD :+: (FileCMD :+: C_CMD)))))
'(Data, Param1 PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity)
a
-> ReaderT
Env
(ProgramT
TargetCMD
(Param2 Prim PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity))
a)
-> (Run a
-> ProgramT
(ControlCMD
:+: (PtrCMD :+: (ThreadCMD :+: (ChanCMD :+: (FileCMD :+: C_CMD)))))
'(Data, Param1 PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity)
a)
-> Run a
-> ReaderT
Env
(ProgramT
TargetCMD
(Param2 Prim PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity))
a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall b.
RunCMD
'(ProgramT
(ControlCMD
:+: (PtrCMD :+: (ThreadCMD :+: (ChanCMD :+: (FileCMD :+: C_CMD)))))
'(Data, Param1 PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity),
'(Data, Param1 PrimType'))
b
-> ProgramT
(ControlCMD
:+: (PtrCMD :+: (ThreadCMD :+: (ChanCMD :+: (FileCMD :+: C_CMD)))))
'(Data, Param1 PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity)
b)
-> (forall b.
Program CompCMD '(Data, Param1 PrimType') b
-> ProgramT
(ControlCMD
:+: (PtrCMD :+: (ThreadCMD :+: (ChanCMD :+: (FileCMD :+: C_CMD)))))
'(Data, Param1 PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity)
b)
-> ProgramT
(ControlCMD
:+: (PtrCMD :+: (ThreadCMD :+: (ChanCMD :+: (FileCMD :+: C_CMD)))))
'(Data, Param1 PrimType')
(Program CompCMD '(Data, Param1 PrimType'))
a
-> ProgramT
(ControlCMD
:+: (PtrCMD :+: (ThreadCMD :+: (ChanCMD :+: (FileCMD :+: C_CMD)))))
'(Data, Param1 PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity)
a
forall k (instr :: (* -> *, k) -> * -> *) (fs :: k) (m :: * -> *)
(n :: * -> *) a.
(HFunctor instr, Monad m) =>
(forall b. instr '(m, fs) b -> m b)
-> (forall b. n b -> m b) -> ProgramT instr fs n a -> m a
Oper.interpretWithMonadT forall b.
RunCMD
'(ProgramT
(ControlCMD
:+: (PtrCMD :+: (ThreadCMD :+: (ChanCMD :+: (FileCMD :+: C_CMD)))))
'(Data, Param1 PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity),
'(Data, Param1 PrimType'))
b
-> ProgramT
(ControlCMD
:+: (PtrCMD :+: (ThreadCMD :+: (ChanCMD :+: (FileCMD :+: C_CMD)))))
'(Data, Param1 PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity)
b
forall k (instr :: (* -> *, k) -> * -> *) (fs :: k) (m :: * -> *)
a.
instr '(ProgramT instr fs m, fs) a -> ProgramT instr fs m a
Oper.singleton
(ProgramT TargetCMD (Param2 Prim PrimType') Identity b
-> ProgramT
(ControlCMD
:+: (PtrCMD :+: (ThreadCMD :+: (ChanCMD :+: (FileCMD :+: C_CMD)))))
'(Data, Param1 PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity)
b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (ProgramT TargetCMD (Param2 Prim PrimType') Identity b
-> ProgramT
(ControlCMD
:+: (PtrCMD :+: (ThreadCMD :+: (ChanCMD :+: (FileCMD :+: C_CMD)))))
'(Data, Param1 PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity)
b)
-> (ProgramT CompCMD '(Data, Param1 PrimType') Identity b
-> ProgramT TargetCMD (Param2 Prim PrimType') Identity b)
-> ProgramT CompCMD '(Data, Param1 PrimType') Identity b
-> ProgramT
(ControlCMD
:+: (PtrCMD :+: (ThreadCMD :+: (ChanCMD :+: (FileCMD :+: C_CMD)))))
'(Data, Param1 PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity)
b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') Identity) b
-> Env -> ProgramT TargetCMD (Param2 Prim PrimType') Identity b)
-> Env
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') Identity) b
-> ProgramT TargetCMD (Param2 Prim PrimType') Identity b
forall a b c. (a -> b -> c) -> b -> a -> c
flip ReaderT Env (ProgramT TargetCMD (Param2 Prim PrimType') Identity) b
-> Env -> ProgramT TargetCMD (Param2 Prim PrimType') Identity b
forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
runReaderT Env
env (ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') Identity) b
-> ProgramT TargetCMD (Param2 Prim PrimType') Identity b)
-> (ProgramT CompCMD '(Data, Param1 PrimType') Identity b
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') Identity) b)
-> ProgramT CompCMD '(Data, Param1 PrimType') Identity b
-> ProgramT TargetCMD (Param2 Prim PrimType') Identity b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall b.
Data b
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') Identity) (Prim b))
-> ProgramT CompCMD '(Data, Param1 PrimType') Identity b
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') Identity) b
forall k1 k2 (instr1 :: (* -> *, (k1 -> *, k2)) -> * -> *)
(instr2 :: (* -> *, (k1 -> *, k2)) -> * -> *) env (m :: * -> *)
(exp1 :: k1 -> *) (exp2 :: k1 -> *) (fs :: k2) a.
(Reexpressible instr1 instr2 env, Monad m) =>
(forall (b :: k1).
exp1 b -> ReaderT env (ProgramT instr2 '(exp2, fs) m) (exp2 b))
-> ProgramT instr1 '(exp1, fs) m a
-> ReaderT env (ProgramT instr2 '(exp2, fs) m) a
Oper.reexpressEnv forall b.
Data b
-> ReaderT
Env (ProgramT TargetCMD (Param2 Prim PrimType') Identity) (Prim b)
forall (m :: * -> *) a. Monad m => Data a -> TargetT m (Prim a)
unsafeTransSmallExp)
(ProgramT
(ControlCMD
:+: (PtrCMD :+: (ThreadCMD :+: (ChanCMD :+: (FileCMD :+: C_CMD)))))
'(Data, Param1 PrimType')
(Program CompCMD '(Data, Param1 PrimType'))
a
-> ProgramT
(ControlCMD
:+: (PtrCMD :+: (ThreadCMD :+: (ChanCMD :+: (FileCMD :+: C_CMD)))))
'(Data, Param1 PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity)
a)
-> (Run a
-> ProgramT
(ControlCMD
:+: (PtrCMD :+: (ThreadCMD :+: (ChanCMD :+: (FileCMD :+: C_CMD)))))
'(Data, Param1 PrimType')
(Program CompCMD '(Data, Param1 PrimType'))
a)
-> Run a
-> ProgramT
(ControlCMD
:+: (PtrCMD :+: (ThreadCMD :+: (ChanCMD :+: (FileCMD :+: C_CMD)))))
'(Data, Param1 PrimType')
(ProgramT TargetCMD (Param2 Prim PrimType') Identity)
a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Run a
-> ProgramT
(ControlCMD
:+: (PtrCMD :+: (ThreadCMD :+: (ChanCMD :+: (FileCMD :+: C_CMD)))))
'(Data, Param1 PrimType')
(Program CompCMD '(Data, Param1 PrimType'))
a
forall a.
Run a
-> ProgramT
(ControlCMD
:+: (PtrCMD :+: (ThreadCMD :+: (ChanCMD :+: (FileCMD :+: C_CMD)))))
'(Data, Param1 PrimType')
(Program CompCMD '(Data, Param1 PrimType'))
a
unRun
instance (Imp.ControlCMD Oper.:<: instr) =>
Oper.Reexpressible AssertCMD instr Env
where
reexpressInstrEnv :: (forall b.
exp1 b -> ReaderT Env (ProgramT instr '(exp2, fs) m) (exp2 b))
-> AssertCMD
'(ReaderT Env (ProgramT instr '(exp2, fs) m), '(exp1, fs)) a
-> ReaderT Env (ProgramT instr '(exp2, fs) m) a
reexpressInstrEnv forall b.
exp1 b -> ReaderT Env (ProgramT instr '(exp2, fs) m) (exp2 b)
reexp (Assert AssertionLabel
c exp Bool
cond String
msg) = do
Selection AssertionLabel
cs <- (Env -> Selection AssertionLabel)
-> ReaderT
Env (ProgramT instr '(exp2, fs) m) (Selection AssertionLabel)
forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks (CompilerOpts -> Selection AssertionLabel
compilerAssertions (CompilerOpts -> Selection AssertionLabel)
-> (Env -> CompilerOpts) -> Env -> Selection AssertionLabel
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Env -> CompilerOpts
envOptions)
Bool
-> ReaderT Env (ProgramT instr '(exp2, fs) m) ()
-> ReaderT Env (ProgramT instr '(exp2, fs) m) ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Selection AssertionLabel
cs Selection AssertionLabel -> AssertionLabel -> Bool
forall a. Selection a -> a -> Bool
`includes` AssertionLabel
c) (ReaderT Env (ProgramT instr '(exp2, fs) m) ()
-> ReaderT Env (ProgramT instr '(exp2, fs) m) ())
-> ReaderT Env (ProgramT instr '(exp2, fs) m) ()
-> ReaderT Env (ProgramT instr '(exp2, fs) m) ()
forall a b. (a -> b) -> a -> b
$
(exp1 Bool -> ReaderT Env (ProgramT instr '(exp2, fs) m) (exp2 Bool)
forall b.
exp1 b -> ReaderT Env (ProgramT instr '(exp2, fs) m) (exp2 b)
reexp exp1 Bool
exp Bool
cond ReaderT Env (ProgramT instr '(exp2, fs) m) (exp2 Bool)
-> (exp2 Bool -> ReaderT Env (ProgramT instr '(exp2, fs) m) ())
-> ReaderT Env (ProgramT instr '(exp2, fs) m) ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ProgramT instr (Param2 exp2 pred) m ()
-> ReaderT Env (ProgramT instr (Param2 exp2 pred) m) ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (ProgramT instr (Param2 exp2 pred) m ()
-> ReaderT Env (ProgramT instr (Param2 exp2 pred) m) ())
-> (exp2 Bool -> ProgramT instr (Param2 exp2 pred) m ())
-> exp2 Bool
-> ReaderT Env (ProgramT instr (Param2 exp2 pred) m) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (exp2 Bool -> String -> ProgramT instr (Param2 exp2 pred) m ())
-> String -> exp2 Bool -> ProgramT instr (Param2 exp2 pred) m ()
forall a b c. (a -> b -> c) -> b -> a -> c
flip exp2 Bool -> String -> ProgramT instr (Param2 exp2 pred) m ()
forall (instr :: (* -> *, (* -> *, (* -> Constraint, *)))
-> * -> *)
(exp :: * -> *) (pred :: * -> Constraint) (m :: * -> *).
(ControlCMD :<: instr) =>
exp Bool -> String -> ProgramT instr (Param2 exp pred) m ()
Imp.assert String
msg)
runIO :: MonadRun m => m a -> IO a
runIO :: m a -> IO a
runIO = Program TargetCMD (Param2 Prim PrimType') a -> IO a
forall k1 (exp :: * -> *)
(instr :: (* -> *, (* -> *, (k1, *))) -> * -> *) (pred :: k1) a.
(EvalExp exp, InterpBi instr IO (Param1 pred), HBifunctor instr) =>
Program instr (Param2 exp pred) a -> IO a
Imp.runIO (Program TargetCMD (Param2 Prim PrimType') a -> IO a)
-> (m a -> Program TargetCMD (Param2 Prim PrimType') a)
-> m a
-> IO a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Env -> Run a -> Program TargetCMD (Param2 Prim PrimType') a
forall a. Env -> Run a -> ProgC a
translate Env
env0 (Run a -> Program TargetCMD (Param2 Prim PrimType') a)
-> (m a -> Run a)
-> m a
-> Program TargetCMD (Param2 Prim PrimType') a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. m a -> Run a
forall (m :: * -> *) a. MonadRun m => m a -> Run a
liftRun
runIO' :: MonadRun m => m a -> IO a
runIO' :: m a -> IO a
runIO'
= (forall b. Data b -> IO b)
-> (forall b. RunCMD '(IO, '(IO, Param1 PrimType')) b -> IO b)
-> (forall b. Program CompCMD '(Data, Param1 PrimType') b -> IO b)
-> ProgramT
(ControlCMD
:+: (PtrCMD :+: (ThreadCMD :+: (ChanCMD :+: (FileCMD :+: C_CMD)))))
'(Data, Param1 PrimType')
(Program CompCMD '(Data, Param1 PrimType'))
a
-> IO a
forall k (instr :: (* -> *, (* -> *, k)) -> * -> *) (m :: * -> *)
(n :: * -> *) (exp :: * -> *) (fs :: k) a.
(HBifunctor instr, Functor m, Monad m, Monad n) =>
(forall b. exp b -> m b)
-> (forall b. instr '(m, '(m, fs)) b -> m b)
-> (forall b. n b -> m b)
-> ProgramT instr '(exp, fs) n a
-> m a
Oper.interpretWithMonadBiT
(b -> IO b
forall (m :: * -> *) a. Monad m => a -> m a
return (b -> IO b) -> (Data b -> b) -> Data b -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Data b -> b
forall (exp :: * -> *) a. EvalExp exp => exp a -> a
evalExp)
forall b. RunCMD '(IO, '(IO, Param1 PrimType')) b -> IO b
forall k k1 (instr :: (k -> *, (k -> *, k1)) -> k -> *)
(m :: k -> *) (fs :: k1) (a :: k).
InterpBi instr m fs =>
instr '(m, '(m, fs)) a -> m a
Oper.interpBi
((forall b. Data b -> IO b)
-> Program CompCMD '(Data, Param1 PrimType') b -> IO b
forall k (i :: (* -> *, (* -> *, k)) -> * -> *) (m :: * -> *)
(fs :: k) (exp :: * -> *) a.
(InterpBi i m fs, HBifunctor i, Functor m, Monad m) =>
(forall b. exp b -> m b) -> Program i '(exp, fs) a -> m a
Imp.interpretBi (b -> IO b
forall (m :: * -> *) a. Monad m => a -> m a
return (b -> IO b) -> (Data b -> b) -> Data b -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Data b -> b
forall (exp :: * -> *) a. EvalExp exp => exp a -> a
evalExp))
(ProgramT
(ControlCMD
:+: (PtrCMD :+: (ThreadCMD :+: (ChanCMD :+: (FileCMD :+: C_CMD)))))
'(Data, Param1 PrimType')
(Program CompCMD '(Data, Param1 PrimType'))
a
-> IO a)
-> (m a
-> ProgramT
(ControlCMD
:+: (PtrCMD :+: (ThreadCMD :+: (ChanCMD :+: (FileCMD :+: C_CMD)))))
'(Data, Param1 PrimType')
(Program CompCMD '(Data, Param1 PrimType'))
a)
-> m a
-> IO a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Run a
-> ProgramT
(ControlCMD
:+: (PtrCMD :+: (ThreadCMD :+: (ChanCMD :+: (FileCMD :+: C_CMD)))))
'(Data, Param1 PrimType')
(Program CompCMD '(Data, Param1 PrimType'))
a
forall a.
Run a
-> ProgramT
(ControlCMD
:+: (PtrCMD :+: (ThreadCMD :+: (ChanCMD :+: (FileCMD :+: C_CMD)))))
'(Data, Param1 PrimType')
(Program CompCMD '(Data, Param1 PrimType'))
a
unRun
(Run a
-> ProgramT
(ControlCMD
:+: (PtrCMD :+: (ThreadCMD :+: (ChanCMD :+: (FileCMD :+: C_CMD)))))
'(Data, Param1 PrimType')
(Program CompCMD '(Data, Param1 PrimType'))
a)
-> (m a -> Run a)
-> m a
-> ProgramT
(ControlCMD
:+: (PtrCMD :+: (ThreadCMD :+: (ChanCMD :+: (FileCMD :+: C_CMD)))))
'(Data, Param1 PrimType')
(Program CompCMD '(Data, Param1 PrimType'))
a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. m a -> Run a
forall (m :: * -> *) a. MonadRun m => m a -> Run a
liftRun
captureIO :: MonadRun m
=> m a
-> String
-> IO String
captureIO :: m a -> String -> IO String
captureIO = Program TargetCMD (Param2 Prim PrimType') a -> String -> IO String
forall k1 (exp :: * -> *)
(instr :: (* -> *, (* -> *, (k1, *))) -> * -> *) (pred :: k1) a.
(EvalExp exp, InterpBi instr IO (Param1 pred), HBifunctor instr) =>
Program instr (Param2 exp pred) a -> String -> IO String
Imp.captureIO (Program TargetCMD (Param2 Prim PrimType') a
-> String -> IO String)
-> (m a -> Program TargetCMD (Param2 Prim PrimType') a)
-> m a
-> String
-> IO String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Env -> Run a -> Program TargetCMD (Param2 Prim PrimType') a
forall a. Env -> Run a -> ProgC a
translate Env
env0 (Run a -> Program TargetCMD (Param2 Prim PrimType') a)
-> (m a -> Run a)
-> m a
-> Program TargetCMD (Param2 Prim PrimType') a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. m a -> Run a
forall (m :: * -> *) a. MonadRun m => m a -> Run a
liftRun
compile' :: MonadRun m => CompilerOpts -> m a -> String
compile' :: CompilerOpts -> m a -> String
compile' CompilerOpts
opts = Program TargetCMD (Param2 Prim PrimType') a -> String
forall k k1 (instr :: (* -> *, (k, (k1, *))) -> * -> *) (exp :: k)
(pred :: k1) a.
(Interp instr CGen (Param2 exp pred), HFunctor instr) =>
Program instr (Param2 exp pred) a -> String
Imp.compile (Program TargetCMD (Param2 Prim PrimType') a -> String)
-> (m a -> Program TargetCMD (Param2 Prim PrimType') a)
-> m a
-> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Env -> Run a -> Program TargetCMD (Param2 Prim PrimType') a
forall a. Env -> Run a -> ProgC a
translate (Map Name VExp' -> CompilerOpts -> Env
Env Map Name VExp'
forall a. Monoid a => a
mempty CompilerOpts
opts) (Run a -> Program TargetCMD (Param2 Prim PrimType') a)
-> (m a -> Run a)
-> m a
-> Program TargetCMD (Param2 Prim PrimType') a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. m a -> Run a
forall (m :: * -> *) a. MonadRun m => m a -> Run a
liftRun
compile :: MonadRun m => m a -> String
compile :: m a -> String
compile = CompilerOpts -> m a -> String
forall (m :: * -> *) a. MonadRun m => CompilerOpts -> m a -> String
compile' CompilerOpts
forall a. Default a => a
def {compilerAssertions :: Selection AssertionLabel
compilerAssertions = Selection AssertionLabel
onlyUserAssertions}
compileAll' :: MonadRun m => CompilerOpts -> m a -> [(String, String)]
compileAll' :: CompilerOpts -> m a -> [(String, String)]
compileAll' CompilerOpts
opts = Program TargetCMD (Param2 Prim PrimType') a -> [(String, String)]
forall k k1 (instr :: (* -> *, (k, (k1, *))) -> * -> *) (exp :: k)
(pred :: k1) a.
(Interp instr CGen (Param2 exp pred), HFunctor instr) =>
Program instr (Param2 exp pred) a -> [(String, String)]
Imp.compileAll (Program TargetCMD (Param2 Prim PrimType') a -> [(String, String)])
-> (m a -> Program TargetCMD (Param2 Prim PrimType') a)
-> m a
-> [(String, String)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Env -> Run a -> Program TargetCMD (Param2 Prim PrimType') a
forall a. Env -> Run a -> ProgC a
translate (Map Name VExp' -> CompilerOpts -> Env
Env Map Name VExp'
forall a. Monoid a => a
mempty CompilerOpts
opts) (Run a -> Program TargetCMD (Param2 Prim PrimType') a)
-> (m a -> Run a)
-> m a
-> Program TargetCMD (Param2 Prim PrimType') a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. m a -> Run a
forall (m :: * -> *) a. MonadRun m => m a -> Run a
liftRun
compileAll :: MonadRun m => m a -> [(String, String)]
compileAll :: m a -> [(String, String)]
compileAll = CompilerOpts -> m a -> [(String, String)]
forall (m :: * -> *) a.
MonadRun m =>
CompilerOpts -> m a -> [(String, String)]
compileAll' CompilerOpts
forall a. Default a => a
def {compilerAssertions :: Selection AssertionLabel
compilerAssertions = Selection AssertionLabel
onlyUserAssertions}
icompile' :: MonadRun m => CompilerOpts -> m a -> IO ()
icompile' :: CompilerOpts -> m a -> IO ()
icompile' CompilerOpts
opts = Program TargetCMD (Param2 Prim PrimType') a -> IO ()
forall k k1 (instr :: (* -> *, (k, (k1, *))) -> * -> *) (exp :: k)
(pred :: k1) a.
(Interp instr CGen (Param2 exp pred), HFunctor instr) =>
Program instr (Param2 exp pred) a -> IO ()
Imp.icompile (Program TargetCMD (Param2 Prim PrimType') a -> IO ())
-> (m a -> Program TargetCMD (Param2 Prim PrimType') a)
-> m a
-> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Env -> Run a -> Program TargetCMD (Param2 Prim PrimType') a
forall a. Env -> Run a -> ProgC a
translate (Map Name VExp' -> CompilerOpts -> Env
Env Map Name VExp'
forall a. Monoid a => a
mempty CompilerOpts
opts) (Run a -> Program TargetCMD (Param2 Prim PrimType') a)
-> (m a -> Run a)
-> m a
-> Program TargetCMD (Param2 Prim PrimType') a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. m a -> Run a
forall (m :: * -> *) a. MonadRun m => m a -> Run a
liftRun
icompile :: MonadRun m => m a -> IO ()
icompile :: m a -> IO ()
icompile = CompilerOpts -> m a -> IO ()
forall (m :: * -> *) a. MonadRun m => CompilerOpts -> m a -> IO ()
icompile' CompilerOpts
forall a. Default a => a
def {compilerAssertions :: Selection AssertionLabel
compilerAssertions = Selection AssertionLabel
onlyUserAssertions}
compileAndCheck' :: MonadRun m
=> CompilerOpts
-> ExternalCompilerOpts
-> m a
-> IO ()
compileAndCheck' :: CompilerOpts -> ExternalCompilerOpts -> m a -> IO ()
compileAndCheck' CompilerOpts
opts ExternalCompilerOpts
eopts =
ExternalCompilerOpts
-> Program TargetCMD (Param2 Prim PrimType') a -> IO ()
forall k k1 (instr :: (* -> *, (k, (k1, *))) -> * -> *) (exp :: k)
(pred :: k1) a.
(Interp instr CGen (Param2 exp pred), HFunctor instr) =>
ExternalCompilerOpts -> Program instr (Param2 exp pred) a -> IO ()
Imp.compileAndCheck' ExternalCompilerOpts
eopts (Program TargetCMD (Param2 Prim PrimType') a -> IO ())
-> (m a -> Program TargetCMD (Param2 Prim PrimType') a)
-> m a
-> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Env -> Run a -> Program TargetCMD (Param2 Prim PrimType') a
forall a. Env -> Run a -> ProgC a
translate (Map Name VExp' -> CompilerOpts -> Env
Env Map Name VExp'
forall a. Monoid a => a
mempty CompilerOpts
opts) (Run a -> Program TargetCMD (Param2 Prim PrimType') a)
-> (m a -> Run a)
-> m a
-> Program TargetCMD (Param2 Prim PrimType') a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. m a -> Run a
forall (m :: * -> *) a. MonadRun m => m a -> Run a
liftRun
compileAndCheck :: MonadRun m => m a -> IO ()
compileAndCheck :: m a -> IO ()
compileAndCheck = CompilerOpts -> ExternalCompilerOpts -> m a -> IO ()
forall (m :: * -> *) a.
MonadRun m =>
CompilerOpts -> ExternalCompilerOpts -> m a -> IO ()
compileAndCheck' CompilerOpts
forall a. Default a => a
def ExternalCompilerOpts
forall a. Default a => a
def
runCompiled' :: MonadRun m
=> CompilerOpts
-> ExternalCompilerOpts
-> m a
-> IO ()
runCompiled' :: CompilerOpts -> ExternalCompilerOpts -> m a -> IO ()
runCompiled' CompilerOpts
opts ExternalCompilerOpts
eopts =
ExternalCompilerOpts
-> Program TargetCMD (Param2 Prim PrimType') a -> IO ()
forall k k1 (instr :: (* -> *, (k, (k1, *))) -> * -> *) (exp :: k)
(pred :: k1) a.
(Interp instr CGen (Param2 exp pred), HFunctor instr) =>
ExternalCompilerOpts -> Program instr (Param2 exp pred) a -> IO ()
Imp.runCompiled' ExternalCompilerOpts
eopts (Program TargetCMD (Param2 Prim PrimType') a -> IO ())
-> (m a -> Program TargetCMD (Param2 Prim PrimType') a)
-> m a
-> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Env -> Run a -> Program TargetCMD (Param2 Prim PrimType') a
forall a. Env -> Run a -> ProgC a
translate (Map Name VExp' -> CompilerOpts -> Env
Env Map Name VExp'
forall a. Monoid a => a
mempty CompilerOpts
opts) (Run a -> Program TargetCMD (Param2 Prim PrimType') a)
-> (m a -> Run a)
-> m a
-> Program TargetCMD (Param2 Prim PrimType') a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. m a -> Run a
forall (m :: * -> *) a. MonadRun m => m a -> Run a
liftRun
runCompiled :: MonadRun m => m a -> IO ()
runCompiled :: m a -> IO ()
runCompiled = CompilerOpts -> ExternalCompilerOpts -> m a -> IO ()
forall (m :: * -> *) a.
MonadRun m =>
CompilerOpts -> ExternalCompilerOpts -> m a -> IO ()
runCompiled' CompilerOpts
forall a. Default a => a
def ExternalCompilerOpts
forall a. Default a => a
def
withCompiled' :: MonadRun m
=> CompilerOpts
-> ExternalCompilerOpts
-> m a
-> ((String -> IO String) -> IO b)
-> IO b
withCompiled' :: CompilerOpts
-> ExternalCompilerOpts
-> m a
-> ((String -> IO String) -> IO b)
-> IO b
withCompiled' CompilerOpts
opts ExternalCompilerOpts
eopts =
ExternalCompilerOpts
-> Program TargetCMD (Param2 Prim PrimType') a
-> ((String -> IO String) -> IO b)
-> IO b
forall k k1 (instr :: (* -> *, (k, (k1, *))) -> * -> *) (exp :: k)
(pred :: k1) a b.
(Interp instr CGen (Param2 exp pred), HFunctor instr) =>
ExternalCompilerOpts
-> Program instr (Param2 exp pred) a
-> ((String -> IO String) -> IO b)
-> IO b
Imp.withCompiled' ExternalCompilerOpts
eopts (Program TargetCMD (Param2 Prim PrimType') a
-> ((String -> IO String) -> IO b) -> IO b)
-> (m a -> Program TargetCMD (Param2 Prim PrimType') a)
-> m a
-> ((String -> IO String) -> IO b)
-> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Env -> Run a -> Program TargetCMD (Param2 Prim PrimType') a
forall a. Env -> Run a -> ProgC a
translate (Map Name VExp' -> CompilerOpts -> Env
Env Map Name VExp'
forall a. Monoid a => a
mempty CompilerOpts
opts) (Run a -> Program TargetCMD (Param2 Prim PrimType') a)
-> (m a -> Run a)
-> m a
-> Program TargetCMD (Param2 Prim PrimType') a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. m a -> Run a
forall (m :: * -> *) a. MonadRun m => m a -> Run a
liftRun
withCompiled :: MonadRun m
=> m a
-> ((String -> IO String) -> IO b)
-> IO b
withCompiled :: m a -> ((String -> IO String) -> IO b) -> IO b
withCompiled = CompilerOpts
-> ExternalCompilerOpts
-> m a
-> ((String -> IO String) -> IO b)
-> IO b
forall (m :: * -> *) a b.
MonadRun m =>
CompilerOpts
-> ExternalCompilerOpts
-> m a
-> ((String -> IO String) -> IO b)
-> IO b
withCompiled' CompilerOpts
forall a. Default a => a
def ExternalCompilerOpts
forall a. Default a => a
def {externalSilent :: Bool
externalSilent = Bool
True}
captureCompiled' :: MonadRun m
=> CompilerOpts
-> ExternalCompilerOpts
-> m a
-> String
-> IO String
captureCompiled' :: CompilerOpts -> ExternalCompilerOpts -> m a -> String -> IO String
captureCompiled' CompilerOpts
opts ExternalCompilerOpts
eopts =
ExternalCompilerOpts
-> Program TargetCMD (Param2 Prim PrimType') a
-> String
-> IO String
forall k k1 (instr :: (* -> *, (k, (k1, *))) -> * -> *) (exp :: k)
(pred :: k1) a.
(Interp instr CGen (Param2 exp pred), HFunctor instr) =>
ExternalCompilerOpts
-> Program instr (Param2 exp pred) a -> String -> IO String
Imp.captureCompiled' ExternalCompilerOpts
eopts (Program TargetCMD (Param2 Prim PrimType') a
-> String -> IO String)
-> (m a -> Program TargetCMD (Param2 Prim PrimType') a)
-> m a
-> String
-> IO String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Env -> Run a -> Program TargetCMD (Param2 Prim PrimType') a
forall a. Env -> Run a -> ProgC a
translate (Map Name VExp' -> CompilerOpts -> Env
Env Map Name VExp'
forall a. Monoid a => a
mempty CompilerOpts
opts) (Run a -> Program TargetCMD (Param2 Prim PrimType') a)
-> (m a -> Run a)
-> m a
-> Program TargetCMD (Param2 Prim PrimType') a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. m a -> Run a
forall (m :: * -> *) a. MonadRun m => m a -> Run a
liftRun
captureCompiled :: MonadRun m
=> m a
-> String
-> IO String
captureCompiled :: m a -> String -> IO String
captureCompiled = CompilerOpts -> ExternalCompilerOpts -> m a -> String -> IO String
forall (m :: * -> *) a.
MonadRun m =>
CompilerOpts -> ExternalCompilerOpts -> m a -> String -> IO String
captureCompiled' CompilerOpts
forall a. Default a => a
def ExternalCompilerOpts
forall a. Default a => a
def
compareCompiled' :: MonadRun m
=> CompilerOpts
-> ExternalCompilerOpts
-> m a
-> IO a
-> String
-> IO ()
compareCompiled' :: CompilerOpts
-> ExternalCompilerOpts -> m a -> IO a -> String -> IO ()
compareCompiled' CompilerOpts
opts ExternalCompilerOpts
eopts =
ExternalCompilerOpts
-> Program TargetCMD (Param2 Prim PrimType') a
-> IO a
-> String
-> IO ()
forall k k1 (instr :: (* -> *, (k, (k1, *))) -> * -> *) (exp :: k)
(pred :: k1) a.
(Interp instr CGen (Param2 exp pred), HFunctor instr) =>
ExternalCompilerOpts
-> Program instr (Param2 exp pred) a -> IO a -> String -> IO ()
Imp.compareCompiled' ExternalCompilerOpts
eopts (Program TargetCMD (Param2 Prim PrimType') a
-> IO a -> String -> IO ())
-> (m a -> Program TargetCMD (Param2 Prim PrimType') a)
-> m a
-> IO a
-> String
-> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Env -> Run a -> Program TargetCMD (Param2 Prim PrimType') a
forall a. Env -> Run a -> ProgC a
translate (Map Name VExp' -> CompilerOpts -> Env
Env Map Name VExp'
forall a. Monoid a => a
mempty CompilerOpts
opts) (Run a -> Program TargetCMD (Param2 Prim PrimType') a)
-> (m a -> Run a)
-> m a
-> Program TargetCMD (Param2 Prim PrimType') a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. m a -> Run a
forall (m :: * -> *) a. MonadRun m => m a -> Run a
liftRun
compareCompiled :: MonadRun m
=> m a
-> IO a
-> String
-> IO ()
compareCompiled :: m a -> IO a -> String -> IO ()
compareCompiled = CompilerOpts
-> ExternalCompilerOpts -> m a -> IO a -> String -> IO ()
forall (m :: * -> *) a.
MonadRun m =>
CompilerOpts
-> ExternalCompilerOpts -> m a -> IO a -> String -> IO ()
compareCompiled' CompilerOpts
forall a. Default a => a
def ExternalCompilerOpts
forall a. Default a => a
def