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

Configure Feed

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

Move changelog

+356 -341
+1 -341
CHANGELOG.md
··· 1 1 # Changelog 2 2 3 - ## v1.9.0-rc2 - 2025-03-07 4 - 5 - ### Compiler 6 - 7 - - Made runtime warnings regarding the use of deprecated BitArray properties in 8 - JavaScript FFI code more compact. They are now one line instead of three. 9 - ([Richard Viney](https://github.com/richard-viney)) 10 - 11 - ### Bug fixes 12 - 13 - - Fixed a bug that would result in displaying the wrong name when running 14 - `gleam --version`. 15 - ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 16 - 17 - - Fixed a bug in the `generate json encoder` and `generate dynamic decoder` that 18 - would result in generating invalid code for variants with no fields. 19 - ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 20 - 21 - ## v1.9.0-rc1 - 2025-03-04 3 + ## Unreleased 22 4 23 5 ### Compiler 24 6 25 - - You can now use the `echo` keyword to debug print any value: `echo` can be 26 - followed by any expression and it will print it to stderr alongside the module 27 - it comes from and its line number. This: 28 - 29 - ```gleam 30 - pub fn main() { 31 - echo [1, 2, 3] 32 - } 33 - ``` 34 - 35 - Will output to stderr: 36 - 37 - ```txt 38 - /src/module.gleam:2 39 - [1, 2, 3] 40 - ``` 41 - 42 - `echo` can also be used in the middle of a pipeline. This: 43 - 44 - ```gleam 45 - pub fn main() { 46 - [1, 2, 3] 47 - |> echo 48 - |> list.map(fn(x) { x * 2 }) 49 - |> echo 50 - } 51 - ``` 52 - 53 - Will output to stderr: 54 - 55 - ```txt 56 - /src/module.gleam:3 57 - [1, 2, 3] 58 - /src/module.gleam:5 59 - [2, 4, 6] 60 - ``` 61 - 62 - ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 63 - 64 - - Generated Erlang `.app` files now include external modules written in Elixir 65 - and Erlang. 66 - ([LostKobrakai](https://github.com/lostkobrakai)) 67 - 68 - - On the JavaScript target, bit array expressions and patterns no longer need to 69 - be byte aligned, and the `bits` segment type is now supported in patterns. 70 - ([Richard Viney](https://github.com/richard-viney)) 71 - 72 - - The code generated for list pattern matching on the JavaScript target is now 73 - more efficient. Gleam code that relies heavily on list pattern matching can 74 - now be up to twice as fast. 75 - ([yoshi~](https://github.com/yoshi-monster)) 76 - 77 - - On the JavaScript target, bit array patterns can now match segments of dynamic 78 - size. 79 - ([Surya Rose](https://github.com/GearsDatapacks)) 80 - 81 7 ### Build tool 82 8 83 - - The build tool now supports Git dependencies. For example: 84 - 85 - ``` 86 - [dependencies] 87 - gleam_stdlib = { git = "https://github.com/gleam-lang/stdlib.git", ref = "957b83b" } 88 - ``` 89 - 90 - ([Surya Rose](https://github.com/GearsDatapacks)) 91 - 92 - - The build tool now refuses to publish any incomplete package that has any 93 - `echo` debug printing left. 94 - ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 95 - 96 - - HexDocs documentation of Gleam packages now uses the ExDocs search data model, 97 - allowing for global indexing of Gleam packages in HexDocs, and 98 - making Gleam packages discoverable through global search of HexDocs. 99 - ([Diemo Gebhardt](https://github.com/diemogebhardt)) 100 - 101 - - Improved the styling of constructor argument descriptions in the generated 102 - documentation. 103 - ([Mikko Ahlroth](https://git.ahlcode.fi/nicd)) 104 - 105 - - Allow users to set the `GLEAM_CACERTS_PATH` environment variable to specify a 106 - path to a directory containing CA certificates to install Hex packages. 107 - ([winstxnhdw](https://github.com/winstxnhdw)) 108 - 109 9 ### Language server 110 10 111 - - The language server now has the ability to jump to the type definition of any 112 - hovered value. 113 - ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 114 - 115 - - The language server now offers a code action to convert the first step of a 116 - pipeline to a regular function call. For example, this code: 117 - 118 - ```gleam 119 - import gleam/list 120 - 121 - pub fn main() { 122 - [1, 2, 3] |> list.map(fn(n) { n * 2 }) 123 - } 124 - ``` 125 - 126 - Will be rewritten as: 127 - 128 - ```gleam 129 - import gleam/list 130 - 131 - pub fn main() { 132 - list.map([1, 2, 3], fn(n) { n * 2 }) 133 - } 134 - ``` 135 - 136 - ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 137 - 138 - - The language server now offers a code action to convert a function call into 139 - a pipeline. For example, this code: 140 - 141 - ```gleam 142 - import gleam/list 143 - 144 - pub fn main() { 145 - list.map([1, 2, 3], fn(n) { n * 2 }) 146 - } 147 - ``` 148 - 149 - Will be rewritten as: 150 - 151 - ```gleam 152 - import gleam/list 153 - 154 - pub fn main() { 155 - [1, 2, 3] |> list.map(fn(n) { n * 2 }) 156 - } 157 - ``` 158 - 159 - You can also pick which argument is going to be piped. In this case: 160 - 161 - ```gleam 162 - import gleam/list 163 - 164 - pub fn main() { 165 - list.map([1, 2, 3], fn(n) { n * 2 }) 166 - // ^ If you put your cursor over here 167 - } 168 - ``` 169 - 170 - The code will be rewritten as: 171 - 172 - ```gleam 173 - import gleam/list 174 - 175 - pub fn main() { 176 - fn(n) { n * 2 } |> list.map([1, 2, 3], _) 177 - } 178 - ``` 179 - 180 - ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 181 - 182 - - The language server now suggests a code action to generate a function to 183 - encode a custom type as JSON using the `gleam_json` package. For example: 184 - 185 - ```gleam 186 - pub type Person { 187 - Person(name: String, age: Int) 188 - } 189 - ``` 190 - 191 - Will become: 192 - 193 - ```gleam 194 - import gleam/json 195 - 196 - pub type Person { 197 - Person(name: String, age: Int) 198 - } 199 - 200 - fn encode_person(person: Person) -> json.Json { 201 - json.object([ 202 - #("name", json.string(person.name)), 203 - #("age", json.int(person.age)), 204 - ]) 205 - } 206 - ``` 207 - 208 - ([Surya Rose](https://github.com/GearsDatapacks)) 209 - 210 - - The language server now suggests a code action to inline a variable 211 - which is only used once. For example, this code: 212 - 213 - ```gleam 214 - import gleam/io 215 - 216 - pub fn main() { 217 - let greeting = "Hello!" 218 - io.println(greeting) 219 - } 220 - ``` 221 - 222 - Will be rewritten as: 223 - 224 - ```gleam 225 - import gleam/io 226 - 227 - pub fn main() { 228 - io.println("Hello!") 229 - } 230 - ``` 231 - 232 - ([Surya Rose](https://github.com/GearsDatapacks)) 233 - 234 - - The code action to generate a dynamic decoder for a custom type can now 235 - generate decoders for types with multiple variants. For example this code: 236 - 237 - ```gleam 238 - pub type Person { 239 - Adult(age: Int, job: String) 240 - Child(age: Int, height: Float) 241 - } 242 - ``` 243 - 244 - Becomes: 245 - 246 - ```gleam 247 - import gleam/dynamic/decode 248 - 249 - pub type Person { 250 - Adult(age: Int, job: String) 251 - Child(age: Int, height: Float) 252 - } 253 - 254 - fn person_decoder() -> decode.Decoder(Person) { 255 - use variant <- decode.field("type", decode.string) 256 - case variant { 257 - "adult" -> { 258 - use age <- decode.field("age", decode.int) 259 - use job <- decode.field("job", decode.string) 260 - decode.success(Adult(age:, job:)) 261 - } 262 - "child" -> { 263 - use age <- decode.field("age", decode.int) 264 - use height <- decode.field("height", decode.float) 265 - decode.success(Child(age:, height:)) 266 - } 267 - _ -> decode.failure(todo as "Zero value for Person", "Person") 268 - } 269 - } 270 - ``` 271 - 272 - ([Surya Rose](https://github.com/GearsDatapacks)) 273 - 274 - - The language server now suggests a code action to easily interpolate a value 275 - into a string. If the cursor is inside a literal string the language server 276 - will offer to split it: 277 - 278 - ```gleam 279 - "wibble | wobble" 280 - // ^ Triggering the action with the cursor 281 - // here will produce this: 282 - "wibble " <> todo <> " wobble" 283 - ``` 284 - 285 - And if the cursor is selecting a valid Gleam name, the language server will 286 - offer to interpolate it as a variable: 287 - 288 - ```gleam 289 - "wibble wobble woo" 290 - // ^^^^^^ Triggering the code action if you're 291 - // selecting an entire name, will produce this: 292 - "wibble " <> wobble <> " woo" 293 - ``` 294 - 295 - ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 296 - 297 - - The language server now shows module documentation when hovering over a module 298 - name. 299 - ([Surya Rose](https://github.com/GearsDatapacks)) 300 - 301 11 ### Formatter 302 12 303 - - Redundant function captures that take no additional arguments are now 304 - rewritten to not use the function capture syntax. 305 - 306 - ```gleam 307 - some_module.some_function(_) 308 - ``` 309 - 310 - This code is reformatted like so: 311 - 312 - ```gleam 313 - some_module.some_function 314 - ``` 315 - 316 - ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 317 - 318 13 ### Bug fixes 319 - 320 - - Fixed a bug where division and remainder operators would not work correctly 321 - in guards on the JavaScript target. 322 - ([Surya Rose](https://github.com/GearsDatapacks)) 323 - 324 - - Fixed a bug where the "Generate function" code action would ignore the 325 - provided labels. 326 - ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 327 - 328 - - Fixed a bug where the "Pattern match on argument" and 329 - "Pattern match on variable" code actions would not allow to pattern match on a 330 - private type used in the same module it's defined in. 331 - ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 332 - 333 - - Fixed a bug where `gleam export package-interface` would not properly generate 334 - the package interface file if some modules were cached. 335 - ([Pedro Francisco](https://github.com/mine-tech-oficial)) and 336 - ([Surya Rose](https://github.com/GearsDatapacks)) 337 - 338 - - Fixed a bug where pattern matching using a UTF-8 string constant would not 339 - work correctly on the JavaScript target when the string contained escape 340 - characters. 341 - ([Richard Viney](https://github.com/richard-viney)) 342 - 343 - - Fixed a bug where `gleam publish` wouldn't include gitignored or nested native 344 - files. 345 - ([PgBiel](https://github.com/PgBiel)) 346 - 347 - ## v1.8.1 - 2025-02-11 348 - 349 - ### Bug fixes 350 - 351 - - Fixed a metadata caching bug where accessors for opaque types could sometimes 352 - be used in other modules. 353 - ([Louis Pilfold](https://github.com/lpil))
+355
changelog/v1.9.md
··· 1 + # Changelog 2 + 3 + ## v1.9.0 - 2025-03-09 4 + 5 + ## v1.9.0-rc2 - 2025-03-07 6 + 7 + ### Compiler 8 + 9 + - Made runtime warnings regarding the use of deprecated BitArray properties in 10 + JavaScript FFI code more compact. They are now one line instead of three. 11 + ([Richard Viney](https://github.com/richard-viney)) 12 + 13 + ### Bug fixes 14 + 15 + - Fixed a bug that would result in displaying the wrong name when running 16 + `gleam --version`. 17 + ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 18 + 19 + - Fixed a bug in the `generate json encoder` and `generate dynamic decoder` that 20 + would result in generating invalid code for variants with no fields. 21 + ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 22 + 23 + ## v1.9.0-rc1 - 2025-03-04 24 + 25 + ### Compiler 26 + 27 + - You can now use the `echo` keyword to debug print any value: `echo` can be 28 + followed by any expression and it will print it to stderr alongside the module 29 + it comes from and its line number. This: 30 + 31 + ```gleam 32 + pub fn main() { 33 + echo [1, 2, 3] 34 + } 35 + ``` 36 + 37 + Will output to stderr: 38 + 39 + ```txt 40 + /src/module.gleam:2 41 + [1, 2, 3] 42 + ``` 43 + 44 + `echo` can also be used in the middle of a pipeline. This: 45 + 46 + ```gleam 47 + pub fn main() { 48 + [1, 2, 3] 49 + |> echo 50 + |> list.map(fn(x) { x * 2 }) 51 + |> echo 52 + } 53 + ``` 54 + 55 + Will output to stderr: 56 + 57 + ```txt 58 + /src/module.gleam:3 59 + [1, 2, 3] 60 + /src/module.gleam:5 61 + [2, 4, 6] 62 + ``` 63 + 64 + ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 65 + 66 + - Generated Erlang `.app` files now include external modules written in Elixir 67 + and Erlang. 68 + ([LostKobrakai](https://github.com/lostkobrakai)) 69 + 70 + - On the JavaScript target, bit array expressions and patterns no longer need to 71 + be byte aligned, and the `bits` segment type is now supported in patterns. 72 + ([Richard Viney](https://github.com/richard-viney)) 73 + 74 + - The code generated for list pattern matching on the JavaScript target is now 75 + more efficient. Gleam code that relies heavily on list pattern matching can 76 + now be up to twice as fast. 77 + ([yoshi~](https://github.com/yoshi-monster)) 78 + 79 + - On the JavaScript target, bit array patterns can now match segments of dynamic 80 + size. 81 + ([Surya Rose](https://github.com/GearsDatapacks)) 82 + 83 + ### Build tool 84 + 85 + - The build tool now supports Git dependencies. For example: 86 + 87 + ``` 88 + [dependencies] 89 + gleam_stdlib = { git = "https://github.com/gleam-lang/stdlib.git", ref = "957b83b" } 90 + ``` 91 + 92 + ([Surya Rose](https://github.com/GearsDatapacks)) 93 + 94 + - The build tool now refuses to publish any incomplete package that has any 95 + `echo` debug printing left. 96 + ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 97 + 98 + - HexDocs documentation of Gleam packages now uses the ExDocs search data model, 99 + allowing for global indexing of Gleam packages in HexDocs, and 100 + making Gleam packages discoverable through global search of HexDocs. 101 + ([Diemo Gebhardt](https://github.com/diemogebhardt)) 102 + 103 + - Improved the styling of constructor argument descriptions in the generated 104 + documentation. 105 + ([Mikko Ahlroth](https://git.ahlcode.fi/nicd)) 106 + 107 + - Allow users to set the `GLEAM_CACERTS_PATH` environment variable to specify a 108 + path to a directory containing CA certificates to install Hex packages. 109 + ([winstxnhdw](https://github.com/winstxnhdw)) 110 + 111 + ### Language server 112 + 113 + - The language server now has the ability to jump to the type definition of any 114 + hovered value. 115 + ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 116 + 117 + - The language server now offers a code action to convert the first step of a 118 + pipeline to a regular function call. For example, this code: 119 + 120 + ```gleam 121 + import gleam/list 122 + 123 + pub fn main() { 124 + [1, 2, 3] |> list.map(fn(n) { n * 2 }) 125 + } 126 + ``` 127 + 128 + Will be rewritten as: 129 + 130 + ```gleam 131 + import gleam/list 132 + 133 + pub fn main() { 134 + list.map([1, 2, 3], fn(n) { n * 2 }) 135 + } 136 + ``` 137 + 138 + ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 139 + 140 + - The language server now offers a code action to convert a function call into 141 + a pipeline. For example, this code: 142 + 143 + ```gleam 144 + import gleam/list 145 + 146 + pub fn main() { 147 + list.map([1, 2, 3], fn(n) { n * 2 }) 148 + } 149 + ``` 150 + 151 + Will be rewritten as: 152 + 153 + ```gleam 154 + import gleam/list 155 + 156 + pub fn main() { 157 + [1, 2, 3] |> list.map(fn(n) { n * 2 }) 158 + } 159 + ``` 160 + 161 + You can also pick which argument is going to be piped. In this case: 162 + 163 + ```gleam 164 + import gleam/list 165 + 166 + pub fn main() { 167 + list.map([1, 2, 3], fn(n) { n * 2 }) 168 + // ^ If you put your cursor over here 169 + } 170 + ``` 171 + 172 + The code will be rewritten as: 173 + 174 + ```gleam 175 + import gleam/list 176 + 177 + pub fn main() { 178 + fn(n) { n * 2 } |> list.map([1, 2, 3], _) 179 + } 180 + ``` 181 + 182 + ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 183 + 184 + - The language server now suggests a code action to generate a function to 185 + encode a custom type as JSON using the `gleam_json` package. For example: 186 + 187 + ```gleam 188 + pub type Person { 189 + Person(name: String, age: Int) 190 + } 191 + ``` 192 + 193 + Will become: 194 + 195 + ```gleam 196 + import gleam/json 197 + 198 + pub type Person { 199 + Person(name: String, age: Int) 200 + } 201 + 202 + fn encode_person(person: Person) -> json.Json { 203 + json.object([ 204 + #("name", json.string(person.name)), 205 + #("age", json.int(person.age)), 206 + ]) 207 + } 208 + ``` 209 + 210 + ([Surya Rose](https://github.com/GearsDatapacks)) 211 + 212 + - The language server now suggests a code action to inline a variable 213 + which is only used once. For example, this code: 214 + 215 + ```gleam 216 + import gleam/io 217 + 218 + pub fn main() { 219 + let greeting = "Hello!" 220 + io.println(greeting) 221 + } 222 + ``` 223 + 224 + Will be rewritten as: 225 + 226 + ```gleam 227 + import gleam/io 228 + 229 + pub fn main() { 230 + io.println("Hello!") 231 + } 232 + ``` 233 + 234 + ([Surya Rose](https://github.com/GearsDatapacks)) 235 + 236 + - The code action to generate a dynamic decoder for a custom type can now 237 + generate decoders for types with multiple variants. For example this code: 238 + 239 + ```gleam 240 + pub type Person { 241 + Adult(age: Int, job: String) 242 + Child(age: Int, height: Float) 243 + } 244 + ``` 245 + 246 + Becomes: 247 + 248 + ```gleam 249 + import gleam/dynamic/decode 250 + 251 + pub type Person { 252 + Adult(age: Int, job: String) 253 + Child(age: Int, height: Float) 254 + } 255 + 256 + fn person_decoder() -> decode.Decoder(Person) { 257 + use variant <- decode.field("type", decode.string) 258 + case variant { 259 + "adult" -> { 260 + use age <- decode.field("age", decode.int) 261 + use job <- decode.field("job", decode.string) 262 + decode.success(Adult(age:, job:)) 263 + } 264 + "child" -> { 265 + use age <- decode.field("age", decode.int) 266 + use height <- decode.field("height", decode.float) 267 + decode.success(Child(age:, height:)) 268 + } 269 + _ -> decode.failure(todo as "Zero value for Person", "Person") 270 + } 271 + } 272 + ``` 273 + 274 + ([Surya Rose](https://github.com/GearsDatapacks)) 275 + 276 + - The language server now suggests a code action to easily interpolate a value 277 + into a string. If the cursor is inside a literal string the language server 278 + will offer to split it: 279 + 280 + ```gleam 281 + "wibble | wobble" 282 + // ^ Triggering the action with the cursor 283 + // here will produce this: 284 + "wibble " <> todo <> " wobble" 285 + ``` 286 + 287 + And if the cursor is selecting a valid Gleam name, the language server will 288 + offer to interpolate it as a variable: 289 + 290 + ```gleam 291 + "wibble wobble woo" 292 + // ^^^^^^ Triggering the code action if you're 293 + // selecting an entire name, will produce this: 294 + "wibble " <> wobble <> " woo" 295 + ``` 296 + 297 + ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 298 + 299 + - The language server now shows module documentation when hovering over a module 300 + name. 301 + ([Surya Rose](https://github.com/GearsDatapacks)) 302 + 303 + ### Formatter 304 + 305 + - Redundant function captures that take no additional arguments are now 306 + rewritten to not use the function capture syntax. 307 + 308 + ```gleam 309 + some_module.some_function(_) 310 + ``` 311 + 312 + This code is reformatted like so: 313 + 314 + ```gleam 315 + some_module.some_function 316 + ``` 317 + 318 + ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 319 + 320 + ### Bug fixes 321 + 322 + - Fixed a bug where division and remainder operators would not work correctly 323 + in guards on the JavaScript target. 324 + ([Surya Rose](https://github.com/GearsDatapacks)) 325 + 326 + - Fixed a bug where the "Generate function" code action would ignore the 327 + provided labels. 328 + ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 329 + 330 + - Fixed a bug where the "Pattern match on argument" and 331 + "Pattern match on variable" code actions would not allow to pattern match on a 332 + private type used in the same module it's defined in. 333 + ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) 334 + 335 + - Fixed a bug where `gleam export package-interface` would not properly generate 336 + the package interface file if some modules were cached. 337 + ([Pedro Francisco](https://github.com/mine-tech-oficial)) and 338 + ([Surya Rose](https://github.com/GearsDatapacks)) 339 + 340 + - Fixed a bug where pattern matching using a UTF-8 string constant would not 341 + work correctly on the JavaScript target when the string contained escape 342 + characters. 343 + ([Richard Viney](https://github.com/richard-viney)) 344 + 345 + - Fixed a bug where `gleam publish` wouldn't include gitignored or nested native 346 + files. 347 + ([PgBiel](https://github.com/PgBiel)) 348 + 349 + ## v1.8.1 - 2025-02-11 350 + 351 + ### Bug fixes 352 + 353 + - Fixed a metadata caching bug where accessors for opaque types could sometimes 354 + be used in other modules. 355 + ([Louis Pilfold](https://github.com/lpil))