summaryrefslogtreecommitdiff
path: root/devel/compiler/TMacros.hs
blob: 467b6ce4f37b4c80264d545436d13fcc4b99195d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
module TMacros where

import AbsTgt

appVal :: Val -> [Val] -> Val
appVal v vs = compVal vs v

compVal :: [Val] -> Val -> Val
compVal args = comp where
  comp val = case val of
    VRec vs  -> VRec $ map comp vs
    VPro r p -> case (comp r, comp p) of
      (VRec vs, VPar i) -> vs !! fromInteger i 
    VArg i   -> args !! fromInteger i
    VCat x y -> VCat (comp x) (comp y)
    _ -> val