mirror of
https://github.com/idris-lang/Idris2.git
synced 2025-01-07 08:18:12 +03:00
Merge pull request #564 from ska80/post-idris2boot-cleanups
More post-Idris2-boot cleanups
This commit is contained in:
commit
bed1b8c550
21
INSTALL.md
21
INSTALL.md
@ -44,9 +44,8 @@ Make sure that:
|
|||||||
|
|
||||||
### 2: Installing without an existing Idris 2
|
### 2: Installing without an existing Idris 2
|
||||||
|
|
||||||
If you _don't_ have [Idris-2-in-Idris-1](https://github.com/edwinb/Idris2-boot) installed, you can build from pre-built
|
You can build from pre-built Chez Scheme source, as long as you have Chez Scheme
|
||||||
Chez Scheme source, as long as you have Chez Scheme installed (or,
|
installed (or, alternatively, Racket). To do this, enter one of the following:
|
||||||
alternatively, Racket). To do this, enter one of the following:
|
|
||||||
|
|
||||||
- `make bootstrap SCHEME=chez`
|
- `make bootstrap SCHEME=chez`
|
||||||
- `make bootstrap-racket`
|
- `make bootstrap-racket`
|
||||||
@ -65,20 +64,14 @@ If all is well, to install, type:
|
|||||||
|
|
||||||
- `make install`
|
- `make install`
|
||||||
|
|
||||||
### (Alternative 2: Installing with an existing Idris 2)
|
### 3: Installing with an existing Idris 2
|
||||||
|
|
||||||
If you have [Idris-2-in-Idris-1](https://github.com/edwinb/Idris2-boot)
|
If you have an earlier version of this Idris 2 installed
|
||||||
installed:
|
|
||||||
|
|
||||||
- `make all IDRIS2_BOOT=idris2boot`
|
|
||||||
- `make install IDRIS2_BOOT=idris2boot`
|
|
||||||
|
|
||||||
If you have an earlier version of this Idris 2 installer
|
|
||||||
|
|
||||||
- `make all`
|
- `make all`
|
||||||
- `make install`
|
- `make install`
|
||||||
|
|
||||||
### 3: (Optional) Self-hosting step
|
### 4: (Optional) Self-hosting step
|
||||||
|
|
||||||
As a final step, you can rebuild from the newly installed Idris 2 to verify
|
As a final step, you can rebuild from the newly installed Idris 2 to verify
|
||||||
that everything has worked correctly. Assuming that `idris2` is in your
|
that everything has worked correctly. Assuming that `idris2` is in your
|
||||||
@ -87,12 +80,12 @@ that everything has worked correctly. Assuming that `idris2` is in your
|
|||||||
- `make clean` -- to make sure you're building everything with the new version
|
- `make clean` -- to make sure you're building everything with the new version
|
||||||
- `make all && make install`
|
- `make all && make install`
|
||||||
|
|
||||||
### 4: Running tests
|
### 5: Running tests
|
||||||
|
|
||||||
After `make all`, type `make test` to check everything works. This uses the
|
After `make all`, type `make test` to check everything works. This uses the
|
||||||
executable in `./build/exec`.
|
executable in `./build/exec`.
|
||||||
|
|
||||||
### 5: (Optional) Installing the Idris 2 API
|
### 6: (Optional) Installing the Idris 2 API
|
||||||
|
|
||||||
You'll only need this if you're developing support tools, such as an external
|
You'll only need this if you're developing support tools, such as an external
|
||||||
code generator. To do so, once everything is successfully installed, type:
|
code generator. To do so, once everything is successfully installed, type:
|
||||||
|
@ -35,7 +35,6 @@ import Data.List
|
|||||||
|
|
||||||
-- Data for building recursive calls - the function name, and the structure
|
-- Data for building recursive calls - the function name, and the structure
|
||||||
-- of the LHS. Only recursive calls with a different structure are okay.
|
-- of the LHS. Only recursive calls with a different structure are okay.
|
||||||
public export -- to keep Idris2-boot happy!
|
|
||||||
record RecData where
|
record RecData where
|
||||||
constructor MkRecData
|
constructor MkRecData
|
||||||
{vars : List Name}
|
{vars : List Name}
|
||||||
@ -592,7 +591,7 @@ makeHelper fc rig opts env letty targetty (Result (locapp, ds) next)
|
|||||||
-- Go right to left on variable split, to get the variable we just
|
-- Go right to left on variable split, to get the variable we just
|
||||||
-- added first.
|
-- added first.
|
||||||
-- There must be at least one case split.
|
-- There must be at least one case split.
|
||||||
((helper :: _), nextdef) <-
|
((helper :: _), nextdef) <-
|
||||||
searchN 1 $ gendef (record { getRecData = False,
|
searchN 1 $ gendef (record { getRecData = False,
|
||||||
inUnwrap = True,
|
inUnwrap = True,
|
||||||
depth = depth',
|
depth = depth',
|
||||||
@ -601,14 +600,14 @@ makeHelper fc rig opts env letty targetty (Result (locapp, ds) next)
|
|||||||
helpern 0 ty
|
helpern 0 ty
|
||||||
| _ => do log 10 "No results"
|
| _ => do log 10 "No results"
|
||||||
noResult
|
noResult
|
||||||
|
|
||||||
let helperdef = IDef fc helpern (snd helper)
|
let helperdef = IDef fc helpern (snd helper)
|
||||||
log 10 $ "Def: " ++ show helperdef
|
log 10 $ "Def: " ++ show helperdef
|
||||||
pure (Result (def, helperdef :: ds) -- plus helper
|
pure (Result (def, helperdef :: ds) -- plus helper
|
||||||
(do next' <- next
|
(do next' <- next
|
||||||
makeHelper fc rig opts env letty targetty next'))
|
makeHelper fc rig opts env letty targetty next'))
|
||||||
where
|
where
|
||||||
-- convert a metavar application (as created by 'metaVar') to a normal
|
-- convert a metavar application (as created by 'metaVar') to a normal
|
||||||
-- application (as required by a case block)
|
-- application (as required by a case block)
|
||||||
toApp : forall vars . Term vars -> Term vars
|
toApp : forall vars . Term vars -> Term vars
|
||||||
toApp (Meta fc n i args) = apply fc (Ref fc Func (Resolved i)) args
|
toApp (Meta fc n i args) = apply fc (Ref fc Func (Resolved i)) args
|
||||||
@ -645,8 +644,8 @@ tryIntermediateWith fc rig opts env ((p, pty) :: rest) ty topty
|
|||||||
-- something we can pattern match on (so, NTCon) then apply it,
|
-- something we can pattern match on (so, NTCon) then apply it,
|
||||||
-- let bind the result, and try to generate a definition for
|
-- let bind the result, and try to generate a definition for
|
||||||
-- the scope of the let binding
|
-- the scope of the let binding
|
||||||
do True <- matchable defs
|
do True <- matchable defs
|
||||||
!(sc defs (toClosure defaultOpts env
|
!(sc defs (toClosure defaultOpts env
|
||||||
(Erased fc False)))
|
(Erased fc False)))
|
||||||
| False => noResult
|
| False => noResult
|
||||||
intnty <- genVarName "cty"
|
intnty <- genVarName "cty"
|
||||||
@ -680,7 +679,7 @@ tryIntermediateRec : {vars : _} ->
|
|||||||
{auto m : Ref MD Metadata} ->
|
{auto m : Ref MD Metadata} ->
|
||||||
{auto u : Ref UST UState} ->
|
{auto u : Ref UST UState} ->
|
||||||
FC -> RigCount -> SearchOpts ->
|
FC -> RigCount -> SearchOpts ->
|
||||||
Env Term vars ->
|
Env Term vars ->
|
||||||
Term vars -> ClosedTerm ->
|
Term vars -> ClosedTerm ->
|
||||||
Maybe RecData -> Core (Search (Term vars, ExprDefs))
|
Maybe RecData -> Core (Search (Term vars, ExprDefs))
|
||||||
tryIntermediateRec fc rig opts env ty topty Nothing = noResult
|
tryIntermediateRec fc rig opts env ty topty Nothing = noResult
|
||||||
@ -754,7 +753,7 @@ searchType fc rig opts env topty _ ty
|
|||||||
case recData opts of
|
case recData opts of
|
||||||
Nothing => []
|
Nothing => []
|
||||||
Just rd => [tryRecursive fc rig opts env ty topty rd]
|
Just rd => [tryRecursive fc rig opts env ty topty rd]
|
||||||
let tryIntRec =
|
let tryIntRec =
|
||||||
if doneSplit opts
|
if doneSplit opts
|
||||||
then [tryIntermediateRec fc rig opts env ty topty (recData opts)]
|
then [tryIntermediateRec fc rig opts env ty topty (recData opts)]
|
||||||
else []
|
else []
|
||||||
|
@ -245,10 +245,7 @@ runTest opts testPath
|
|||||||
| Left err => do print err
|
| Left err => do print err
|
||||||
pure False
|
pure False
|
||||||
let result = normalize out == normalize exp
|
let result = normalize out == normalize exp
|
||||||
-- The issue #116 that made this necessary is fixed, but
|
if result
|
||||||
-- please resist putting 'result' here until it's also
|
|
||||||
-- fixed in Idris2-boot!
|
|
||||||
if normalize out == normalize exp
|
|
||||||
then putStrLn "success"
|
then putStrLn "success"
|
||||||
else do
|
else do
|
||||||
putStrLn "FAILURE"
|
putStrLn "FAILURE"
|
||||||
|
Loading…
Reference in New Issue
Block a user