Operation | Input | Result | Notes |
---|---|---|---|
map | F[A] , A => B |
F[B] |
Functor |
apply | F[A] , F[A => B] |
F[B] |
Applicative |
(fa, fb, ...).mapN | (F[A], F[B], ...) , (A, B, ...) => C |
F[C] |
Applicative |
(fa, fb, ...).tupled | (F[A], F[B], ...) |
F[(A, B, ...)] |
Applicative |
flatMap | F[A] , A => F[B] |
F[B] |
Monad |
traverse | F[A] , A => G[B] |
G[F[A]] |
Traversable; fa.traverse(f) == fa.map(f).sequence ; "foreach with effects" |
sequence | F[G[A]] |
G[F[A]] |
Same as fga.traverse(identity) |
attempt | F[A] |
F[Either[E, A]] |
Given ApplicativeError[F, E] |
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
'use strict'; | |
/* | |
N-Gram-Based Text Categorisation | |
Implementation by marko@zabreznik.net | |
28.3.2015 All rights reserved. | |
Based on the paper by: | |
William B. Cavnar and John M. Trenkle | |
Environmental Research Institute of Michigan |