This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Matcher { | |
caseA (any): any; | |
caseB (any): any; | |
caseAny (any): any; | |
} | |
class Parent { | |
data: any; | |
constructor (data: any) { | |
this.data = data | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Functor { | |
fmap: (any) => any; | |
} | |
interface Monad extends Functor { | |
bind: (any) => Monad; | |
} | |
interface MaybeMatcher { | |
just: (any) => Maybe; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Either { | |
isRight: Boolean; | |
isLeft: Boolean; | |
left: LeftProjection; | |
right: RightProjection; | |
} | |
class Right implements Either { | |
isRight: Boolean = true; | |
isLeft: Boolean = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Functor { | |
fmap: (any) => any; | |
} | |
interface Monad extends Functor { | |
bind: (any) => Monad; | |
} | |
interface Maybe extends Monad { | |
} |