Skip to content

maxgherman/ts-haskell

Repository files navigation

ts-haskell

Mapping Haskell typeclasses to TypeScript

npm i
npm run lint
npm run build
npm test

Typeclass relationships

flowchart LR
    BIFUNCTOR((Bifunctor))
    BIFOLDABLE((BiFoldable))
    BITRAVERSABLE((BiTraversable))
    FUNCTOR((Functor))
    APPLY((Apply))
    APPLICATIVE((Applicative))
    ALTERNATIVE((Alternative))
    MONAD((Monad))
    MONADTRANS((MonadTrans))
    COMONAD((Comonad))
    MONOID((Monoid))
    SEMIGROUP((Semigroup))
    TRAVERSABLE((Traversable))
    FOLDABLE((Foldable))
    MONADPLUS((MonadPlus))

    BIFUNCTOR -- fix one arg --> FUNCTOR
    BIFUNCTOR --> BIFOLDABLE
    BIFOLDABLE --> BITRAVERSABLE
    BIFUNCTOR --> BITRAVERSABLE
    FUNCTOR --> APPLY
    APPLY --> APPLICATIVE
    APPLICATIVE --> ALTERNATIVE
    APPLICATIVE --> MONAD
    MONAD --> MONADTRANS
    MONAD -. monoidal in endofunctors .-> MONOID
    MONOID --> SEMIGROUP
    COMONAD --> FUNCTOR
    FUNCTOR --> TRAVERSABLE
    FOLDABLE --> TRAVERSABLE
    FOLDABLE --> MONADPLUS
    ALTERNATIVE -. applicative pattern .-> MONOID
Loading

Instances

  • = available instance
  • * = requires the underlying value type to have the same instance
Type Functor Apply Applicative Alternative Monad MonadTrans MonadPlus Bifunctor BiFoldable BiTraversable Comonad ComonadApply Foldable Traversable Semigroup Monoid
Maybe ✓* ✓*
Either e ✓* ✓* ✓* ✓*
List
NonEmpty
Reader r ✓* ✓*
Writer w ✓* ✓* ✓*
State s
(->) r ✓* ✓*
Tuple2 a ✓* ✓* ✓*
Promise ✓* ✓*
Unit ()
ReaderT r m ✓* ✓* ✓* ✓*
WriterT w m ✓* ✓* ✓* ✓* ✓* ✓* ✓*
StateT s m ✓* ✓* ✓* ✓*
MaybeT m ✓* ✓* ✓* ✓*
EitherT e m ✓* ✓* ✓* ✓* ✓* ✓* ✓*
ExceptT e m ✓* ✓* ✓* ✓*
RWST r w s m ✓* ✓* ✓* ✓*
RWS r w s ✓* ✓* ✓*

References

About

Mapping Haskell typeclasses to typescript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •