Fork of daniellemaywood.uk/gleam — Wasm codegen work
2

Configure Feed

Select the types of activity you want to include in your feed.

1# Changelog 2 3## 1.7.0 - 2025-01-05 4 5Happy birthday Louis! 🎁 6 7## 1.7.0-rc3 - 2025-01-02 8 9### Formatter 10 11- Function captures are now formatted like regular function calls. 12 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 13 14- Record updates are now formatted like function calls. 15 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 16 17### Bug fixes 18 19- Fixed a bug where the "convert from use" code action would generate invalid 20 code with labelled arguments. 21 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 22 23- Fixed a bug where private types would be allowed to be used in other modules. 24 ([Surya Rose](https://github.com/GearsDatapacks)) 25 26## 1.7.0-rc2 - 2024-12-30 27 28### Bug fixes 29 30- Fixed a bug on JavaScript where a trailing `:bytes` segment would give the 31 wrong pattern match result for a sliced bit array. 32 ([Richard Viney](https://github.com/richard-viney)) 33 34## 1.7.0-rc1 - 2024-12-29 35 36### Compiler 37 38- Removed compiler hint about pattern matching a `Result(a, b)` when being used 39 where `a` is expected. 40 ([Kieran O'Reilly](https://github.com/SoTeKie)) 41 42- Optimised code generated for record updates. 43 ([yoshi](https://github.com/joshi-monster)) 44 45- The compiler now allows for record updates to change the generic type 46 parameters of the record: 47 48 ```gleam 49 type Box(value) { 50 Box(password: String, value: value) 51 } 52 53 fn insert(box: Box(a), value: b) -> Box(b) { 54 Box(..box, value:) 55 } 56 ``` 57 58 ([yoshi](https://github.com/joshi-monster)) 59 60- It is now allowed to write a block with no expressions. Like an empty function 61 body, an empty block is considered incomplete as if it contained a `todo` 62 expression. 63 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 64 65- The shorthand names for the two targets, `erl` and `js` are now 66 deprecated in code such as `@target`. 67 ([Surya Rose](https://github.com/GearsDatapacks)) 68 69- A custom panic message can now be specified when asserting a value with 70 `let assert`: 71 72 ```gleam 73 let assert Ok(regex) = regex.compile("ab?c+") as "This regex is always valid" 74 ``` 75 76 ([Surya Rose](https://github.com/GearsDatapacks)) 77 78- When targeting JavaScript the compiler now generates faster and smaller code 79 for `Int` values in bit array expressions and patterns by evaluating them at 80 compile time where possible. 81 ([Richard Viney](https://github.com/richard-viney)) 82 83- Qualified records can now be used in clause guards. 84 ([Surya Rose](https://github.com/GearsDatapacks)) 85 86- The compiler now allows deprecating specific custom type variants using the 87 `@deprecated` attribute: 88 89 ```gleam 90 pub type HashAlgorithm { 91 @deprecated("Please upgrade to another algorithm") 92 Md5 93 Sha224 94 Sha512 95 } 96 97 pub fn hash_password(input: String) -> String { 98 hash(input:, algorithm: Md5) // Warning: Deprecated value used 99 } 100 ``` 101 102 ([Iesha](https://github.com/wilbert-mad)) 103 104- On the JavaScript target, taking byte-aligned slices of bit arrays is now an 105 O(1) operation instead of O(N), significantly improving performance. 106 ([Richard Viney](https://github.com/richard-viney)) 107 108- Better error message for when an existing type constructor is used as a value 109 constructor. 110 ([Jiangda Wang](https://github.com/Frank-III)) 111 112- Print better error messages when shell commands used by compiler cannot be 113 found. 114 ([wheatfox](https://github.com/enkerewpo)) 115 116### Build tool 117 118- Improved the error message you get when trying to add a package that doesn't 119 exist with `gleam add`. 120 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 121 122- External files (such as `.mjs` and `.erl`) are now permitted in subdirectories 123 of `src/` and `test/`. 124 ([PgBiel](https://github.com/PgBiel)) 125 126- `gleam publish` now requires more verbose confirmation for publishing Gleam 127 team packages and v0 packages. 128 ([Louis Pilfold](https://github.com/lpil)) 129 130- `gleam publish` now warns when publishing packages that define multiple 131 top-level modules, as this can lead to namespace pollution and conflicts for 132 consumers. 133 ([Aleksei Gurianov](https://github.com/guria)) 134 135- New projects now require `gleam_stdlib` v0.44.0. 136 ([Louis Pilfold](https://github.com/lpil)) 137 138- `gleam remove` no longer requires a network connection. 139 ([yoshi](https://github.com/joshi-monster)) 140 141- Commands that work with the Hex package manager API now create and store an 142 API key rather than creating a new one each time. This API key is encrypted 143 with a local password, reducing risk of your Hex password being compromised. 144 ([Louis Pilfold](https://github.com/lpil)) 145 146- The build tool now sets the `REBAR_SKIP_PROJECT_PLUGINS` environment variable 147 when using rebar3 to compile Erlang dependencies. With future versions of 148 rebar3 this will cause it to skip project plugins, significantly reducing the 149 amount of code it'll need to download and compile, improving compile times. 150 ([Tristan Sloughter](https://github.com/tsloughter)) 151 152### Language server 153 154- The language server now provides type information when hovering over argument 155 labels. 156 ([Surya Rose](https://github.com/GearsDatapacks)) 157 158- The language server now suggests a code action to desugar a use expression 159 into the equivalent function call. For example, this snippet of code: 160 161 ```gleam 162 pub fn main() { 163 use profile <- result.try(fetch_profile(user)) 164 render_welcome(user, profile) 165 } 166 ``` 167 168 Will be turned into: 169 170 ```gleam 171 pub fn main() { 172 result.try(fetch_profile(user), fn(profile) { 173 render_welcome(user, profile) 174 }) 175 } 176 ``` 177 178 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 179 180- The language server now suggests a code action to turn a function call into 181 the equivalent use expression. For example, this snippet of code: 182 183 ```gleam 184 pub fn main() { 185 result.try(fetch_profile(user) fn(profile) { 186 render_welcome(user, profile) 187 }) 188 } 189 ``` 190 191 Will be turned into: 192 193 ```gleam 194 pub fn main() { 195 use profile <- result.try(fetch_profile(user)) 196 render_welcome(user, profile) 197 } 198 ``` 199 200 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 201 202- The language server now provides correct information when hovering over 203 patterns in use expressions. 204 ([Surya Rose](https://github.com/GearsDatapacks)) 205 206- The language server now suggests a code action to convert an inexhaustive 207 `let` assignment into a `case` expression: 208 209 ```gleam 210 pub fn unwrap_result(result: Result(a, b)) -> a { 211 let Ok(inner) = result 212 inner 213 } 214 ``` 215 216 Becomes: 217 218 ```gleam 219 pub fn unwrap_result(result: Result(a, b)) -> a { 220 let inner = case result { 221 Ok(inner) -> inner 222 Error(_) -> todo 223 } 224 inner 225 } 226 ``` 227 228 ([Surya Rose](https://github.com/GearsDatapacks)) 229 230- The language server now provides an action to extract a value into a variable. 231 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 232 233- The language server now suggests a code action to expand a function capture 234 into the equivalent anonymous function. For example, this snippet of code: 235 236 ```gleam 237 pub fn main() { 238 list.map([1, 2, 3], int.add(_, 11)) 239 } 240 ``` 241 242 Will be turned into: 243 244 ```gleam 245 pub fn main() { 246 list.map([1, 2, 3], fn(value) { int.add(value, 11) }) 247 } 248 ``` 249 250 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 251 252- The language server now suggests a code action to generate a dynamic decoder 253 for a custom type. For example, this code: 254 255 ```gleam 256 pub type Person { 257 Person(name: String, age: Int) 258 } 259 ``` 260 261 Will become: 262 263 ```gleam 264 import gleam/dynamic/decode 265 266 pub type Person { 267 Person(name: String, age: Int) 268 } 269 270 fn person_decoder() -> decode.Decoder(Person) { 271 use name <- decode.field("name", decode.string) 272 use age <- decode.field("age", decode.int) 273 decode.success(Person(name:, age:)) 274 } 275 ``` 276 277 ([Surya Rose](https://github.com/GearsDatapacks)) 278 279### Formatter 280 281- The formatter now adds a `todo` inside empty blocks. 282 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 283 284- The formatter now formats lists the same in constants as in expressions. 285 ([Jiangda Wang](https://github.com/Frank-III)) 286 287### Documentation 288 289- Canonical links created for documentation pages if published on Hex. 290 Previously published documentation would need to be updated. 291 Resolves versioned pages to point to latest page for search engines. 292 ([Dave Lage](https://github.com/rockerBOO)) 293 294### Bug fixes 295 296- The compiler now throws an error when a float literal ends with an `e` and 297 is missing an exponent. 298 ([Surya Rose](https://github.com/GearsDatapacks)) 299 300- Fixed a crash with ENOTEMPTY (os error 39) when building on NTFS partitions. 301 ([Ivan Ermakov](https://github.com/ivanjermakov)) 302 303- Fixed a bug where the compiler would crash when pattern matching on multiple 304 subjects and one of them being a constant record. 305 ([Surya Rose](https://github.com/GearsDatapacks)) 306 307- Variant inference on prelude types now works correctly if the variant is 308 constant. 309 ([Surya Rose](https://github.com/GearsDatapacks)) 310 311- Fixed a bug where patterns in `use` expressions would not be checked to ensure 312 that they were exhaustive. 313 ([Surya Rose](https://github.com/GearsDatapacks)) 314 315- Fixed a bug where a `module.mjs` file would be overwritten by a `module.gleam` 316 file of same name without warning. It now produces an error. 317 ([PgBiel](https://github.com/PgBiel)) 318 319- Modules depending on removed or renamed modules now get automatically 320 recompiled. 321 ([Sakari Bergen](https://github.com/sbergen)) 322 323- The compiler now raises a warning for unused case expressions, code blocks and 324 pipelines that would be safe to remove. 325 ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 326 327- Fixed a bug where assigning the prefix of a string pattern to a variable 328 nested inside another pattern would produce invalid code on Javascript. 329 ([yoshi](https://github.com/joshi-monster)) 330 331- Fixed a bug where expressions which use an unsafe integer on JavaScript would 332 not emit a warning if an external function had been referenced. 333 ([Richard Viney](https://github.com/richard-viney)) 334 335- Fixed a bug where nested tuple access would not be parsed correctly when 336 the left-hand side was a function call. 337 ([Surya Rose](https://github.com/GearsDatapacks)) 338 339- Fixed a bug where Gleam would be unable to compile to BEAM bytecode on older 340 versions of Erlang/OTP. 341 ([yoshi](https://github.com/joshi-monster)) 342 343- Fixed a bug where the inferred variant of values was not properly cached, 344 leading to incorrect errors on incremental builds and in the language server. 345 ([Surya Rose](https://github.com/GearsDatapacks)) 346 347- Fixed a bug where Gleam would be unable to compile to BEAM bytecode if the 348 project path contains a non-ascii character. 349 ([yoshi](https://github.com/joshi-monster)) 350 351- Fixed a bug where the compiler would display incorrect hints about ignoring 352 unused variables in certain cases. 353 ([Surya Rose](https://github.com/GearsDatapacks)) 354 355- Fixed a bug where the completer would not include braces in type import 356 completions when it should have. 357 ([Jiangda Wang](https://github.com/Frank-III)) 358 359- Fixed a bug where `gleam new` would generate the github `test` workflow 360 configuration with incompatible Erlang OTP and Elixir versions. 361 ([John Strunk](https://github.com/jrstrunk)) 362 363## v1.6.1 - 2024-11-19 364 365### Bug fixes 366 367- Fixed a bug where `gleam update` would fail to update versions. 368 ([Jason Sipula](https://github.com/SnakeDoc))