-
Notifications
You must be signed in to change notification settings - Fork 0
REPL
Filip Sieczkowski edited this page Sep 27, 2013
·
4 revisions
Right now, calling it a REPL is an overstatement: it's a read-typecheck-print-loop, but that's the important part. An expression or declaration typed into the command line will type-check the term, print the type and, ind the case of a declaration, add the binding to the environment. In addition, there's several commands:
-
:load "filename"
— loads the definitions fromfilename
. Quotes are mandatory (sorry). -
:showAll
— print the types of all the holes in the currently read program -
:show [n]
— show the typing context and the type of then
-th hole. The variant without any number is only valid if focused -
:focus n
— focus on then
-th hole -
:unfocus
— just what it says on the tin -
:refine [n] expr
— fill in then
-th hole with the expressionexpr
. As withshow
, if focused, the number can be omitted. -
:apply [n] expr
— apply the expression to the (n
-th or focused) hole. This command tries to match the type of the hole with the type ofexpr
and, ifexpr
requires extra arguments to match the type, leaves the appropriate number of holes. For example, iffoo : A -> B -> C
, and the type of the hole isB -> C
, the tactic will generate one hole of typeA
. -
:case [n] expr
— refine the hole with a case-expression usingexpr
as the splitting term. All the alternatives are generated, each with a new hole. -
:clear
— reset the whole environment of the REPL (declarations and holes).
At this time, the best idea is to run the REPL, load up the code from "examples/stuff.esml" file, and play with refining/applying stuff to see how it works.