1{-# OPTIONS_GHC -Wall #-}
2module Transform.Expression (crawlLet, checkWires) where
4import Control.Applicative ((<$>),(<*>))
5import AST.Annotation ( Annotated(A) )
6import AST.Expression.General
7import qualified AST.Expression.Canonical as Canonical
8import AST.Type (Type, CanonicalType)
12 :: ([def] -> Either a [def'])
14 -> Either a (Expr ann def' var)
16 crawl (\_ _ -> return ()) (\_ _ -> return ())
20 :: (String -> CanonicalType -> Either a ())
21 -> (String -> CanonicalType -> Either a ())
23 -> Either a Canonical.Expr
24checkWires inputCheck outputCheck expr =
25 crawl inputCheck outputCheck (mapM checkDef) expr
27 checkDef def@(Canonical.Definition _ body _) =
28 do _ <- checkWires inputCheck outputCheck body
33 :: (String -> Type var -> Either a ())
34 -> (String -> Type var -> Either a ())
35 -> ([def] -> Either a [def'])
37 -> Either a (Expr ann def' var)
38crawl inputCheck outputCheck defsTransform =
51 Binop op <$> go e1 <*> go e2
54 Case <$> go e <*> mapM (\(p,b) -> (,) p <$> go b) cases
57 Data name <$> mapM go es
63 Range <$> go e1 <*> go e2
66 ExplicitList <$> mapM go es
69 App <$> go e1 <*> go e2
72 MultiIf <$> mapM (\(b,e) -> (,) <$> go b <*> go e) branches
75 Access <$> go e <*> return lbl
78 Remove <$> go e <*> return lbl
81 Insert <$> go e <*> return lbl <*> go v
84 Modify <$> go e <*> mapM (\(k,v) -> (,) k <$> go v) fields
87 Record <$> mapM (\(k,v) -> (,) k <$> go v) fields
90 Let <$> defsTransform defs <*> go body
92 GLShader uid src gltipe ->
93 return $ GLShader uid src gltipe
97 return $ Input name st
99 Output name st signal ->
100 do outputCheck name st
101 Output name st <$> go signal
103 Loopback name st maybeExpr ->
106 error "loopback check"
108 error "loopback check"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list