Skip to content

Commit

Permalink
Prepare to merge branches of processStmt for Bind
Browse files Browse the repository at this point in the history
Now these branches look more obviously parallel.
  • Loading branch information
Blaisorblade committed Feb 6, 2015
1 parent 2d05377 commit 90790cf
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src-lib/PTS/Process/File.hs
Original file line number Diff line number Diff line change
Expand Up @@ -153,18 +153,24 @@ processStmt (Bind n args Nothing body) = recover () $ do
pts <- getLanguage
output (text "")
output (text "process binding of" <+> pretty 0 n)

-- preprocess body
output (nest 2 (sep [text "original term:", nest 2 (pretty 0 t)]))
env <- getBindings
whenOption optShowFullTerms $ output (nest 2 (sep [text "full term:", nest 2 (pretty 0 t)]))

env <- getBindings

-- typecheck pull
t <- runEnvironmentT (typecheckPull t) env
q <- liftEval (reify (typeOf t))
output (nest 2 (sep [text "type:", nest 2 (pretty 0 q)]))

-- do binding
let v = evalTerm env t
putBindings ((n, Binding False v (typeOf t) (sortOf t)) : env)

processStmt (Bind n args (Just body') body) = recover () $ do
let t = foldTelescope mkLam args body
let t' = foldTelescope mkPi args body'
let t = foldTelescope mkLam args body
pts <- getLanguage
output (text "")
output (text "process binding of" <+> pretty 0 n)
Expand All @@ -173,11 +179,13 @@ processStmt (Bind n args (Just body') body) = recover () $ do
output (nest 2 (sep [text "original term:", nest 2 (pretty 0 t)]))
whenOption optShowFullTerms $ output (nest 2 (sep [text "full term", nest 2 (pretty 0 t)]))

env <- getBindings

-- preprocess type
let t' = foldTelescope mkPi args body'
output (nest 2 (sep [text "specified type:", nest 2 (pretty 0 t')]))
let t'' = t'
whenOption optShowFullTerms $ output (nest 2 (sep [text "full type", nest 2 (pretty 0 t'' )]))
env <- getBindings

-- typecheck type
qq <-
Expand All @@ -192,6 +200,7 @@ processStmt (Bind n args (Just body') body) = recover () $ do
t <- runEnvironmentT (typecheckPush t qq) env
let q = typeOf t

-- do binding
let v = evalTerm env t
putBindings ((n, Binding False v (typeOf t) (sortOf t)) : env)

Expand Down

0 comments on commit 90790cf

Please sign in to comment.