-
algebraic data types are a feature of many modern languages, including rust and typescript. They allow to express the union or intersection of types.
### Syntax in Typescript
```ts
type T = strin…
-
https://github.com/ScalaTaiwan/ScalaTaiwan/blob/master/2018-03-07-Programming_with_Algebraic_Data_Types/README.md
-
```
def data Option {
Some(int);
Nothing;
}
```
ADTs can be destructured via the following construction:
```
if [ADT name]? [ident] -> [(e1, e2, ... , en)] {
}
```
Example:
`…
-
Would be lovely to have [GADTs](https://en.wikipedia.org/wiki/Generalized_algebraic_data_type)!
Eg.
```elm
type Expr : Type -> Type =
| Bool : Bool -> Expr Bool
| Int : Int …
-
I would like to create e.g. a linked list.
But the following doesn't work:
```
data LinkedList a:Type =
Nil
Cons val:a tail:LinkedList
:p Cons 1 Nil
```
the declaration gives …
-
In Scala it looks like this:
```scala
sealed trait Point2D
case class Cartesian2(x: Double, y: Double) extends Point2D
case class Polar2(r: Double, theta: Double) extends Point2D
sealed trait…
-
Many languages support algebraic data types, including Haskell, OCaml, Scala, Swift and Rust. Many programmers like them and they have some benefits over Python subclassing, which I won't discuss in d…
-
Go and Algebraic Data Types
https://ift.tt/2MtEOi0
Eli Bendersky
Algebraic data types (also known as variant types, sum types or discriminated unions) is a neat feature of some programming language…
-
### Summary
_No response_
### Feature Spec
As a Wing user, I would like to be able to express enums where each choice may have one or more associated fields.
Examples:
```js
// Wing
e…
-
Coconut's [documentation for the `data` keyword](http://coconut.readthedocs.io/en/master/DOCS.html#data) states that it lets you create immutable ADTs. I see a nice concise language for creating immut…