tobogganSe connecter

louise

The Louise language: compiler, runtime, std, tooling

Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.

40 lignes · 694 octetsBrut · Historique
1// Row arguments, and effects whose parameters are rows (ADR 0065).
2
3effect ask
4{
5 fn ask :: -> Int
6}
7
8effect later<e>
9{
10 fn later :: render: fn() -> Int / <e> -> Int
11}
12
13pub type Steps<e> { Steps(fn() -> Int / <e>) }
14
15// A row is written where a row is expected.
16fn steps :: s: Steps<<ask>> -> Steps<<ask>>
17{
18 s
19}
20//~ TYPE steps: fn(Steps<<ask>>) -> Steps<<ask>>
21
22fn closed :: -> Steps<<>>
23{
24 Steps(fn { 1 })
25}
26//~ TYPE closed: fn() -> Steps<<>>
27
28// A row is not a type, and a type is not a row.
29fn not_a_type :: x: <ask> -> Int
30//~^ ERROR E0213 a row has kind `Row`, but kind `Type` is expected here
31{
32 1
33}
34
35fn not_a_row ::
36 -> Int / <later<Int>> //~ ERROR E0213
37//~^ WARN W0501
38{
39 1
40}