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.

22 lignes · 307 octetsBrut · Historique
1effect fail
2{
3 final ctl fail :: reason: String -> Never
4}
5
6// `Never` fits wherever a value is expected.
7pub fn checked :: n: Int -> Int / <fail>
8{
9 if n < 0
10 {
11 fail "negative"
12 }
13 else
14 {
15 n
16 }
17}
18
19pub fn first :: xs: List<a> -> a / <fail>
20{
21 match xs { [x, ..] -> x, [] -> fail "empty" }
22}