
louise
Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.
Dernier runRéussi#1201 · main · 9 min 57 s
1Étoiles
0Forks
0Issues
Types: `<>` is the method of a prelude trait, Semigroup (issue #95)
`<>` was hard-wired to String. It is now `Semigroup`'s `append`, typed
like `+` with `Num`: the right side has the left side's type, and the
result too, with a `Semigroup` constraint. `fn joined(a, b) { a <> b }`
infers `where Semigroup<a>`; `s <> "!"` is still a String.
The prelude implements it for String, List (a unique list reuses its
cells), Bytes and Order (the first that is not `Eq`, to break ties when
comparing). On Strings, `<>` still lowers to a direct `tl_string_concat`
in both backends: the generated C of every benchmark is unchanged up to
the numbering of generated names.
`<>` on a type without an impl is E0401, with a note listing the types
that implement `Semigroup`.
Tests: tests/run/semigroup.lse (both backends: the four impls, generic
functions, a user impl), the inferred types and the errors in tests/ui,
and the evidence test counting the `<>` site.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>Parents b06ebda
9 fichiers modifiés, 172 ajouts, 11 suppressions
crates/louise_core/src/lower/mod.rs+12−1crates/louise_types/src/env/mod.rs+3−0crates/louise_types/src/infer/mod.rs+8−0crates/louise_types/src/traits.rs+16−5crates/louise_types/tests/evidence.rs+13−3std/prelude.lse+46−2tests/run/semigroup.lse+59−0tests/ui/inference.lse+10−0tests/ui/traits.lse+5−0