1{-# OPTIONS_GHC -Wall #-}
2module Transform.Expression (crawlLet, checkPorts) 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)
11 :: ([def] -> Either a [def'])
13 -> Either a (Expr ann def' var)
15 crawl (\_ _ -> return ()) (\_ _ -> return ())
19 :: (String -> CanonicalType -> Either a ())
20 -> (String -> CanonicalType -> Either a ())
22 -> Either a Canonical.Expr
23checkPorts inCheck outCheck expr =
24 crawl inCheck outCheck (mapM checkDef) expr
26 checkDef def@(Canonical.Definition _ body _) =
27 do _ <- checkPorts inCheck outCheck body
32 :: (String -> Type var -> Either a ())
33 -> (String -> Type var -> Either a ())
34 -> ([def] -> Either a [def'])
36 -> Either a (Expr ann def' var)
37crawl portInCheck portOutCheck defsTransform =
50 Binop op <$> go e1 <*> go e2
53 Case <$> go e <*> mapM (\(p,b) -> (,) p <$> go b) cases
56 Data name <$> mapM go es
62 Range <$> go e1 <*> go e2
65 ExplicitList <$> mapM go es
68 App <$> go e1 <*> go e2
71 MultiIf <$> mapM (\(b,e) -> (,) <$> go b <*> go e) branches
74 Access <$> go e <*> return lbl
77 Remove <$> go e <*> return lbl
80 Insert <$> go e <*> return lbl <*> go v
83 Modify <$> go e <*> mapM (\(k,v) -> (,) k <$> go v) fields
86 Record <$> mapM (\(k,v) -> (,) k <$> go v) fields
89 Let <$> defsTransform defs <*> go body
91 GLShader uid src gltipe ->
92 return $ GLShader uid src gltipe
95 do portInCheck name st
96 return $ PortIn name st
98 PortOut name st signal ->
99 do portOutCheck name st
100 PortOut name st <$> go signal
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