A proper type system for Nu
### Related problem We at [Codchi](https://codchi.dev) are currently considering a rewrite from Haskell to Nushell. Coming from Haskell, however, I miss a few things which are crucial for a typed functional language, especially if you want to write more than just a script. Don't get me wrong, Nushell is already an amazing shell, but there are some enhancements that would enable writing larger applications in Nushell. ### Describe the solution you'd like #### Algebraic Datatypes A really useful feature of Rust and Haskell is *Algebraic Datatypes*, a fancy name for records and sum types. The latter is known as `enum` in Rust and is used for `Result`, `Option` and so on. This is one of the Features which set Rust and Haskell apart from more mainstream languages like Java, Go, C# and so on. Nushell already has `record<...>` and `table<...>`, but lacks a convenient way to define them (see #10630). 🎯 I think an ergonomic solution is to allow multiline record declarations and standalone types, just like `struct` in Rust: ```nushell type foo = record< bar: int, baz: string, my_field: my_custom_type, my_other_field: my_alias ... > type my_custom_type = record<...> type my_alias = decimal ``` On the other hand, Nushell lacks sum types. The syntax could look like this: ```nushell type my_sumtype = enum< variant_a: int, variant_b: record<foo: string, bar: int> > ``` Also they require pattern matching support to force handling *all* possible variants of a
Posted by htngr on Nov 20, 2023, 1:14 PM
Tags
Related issues
- some bike vendor told me that the biggest problem with regular to ebike conversion was that regular bike frames were not strong enough to...
- I think of this as the kiosk economy.
- What a goofy comment.
- There's lots of evidence for positive influences of Caffeine on the body (some negative as well), especially the brain.
- Compose support in WSLc
- [RFC] Roadmap to v2.0
Raise real-world problems, find people facing the same issue, and discuss solutions.2,000 issues0 comments
support (Other)
some bike vendor told me that the biggest problem with regular to ebike conversion was that regular bike frames were not strong enough to...
I think of this as the kiosk economy.
What a goofy comment.
There's lots of evidence for positive influences of Caffeine on the body (some negative as well), especially the brain.
Compose support in WSLc
[RFC] Roadmap to v2.0
[Feature]: Add TurboQuant Support for KV Cache Quantization
Support for AGENTS.md and .agents/skills/, the community has been asking since August 2025
A proper type system for Nu
### Related problem We at [Codchi](https://codchi.dev) are currently considering a rewrite from Haskell to Nushell. Coming from Haskell, however, I miss a few things which are crucial for a typed functional language, especially if you want to write more than just a script. Don't get me wrong, Nushell is already an amazing shell, but there are some enhancements that would enable writing larger applications in Nushell. ### Describe the solution you'd like #### Algebraic Datatypes A really useful feature of Rust and Haskell is *Algebraic Datatypes*, a fancy name for records and sum types. The latter is known as `enum` in Rust and is used for `Result`, `Option` and so on. This is one of the Features which set Rust and Haskell apart from more mainstream languages like Java, Go, C# and so on. Nushell already has `record<...>` and `table<...>`, but lacks a convenient way to define them (see #10630). 🎯 I think an ergonomic solution is to allow multiline record declarations and standalone types, just like `struct` in Rust: ```nushell type foo = record< bar: int, baz: string, my_field: my_custom_type, my_other_field: my_alias ... > type my_custom_type = record<...> type my_alias = decimal ``` On the other hand, Nushell lacks sum types. The syntax could look like this: ```nushell type my_sumtype = enum< variant_a: int, variant_b: record<foo: string, bar: int> > ``` Also they require pattern matching support to force handling *all* possible variants of a
Comments (0)
No comments yet. Start the discussion.