1
2
3
4
5
6
7
8
9
10
11
12 package genmeth
13
14
15 type Either[A, B any] struct {}
16
17 func (Either[A, B]) A() A { panic(42) }
18 func (Either[A, B]) B() B { panic(42) }
19
20 type Option[T any] struct {}
21
22 func (Option[T]) Get() T { panic(42) }
23 func (Option[T]) GetOrDefault[U any](u U) Either[T, U] { panic(42) }
24 func (Option[T]) MapIfPresent[U any](f func(T) U) Option[U] { panic(42) }
25
26
27 type Box[P any] struct {}
28
29 func (*Box[P]) Get() P { panic(42) }
30 func (*Box[P]) Set(p P) { panic(42) }
31
32
33 type List[E any] []E
34 func (List[E]) Map[R any](f func(E) R) List[R] { panic(42) }
35 func (List[E]) FlatMap[R any](f func(E) List[R]) List[R] { panic(42) }
36 func (List[E1]) Zip[E2, R any](l List[E2], f func(E1, E2) R) List[R] { panic(42) }
37
38 type Pair[A, B any] struct {}
39 type BiList[A, B any] List[Pair[A, B]]
40
41 func (BiList[A, B]) Flip() BiList[B, A] { panic(42) }
42 func (BiList[A, B]) MapKeys[R any](f func(A) R) BiList[R, B] { panic(42) }
43 func (BiList[A, B]) MapValues[R any](f func(B) R) BiList[A, R] { panic(42) }
44 func (BiList[A, B]) FlatMapValues[R any](f func(B) List[R]) BiList[A, R] { panic(42) }
45 func (BiList[A, B]) MapEntries[K, V any](f func(Pair[A, B]) Pair[K, V]) BiList[K, V] { panic(42) }
46
47 type OrderedList[E comparable] []E
48 func (OrderedList[E]) Min() Option[E] { panic(42) }
49 func (OrderedList[E]) Max() Option[E] { panic(42) }
50
View as plain text