Skip to content

Commit

Permalink
Adding info about Dependent types
Browse files Browse the repository at this point in the history
  • Loading branch information
davideme committed Jan 7, 2024
1 parent c48420c commit 18f2d79
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions FunctionalProgramming.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,16 @@ None of these languages support Pure functions


## Type systems
| Language/Paradigm | Product types | sum types | Pattern Matching |
| ----------------- | ------------- | ------------------------------ | --------------------------------- |
| JavaScript | |||
| Python | | ✅since 3.5 with typing.Union | ✅since 3.10 with match statement |
| Typescript | | ✅discriminated unions | switch-case with shared field. |
| Java | | Simulated via Sealed Interface | since Java 21 |
| C# | | Simulated via Sealed Class | since C# 9.0 |
| C++ | | since C++17 with std::variant | since C++17 with std::visit |
| PHP | |||
| Go | |||

They all support Product Types via Class, Record or Struct.

| Language/Paradigm | Sum types | Pattern Matching | Dependent types |
| ----------------- | ------------------------------ | --------------------------------- | ---------------------------- |
| JavaScript ||||
| Python | ✅since 3.5 with typing.Union | ✅since 3.10 with match statement ||
| Typescript | ✅discriminated unions | switch-case with shared field. | some type-level computations |
| Java | Simulated via Sealed Interface | since Java 21 ||
| C# | Simulated via Sealed Class | since C# 9.0 | some type-level computations |
| C++ | since C++17 with std::variant | since C++17 with std::visit | some type-level computations |
| PHP ||||
| Go ||||

0 comments on commit 18f2d79

Please sign in to comment.