gotypes

module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2022 License: MIT

README

Golang Monadic Types

To stress test Golang's generic type system by implementing the basic monadic types (maybe/option, either, vector, etc.)

Limitation

  • cannot produce a new type parameter in a receiver function (a method)
    • e.g. this won't work: func (iter Iterator[T]) ChunkSlice(size int) Iterator[[]T] ([]T is a new type parameter)
  • type inference sometimes is broken (see the unit tests where I have to add the variable type hint)
  • cannot define type alias inside function (will treat the type parameter as index) - it is not a critical issue but makes the code cumbersome
  • Go doesn't have first class tuple and pair types: Tuple[T...], or Pair[T, P]
  • no variadic type parameter support (or I don't know?)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL