1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-23 23:30:40 +03:00
Commit Graph

1628 Commits

Author SHA1 Message Date
Łukasz Czajka
58d1f434bc
Make top-level definitions mutually recursive (#3250)
All top-level definitions are now back to being recursive, except
definitions with pattern-matching on the left-hand side, e.g.,
```
(x, y) := ...;
```
is not recursive on the top level.
2024-12-19 09:37:17 +01:00
Łukasz Czajka
cb10fe3080
Allow module self-reference (#3240)
* Closes #3031

---------

Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
2024-12-18 10:03:49 +01:00
Łukasz Czajka
af191423a9
Update Juvix Cairo VM (#3249) 2024-12-17 17:36:20 +01:00
Paul Cadman
31a5b2ca4b
Add support for Anoma RM is-commitment and is-nullifier (#3242)
These functions are required to translate the RM proof record self-tag
field to a Juvix type that differentiates between nullifiers and
commitments. This information is required when writing logic functions.
2024-12-17 14:34:14 +01:00
Paul Cadman
8272ee32c1
Add RPC call and dev command for Anoma.Protobuf.IndexerService.ListUnrevealedCommits (#3239)
This PR adds support for
`Anoma.Protobuf.IndexerService.ListUnrevealedCommits` via the CLI:

```
$ juvix dev anoma indexer list-unrevealed-commits --help
Usage: juvix dev anoma indexer list-unrevealed-commits [-o|--output OUTPUT_FILE]

  Call the Anoma.Protobuf.IndexerService.ListUnrevealedCommits endpoint

Available options:
  -o,--output OUTPUT_FILE  Path to output file
  -h,--help                Show this help text
```

It also adds a test suite for Anoma client transaction submissions /
verification.

The Swap example using the Resource Machine API is tested with the
following flow:

1. Compile the Swap example
2. Submit the compiled output to the prove endpoint - capture the
expected commitment in a trace
3. Submit the proved output to add-transaction
4. Poll ListUnrevealedCommits until a commit appears and compare it with
the commitment we captured in 2.
2024-12-07 17:51:10 +01:00
Jan Mas Rovira
936045fe49
Fix printing of indented block comments (#3225)
- Closes #3143 

The formatting of block comments has changed slightly.
A comment block has the syntax `{- multi-line-text -}`.
The rules are:
1. The first line, i.e. the line that starts with `{-` is trimmed of
trailing space.
2. The last line, i.e. the line that ends with `-}` is trimmed of prefix
space.
3. Lines in the middle are trimmed of prefix and trailing space.

This makes it impossible to have such a comment:
```
{-
  indented
-}
```
The reasoning is that if we don't want to have an indentation sensitive
parser we have two choices.
1. Print all comments flushed to the left
2. Do not have indentation in the middle lines.

I thought 2. was better

---------

Co-authored-by: Łukasz Czajka <62751+lukaszcz@users.noreply.github.com>
2024-12-06 19:51:51 +01:00
Jan Mas Rovira
5029a566f5
Fix highlighting of comments (#3226)
`highlightParsedItem` was not being called for comments
2024-12-06 18:19:10 +01:00
Jan Mas Rovira
69c629bc7e
Add TopDef property for specs (#3223)
This pr implements a request for the Specs team by @jonaprieto.

`juvix dev highlight --format json` now also outputs an additional field
`topDef` that contains a list of pairs containing a file interval (with
the usual encoding) and an identifier.
e.g
```
[["/home/jan/projects/juvix/juvix-stdlib/Stdlib/Extra/Gcd.juvix",10,1,4,10,4],"gcd"]
```
2024-12-06 15:54:17 +01:00
Łukasz Czajka
d81585532d
Fix basic block calls in the Reg -> CASM translation (#3238)
* Closes #3237 
* The order of arguments passed to the next basic block was inconsistent
among different branches of an if/case. This manifested itself only when
the branches ended with different operations (e.g., one with a call,
another with assignment), the result of the branching was used later on
(the branching was not at tail position), and variables declared before
the branch were used after it in a specific way.

---------

Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
2024-12-06 14:28:28 +01:00
Łukasz Czajka
363ce11501
Debug tooling improvements for Reg and CASM (#3232)
* Correctly parse `itof`, `ftoi` in JuvixReg
* Print comments in CASM output
2024-12-06 13:09:13 +01:00
Jan Mas Rovira
3e367aa560
Format Package.juvix when formatting project (#3219)
- Closes #3217, #2898
2024-12-06 11:57:42 +01:00
Paul Cadman
4eb75093c5
Update anoma ref to latest lukasz/juvix-integration-tracking (#3227)
The Anoma update contains:

* the new jam/cue implementation on the node which is required to get
the Swap example working
* update the Anoma nock anomalib API which contains the new
is-commitment and is-nullifier APIs (though these will be exposed in a
future PR).

The `lukasz/juvix-integration-tracking` branch was updated using:

```
git merge -X theirs origin/artem/juvix-node-integration-v0.28
```
2024-12-06 09:46:51 +00:00
Jan Mas Rovira
37003867c8
Append unique hash to the pre-release tag in the Package.juvix version (#3215)
- Fixes #2985 
- Fixes #3154 

This pr fixes the above issues by appending the hash of all project
files in the package version. In particular, it appends the hash to the
pre-release tag.
Also, when recursing in an import, we properly update the PackageId in
the Entrypoint.

---------

Co-authored-by: Lukasz Czajka <lukasz@heliax.dev>
2024-12-06 09:29:57 +01:00
Paul Cadman
bb8211bf5a
anoma start should start the consensus engine (#3229)
The consensus engine is responsible for executing transactions in the
mempool and making blocks.
2024-12-05 18:12:27 +01:00
Łukasz Czajka
1a76df9486
Fix RISC0 CI (#3233) 2024-12-05 14:12:21 +01:00
Łukasz Czajka
021fc0ccb8
Remove @? (#3216)
* Closes #3210
2024-12-04 15:59:02 +01:00
Łukasz Czajka
70cbdd0a30
Global option --no-check (#3224)
The `--no-check` option disables the backend-specific sanity check in
Core (the transformations in `Check/*`, which check the type of main,
use of builtins, etc). This is useful for debugging.
2024-12-04 13:39:20 +01:00
Łukasz Czajka
c79f5e3462
Inline non-recursive functions with only one call site (#3204)
* Closes #3198
2024-12-04 12:00:58 +01:00
Jan Mas Rovira
af9679d557
Merge Log effect into Logger effect (#3220) 2024-12-03 19:25:02 +01:00
Łukasz Czajka
7db74442d4
Hoisting of loop-invariant subexpressions (#3195)
* Closes #3028 
* Detects fully-applied expressions of the form
```
f a (\{ x1 .. xk := body }) a'
```
where `f` is a recursive function which does not modify its function
argument (the one for which a lambda is provided), i.e., passes it to
recursive invocations unchanged (it's the second argument in the above
example). A function `f` satisfying this requirement implements some
kind of loop with the lambda-expression usually being the loop body /
action.

Let e.g. `body = g x1 .. xk b1 b2` where `b1`, `b2` do not contain any
variables bound in the lambda (`x1`,..,`xk`). If `b1`, `b2` are
non-trivial (require computation), then these loop-invariant
subexpressions are hoisted outside of the loop, obtaining:
```
let 
  y1 := b1;
  y2 := b2;
in
f a (\{ x1 .. xk := g x1 .. xk y1 y2) a'
```
* Adds a volatility info in Core which prevents the lets created by
loop-invariant expression hoisting from being folded back.
* Removes potential duplication in the specialization optimization.
* Adds another optimization phase before lambda-lifting where hoisting
of loop-invariant subexpressions is performed. This allows to reduce the
number of iterations in the main optimization phase after
lambda-lifting.
2024-12-03 11:21:09 +01:00
Łukasz Czajka
e29026be7b
Fix iterator formatting (#3212)
* Closes #3156
2024-12-03 09:45:12 +01:00
Łukasz Czajka
97c29fb520
Make juvix init non-interactive by default (#3206)
* Closes #3046
2024-12-02 18:07:37 +01:00
Łukasz Czajka
618d1be442
Fix Anoma in the CI (#3213)
Makes `ANOMA_VERSION` point to the latest commit in the
`lukasz/juvix-integration-tracking` branch. We need to manually keep
this branch up-to-date, but controlling the branch solves the problem
with disappearing commits (e.g., after force-push).
2024-12-02 16:16:59 +01:00
Paul Cadman
9210e39dc7
Enable Anoma compilation resource machine builtin tests (#3208)
This PR:

* Updates the anomalib nock stdlib to the latest head of
`artem/juvix-node-integration-v0.28` containing the latest testnet
fixes.
* Re-enables the Anoma resource machine builtins tests
2024-12-02 14:09:55 +01:00
Łukasz Czajka
fcd59c9664
Detect empty standard library directory (#3207)
* Closes #3185
2024-12-02 10:58:11 +01:00
Łukasz Czajka
dc8d4b7175
Fix disappearing judoc in syntax declarations (#3205)
* Closes #3063
2024-12-01 18:06:10 +01:00
Jan Mas Rovira
5fea31eec6
Make FunctionLhs a field of FunctionDef (#3202) 2024-12-01 16:34:27 +01:00
Łukasz Czajka
ad0333467b
Fix aliases to non-recursive names (#3203)
* Closes #3201 
* As a side effect, aliases can now only be used after they are declared
(but they can still forward-reference identifiers, except the
non-recursive definitions or other aliases).
2024-12-01 11:20:10 +01:00
Paul Cadman
640d0495cb
Add juvix dev anoma add-transaction command (#3193) 2024-11-29 18:09:45 +00:00
Łukasz Czajka
923a019af1
Fix juvix clean --global (#3200)
* Closes #2992 
* Now `juvix clean --global` implies `juvix clean`. There is a new
option `--global-only` which preserves the old behaviour.
2024-11-29 16:40:39 +00:00
Jan Mas Rovira
c81b885347
Fix function clause printing (#3199)
- Closes #3197
2024-11-29 16:13:23 +01:00
Jan Mas Rovira
f34309658a
Allow punning in record updates (#3125)
Now it is allowed to use field puns in record updates. E.g.
```
type R :=
  mkR@{
    a : Nat;
    b : Nat;
    c : Nat;
  };

example : R :=
  let
    z :=
      mkR@{
        a := 0;
        b := 0;
        c := 0;
      };
    a := 6;
  in z@R{a} -- the field `a` is updated to 6
```
2024-11-29 13:05:39 +01:00
Jan Mas Rovira
bf06cb14d1
Formatter improvements (#3194)
1. Closes #3192. The first pipe is ensured in a multi-clause lambda.
3. Bugfix: Pragmas are now properly printed for deriving statements.
Previously they were never printed.
4. Record types are always declared in a new line, even if they have a
single constructor and fit in a line. I think this change improves
readability.
   ```
   -- before
   type Eq A := mkEq@{builtin isEqual eq : A -> A -> Bool};
  
   -- after
   type Eq A :=
     mkEq@{
       builtin isEqual
       eq : A -> A -> Bool;
     };
   ```
5. I've formatted the stdlib
(https://github.com/anoma/juvix-stdlib/pull/150).
6. I've refactored some code related to adding the first pipe so that it
is reused for cases, lambdas and types.
7. Now `ConstructorDef` has a proper `PrettyCode` instance and does not
need to be passed a bool indicating whether it is the only constructor
in a definition.
2024-11-29 11:49:47 +01:00
Paul Cadman
cc263e7a39
Add a new Anoma compile test mode 'AnomaTestModeNodeOnly' (#3196)
This mode is for tests that must run on the Anoma Node / Client. These
tests contain calls that are crashes in AnomaLib nock file and must
therefore be jetted.

With this changed the contents of test085 (resource machine builtins)
can be uncommnented. However it currently fails, unexpectedly on the
node.
2024-11-28 17:26:36 +00:00
Jan Mas Rovira
c64420efe8
Deriving Ord (#3184)
Allows automatic derivation of `Ord` instances. It generates a
lexicographical order equivalent to the one defined by Haskell's stock
deriving.
2024-11-28 11:21:18 +01:00
Łukasz Czajka
63b52f9f72
Improve generated code for derived instances (#3189)
* Closes #3186 
* Changes the generated code for derived Eq instances to define a local
recursive function with a let instead of a lambda. This is necessary,
because otherwise an indirection is generated on each recursive call --
instance resolution inserts the instance identifier, which then is
matched on and the function for the recursive call extracted instead of
being called directly. This cannot be (easily) optimized in Core
because, to avoid looping in the compiler, in general one cannot do
inlining of recursive functions.
* Minor improvements to the inlining optimization and the main
optimization phase: do inlining before specialization and more liberal
rules for heuristic case value inlining.
2024-11-26 16:14:45 +01:00
Paul Cadman
f916c0a95a
Update Anoma client to testnet-v1 release (#3190)
This PR makes changes to make our Anoma client CLI commands compatible
with the https://github.com/anoma/anoma/tree/testnet-01 branch.

We must now capture the Anoma client node_id on start because some
endpoints (e.g mempool submit) require this node id in the request.

I'm using
[Effectful.Environment](https://hackage.haskell.org/package/effectful-2.5.0.0/docs/Effectful-Environment.html)
to interact with environment variables as it avoids use of `IOE`.

In a separate PR we should replace all usages of `System.Environment`
with `Effectful.Environment` but I've left existing usages of
`System.Environment` in place for the time being.
2024-11-25 18:28:24 +01:00
Paul Cadman
e14eba1d1b
Add juvix dev anoma prove (#3187)
Add `juvix dev anoma prove`

This is similar to `juvix dev nockma run`.

The difference is that the managed client is used and it outputs the
result as a jammed file.

## CLI docs

```
The prove command submits a Nockma program to the Anoma.Protobuf.NockService.Prove gRPC endpoint.

By default, the gRPC request is made to the client that is started by juvix dev anoma start.
Use the -c/--config option to use a different Anoma client.
The config file format is:

url: <ANOMA_CLIENT_URL>
port: <ANOMA_CLIENT_GRPC_PORT>

The gRPC response (a Nockma program) is saved to a file named <input>.proved.nockma, where <input> is the base name of the input file.
Use the -o/--output option to specify a custom output filename.

If the program generates traces, they will be written to standard output.

Usage: juvix dev anoma prove NOCKMA_FILE [--args ARGS_FILE]
                             [-c|--config CONFIG_FILE] [-o|--output OUTPUT_FILE]

  Submit a Nockma program to Anoma.Protobuf.NockService.Prove

Available options:
  NOCKMA_FILE              Path to a .nockma file
  --args ARGS_FILE         Path to a file containing args. The args file should
                           contain a list (i.e. to pass 2 and [1 4] as args, the
                           contents should be [2 [1 4] 0]).
  -c,--config CONFIG_FILE  A path to an Anoma client configuration file
  -o,--output OUTPUT_FILE  Path to output file
  -h,--help                Show this help text
```

---------

Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
2024-11-25 10:45:14 +00:00
Łukasz Czajka
3c74c3700c
Allow pattern-matching in variable definitions (#3181)
* Closes #3118 
* Allows patterns on the left-hand sides of definitions. To avoid
clashes with constructor names, the patterns need to be enclosed in
parentheses or have the form `n@...`. A standalone symbol `x` in a
definition `x := ...` is always interpreted as an identifier even if
there exists a constructor `x`.
* Left-hand side patterns are desugared in the translation from Concrete
to Internal. If the inductive type has more than one constructor,
non-exhaustive pattern matching error will later be given by the pattern
matching compiler.

---------

Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
2024-11-25 10:27:53 +01:00
Paul Cadman
669474f345
Add juvix dev anoma {start, stop, status} to manage an Anoma client (#3183)
This PR adds the `juvix dev anoma {start, stop, status}` commands to
manage a running Anoma client.

The motivation for this is that we can add additional commands (e.g
`indexer`, `prove`, `(mempool)-submit`) which interact with the
persistent Anoma client.

`juvix dev anoma start` now writes a configuration file in
`<juvix_config>/anoma-client/config.yaml` which contains the host URL
and
port of the started Anoma client and the pid of the Anoma client
process.

For example:

config.yaml
```
host:
  port: 58922
  url: localhost
pid: 75299
```

The `anoma stop` command kills the Anoma client and the `anoma status`
command shows the config of the currently running client.

There can be at most one Anoma client running when using this mechanism.

## Dependency

This PR adds a new dependency on the `unix` package. This is used for
APIs to send signals to processes.

## CLI docs

### `juvix dev anoma`

```
Usage: juvix dev anoma COMMAND

  Subcommands related to the Anoma client

Available options:
  -h,--help                Show this help text

Available commands:
  start                    Start an Anoma client
  status                   Show the status of the Anoma client
  stop                     Stop the Anoma client
```

### `juvix dev anoma start`

```
Usage: juvix dev anoma start --anoma-dir ANOMA_DIR [-g|--foreground]
                             [-f|--force]

  Start an Anoma client

Available options:
  --anoma-dir ANOMA_DIR    Path to anoma repository
  -g,--foreground          Start the client in the foreground
  -f,--force               Forcefully start a client, terminating any currently
                           running client if necessary
  -h,--help                Show this help text
```

### `juvix dev anoma status`

```
Usage: juvix dev anoma status

  Show the status of the Anoma client

Available options:
  -h,--help                Show this help text
```

### `juvix dev anoma stop`

```
Usage: juvix dev anoma stop

  Stop the Anoma client

Available options:
  -h,--help                Show this help text
```
2024-11-22 16:03:30 +00:00
Jan Mas Rovira
c100812cd0
Add deriving for Eq (#3176)
This pr adds automatic implementation of `Eq` instances for inductive
types. To create such an instance the user will use the same syntax as a
regular instance with two differences.
1. It is prefixed with the `deriving` keyword.
2. It has no body.

E.g. 
```
deriving instance
eqProductI {A B} {{Eq A}} {{Eq B}} : Eq (Pair A B);
```

This desugars into an instance that returns true when the constructors
match and all arguments are equal according to their respective
instances. There is no special handling of type errors occurring in the
generated code. I.e. if the user forgets a necessary instance argument
in the type signature, a type error will occur in the generated code.

## Stdlib PR
- https://github.com/anoma/juvix-stdlib/pull/148

# Future work
* In the future we should look at
https://www.dreixel.net/research/pdf/gdmh_nocolor.pdf
* See also:
https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/compiler/generic-deriving

---------

Co-authored-by: Lukasz Czajka <lukasz@heliax.dev>
2024-11-22 13:13:26 +01:00
Paul Cadman
19ecfa931b
Set std_in to NoStream on the Anoma client process (#3182)
This PR sets `std_in` to `NoStream` on the Anoma client process.


https://hackage.haskell.org/package/process-1.6.25.0/docs/System-Process.html#t:StdStream

We do not read from the Anoma client process stdin so we do not need to
open a handle to stdin.

This fixes an issue where the Anoma client stdin does not get cleaned up
correctly on exit which causes subsequent input to the terminal to be
corrupted.
2024-11-20 17:07:52 +00:00
Łukasz Czajka
2e38aa609f
Unify type signature declaration syntax (#3178)
* Closes #2990 
* Allows type signatures for constructors, record fields and axioms to
have the same form as in function definitions, e.g.,
```
field {A} {{M A}} (arg1 arg2 : A) : List A
```
* For constructors, this introduces an ambiguity between record and GADT
syntax with names. For example,
```
ctr {
  A : Type
}
```
can be confused by the parser with initial part of GADT type signature:
```
ctr {A : Type} : A -> C A
```
For now, this is resolved by preferring the record syntax. Hence, it's
currently not possible to use type signatures with implicit arguments
for constructors. Ultimately, the `@` in record syntax should be made
mandatory, which would resolve the ambiguity:
```
ctr@{
  A : Type
}
```

---------

Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
2024-11-20 15:57:15 +00:00
Paul Cadman
865842046d
Support running nockma code with a running Anoma client (#3180)
This PR:

1. Adds a new interpretation for the Anoma effect, which makes gRPC
calls to an existing Anoma client instead of spawning a new one.
2. Adds a new `nockma run` mode, `with-client`, which can be used to run
an Anoma program against a running Anoma client, using its URL and gRPC
port.
3. separates the `nockma run` command into subcommands.

CLI docs:

## `nockma run`

```
Usage: juvix dev nockma run COMMAND

  Subcommands used to run an Anoma program. Use with artefacts obtained from
  compilation with the anoma target

Available options:
  -h,--help                Show this help text

Available commands:
  builtin-evaluator        Run with the builtin Nockma evaluator
  ephemeral-client         Run with an ephemeral Anoma client
  with-client              Run with a running Anoma client
```

### `with-client`

```
Usage: juvix dev nockma run with-client
         NOCKMA_FILE [--args ARGS_FILE] (-p|--grpc-port PORT) [--url URL]

  Run with a running Anoma client

Available options:
  NOCKMA_FILE              Path to a .nockma file
  --args ARGS_FILE         Path to file containing args. The args file should
                           contain a list (i.e. to pass 2 and [1 4] as args, the
                           contents should be [2 [1 4] 0]).
  -p,--grpc-port PORT      The GRPC port of a running Anoma client
  --url URL                The URL of a running Anoma client. default: localhost
  -h,--help                Show this help text
```

### `ephemeral-client`

```
Usage: juvix dev nockma run ephemeral-client
         NOCKMA_FILE [--args ARGS_FILE] --anoma-dir ANOMA_DIR

  Run with an ephemeral Anoma client

Available options:
  NOCKMA_FILE              Path to a .nockma file
  --args ARGS_FILE         Path to file containing args. The args file should
                           contain a list (i.e. to pass 2 and [1 4] as args, the
                           contents should be [2 [1 4] 0]).
  --anoma-dir ANOMA_DIR    Path to anoma repository
  -h,--help                Show this help text
```

### `builtin-evaluator`

```
Usage: juvix dev nockma run builtin-evaluator
         NOCKMA_FILE [--args ARGS_FILE] [--profile]

  Run with the builtin Nockma evaluator

Available options:
  NOCKMA_FILE              Path to a .nockma file
  --args ARGS_FILE         Path to file containing args. The args file should
                           contain a list (i.e. to pass 2 and [1 4] as args, the
                           contents should be [2 [1 4] 0]).
  --profile                Report evaluator profiling statistics
  -h,--help                Show this help text
```
2024-11-20 08:53:21 +01:00
Łukasz Czajka
455249db4d
HTML generation: make the light theme lighter (#3168)
* Closes #3141 
* Adds the `latte-light` theme with lighter background and makes it the
default. This is a bit subjective, but in my opinion the light theme
should not have a background darker than the browser window pane. It
should be close to white.
2024-11-19 19:34:52 +00:00
Paul Cadman
eab02a77da
Remove GetAnomaProcess from the Anoma effect (#3179)
This PR removes `GetAnomaProcess` from the Anoma effect.

Use the `launchAnoma` function to start a persistent Anoma client /
server (used by `juvix dev anoma node`).

Other changes:

* It's no longer necessary to pass the protobuf files to `grpcurl`
because the Anoma client now supports gRPC reflection.
* We pass the elixir start command to `mix` via `-e` argument instead of
using a temporary file.

The purpose for this change is that we I want to add an interpreter for
Anoma that makes gRPC calls to an exisitng Anoma client.
`GetAnomaProcess` has no meaning for this interpreter.
2024-11-19 17:34:13 +00:00
Paul Cadman
dc2d268413
Fix long opts for nockma encode from/to (#3177)
The `from` and `to` long options for `juvix dev nockma encode` were
mislabelled. `from` should be the source encoding and `to` should be the
target encoding.
2024-11-15 18:36:55 +00:00
Łukasz Czajka
5f803ec6c2
Named arguments for record projections (#3173)
* Closes #3054
* Adds named argument signatures for generated record projections.
2024-11-15 18:25:49 +01:00
Łukasz Czajka
9f25ffde16
Detect termination for nested local definitions (#3169)
* Closes #3147 

When we call a function that is currently being defined (there may be
several such due to nested local definitions), we add a reflexive edge
in the call map instead of adding an edge from the most nested
definition. For example, for

```juvix
go {A B} (f : A -> B) : List A -> List B
  | nil := nil
  | (elem :: next) :=
    let var1 := f elem;
        var2 := go f next;
    in var1 :: var2;
```

we add an edge from `go` to the recursive call `go f next`, instead of
adding an edge from `var2` to `go f next` as before.

This makes the above type-check.

The following still doesn't type-check, because `next'` is not a
subpattern of the clause pattern of `go`. But this is a less pressing
problem.

```juvix
go {A B} (f : A -> B) : List A -> List B
  | nil := nil
  | (elem :: next) :=
    let var1 := f elem;
        var2 (next' : List A) : List B := go f next';
    in myCons var1 (var2 next);
```
2024-11-15 12:30:18 +01:00
Jan Mas Rovira
1d7bf1f25b
Fix compiler error on import cycles (#3171)
- Fixes #3161 

The strongly connected components given in [this
function](https://hackage.haskell.org/package/containers-0.7/docs/Data-Graph.html#v:stronglyConnComp)
are not guaranteed to give a cycle in the order they are given. I've
fixed that
2024-11-15 09:41:02 +01:00