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

import AbsSrc

apps :: Exp -> (Exp,[Exp])
apps e = (f,reverse xs) where
  (f,xs) = aps e
  aps e = case e of
    EApp f x -> let (f',xs) = aps f in (f',x:xs)
    _ -> (e,[])

constr :: Ident -> [Exp] -> Exp
constr = ECst

mkApp :: Exp -> [Exp] -> Exp
mkApp f = foldl EApp f