Skip to content

Commit

Permalink
[ elab ] Treat (>>) specially in elaborator scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
buzden committed Sep 27, 2024
1 parent 2c3051a commit f66ccc8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libs/base/Language/Reflection.idr
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ data Elab : Type -> Type where
Map : (a -> b) -> Elab a -> Elab b
Ap : Elab (a -> b) -> Elab a -> Elab b
Bind : Elab a -> (a -> Elab b) -> Elab b
Seq : Elab () -> Elab b -> Elab b
Fail : FC -> String -> Elab a
Warn : FC -> String -> Elab ()

Expand Down Expand Up @@ -122,6 +123,7 @@ Alternative Elab where
export
Monad Elab where
(>>=) = Bind
l >> r = Seq l r

-----------------------------
--- Elaboration interface ---
Expand Down
5 changes: 5 additions & 0 deletions src/TTImp/Elab/RunElab.idr
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ elabScript rig fc nest env script@(NDCon nfc nm t ar args) exp
k <- evalClosure defs k
r <- applyToStack defs withAll env k [(getLoc act, toClosure withAll env act)]
elabScript rig fc nest env r exp
elabCon defs "Seq" [_,l,r]
-- l : Elab ()
-- r : Elab A
= do ignore $ elabScript rig fc nest env !(evalClosure defs l) exp
elabScript rig fc nest env !(evalClosure defs r) exp
elabCon defs "Fail" [_, mbfc, msg]
= do msg' <- evalClosure defs msg
throw $ RunElabFail $ GenericMsg !(reifyFC defs mbfc) !(reify defs msg')
Expand Down

0 comments on commit f66ccc8

Please sign in to comment.