import { Generic , Parameter } from "../.." ; export interface MonadProps < T , Params extends ArrayLike < any > > { } export type GenericMonad < F , A = any > = Generic < F , [ A ] , MonadProps < F , [ A ] > > ; export type MonadParameter < F > = Parameter < F , 0 , MonadProps < F , any [ ] > > ; export interface Monad < G > { map < T , U > ( transform ) : < F extends GenericMonad < G , T > > ( monadic : F ) => GenericMonad < F , U > ; chain < T , U extends GenericMonad < G > > ( transform ) : < F extends GenericMonad < G , T > > ( monadic : F ) => U ; of < T > ( a ) : GenericMonad < G , T > ; } export type Matchable < G extends GenericMonad < any > , Cons extends { [ Key in keyof Cons ] : GenericMonad < G > | ( < T > ( value : T ) => GenericMonad < G > ) ; } > = Cons & { match < A , B > ( cons ) : < F extends GenericMonad < G , A > > ( monadic : F ) => B ; } ;