Skip to content

Commit

Permalink
Type + type inference
Browse files Browse the repository at this point in the history
  • Loading branch information
tisnik committed Sep 12, 2023
1 parent 0432853 commit bb0ca2f
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions docs/ml.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,40 @@ let rec length([]) = 0

---

### Types (very simple example)

```
type car = {
Color: string;
Model: string;
Manufacturer: string;
Year: int;
}
let toyota :car = {Color="silver"; Model="Corolla"; Manufacturer="Toyota"; Year=1986};;
Printf.printf "%A" toyota
```

---

### Type inference again

```
type car = {
Color: string;
Model: string;
Manufacturer: string;
Year: int;
}
let toyota = {Color="silver"; Model="Corolla"; Manufacturer="Toyota"; Year=1986};;
Printf.printf "%A" toyota
```

---

## Is it worth it?

* OCaml (Jane Stree + others)
Expand Down

0 comments on commit bb0ca2f

Please sign in to comment.