Last active
December 5, 2019 10:07
-
-
Save mlms13/f995ede97b52b0d1500a3c49c2101ace to your computer and use it in GitHub Desktop.
Commonly-used infix functions in functional programming (Reason edition)
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
let (<|) = ('a => 'b, 'a) => 'b; // purescript and haskell use ($) | |
let (|>) = ('a, 'a => 'b) => 'b; // purescript uses (#) | |
let compose: ('b => 'c, 'a => 'b, 'a) => 'c; | |
let (<<) = compose; // purescript uses (<<<), haskell uses (.) | |
let composeFlipped: ('a => 'b, 'b => 'c, 'a) => 'c; | |
let (>>) = composeFlipped; // purescript uses (>>>) | |
let append: ('a, 'a) => 'a; | |
let (<:>) = append; // i think there was some issue using `<>` which is common in other languages | |
let map: ('a => 'b, t('a)) => t('b); | |
let (<$>) = map; | |
let mapFlipped: (t('a), 'a => 'b) => t('b); | |
let (<#>) = mapFlipped; | |
let ap: (t('a => 'b), t('a)) => t('b); | |
let (<*>) = ap; | |
let bind: (t('a), 'a => t('b)) => t('b); // `flatMap` (or `andThen`) with arguments flipped | |
let (>>=) = bind; | |
let composeKleisli: ('a => t('b), 'b => t('c), 'a) => t('c); | |
let (>=>) = composeKleisli; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment