Skip to content

Instantly share code, notes, and snippets.

@wallymathieu
Last active August 25, 2019 10:25
Show Gist options
  • Save wallymathieu/19c74f784652f18ae3111056b8403f82 to your computer and use it in GitHub Desktop.
Save wallymathieu/19c74f784652f18ae3111056b8403f82 to your computer and use it in GitHub Desktop.
F#+ Haskell Compatibility
+--------------------+--------------------+-------------------------+--------------------+
|Operation           | F#+ / F#           |F#+ Haskell Compatibility|Haskell             |
+====================+====================+=========================+====================+
|List.append         | @                  |                         | ++                 |
+--------------------+--------------------+-------------------------+--------------------+
|Function composition| f << g             | f . (g)                 | f . g              |
+--------------------+--------------------+-------------------------+--------------------+
|                    | <|                 | $                       | $                  |
+--------------------+--------------------+-------------------------+--------------------+
|                    | =                  | ==                      | ==                 |
+--------------------+--------------------+-------------------------+--------------------+
|                    | <>                 | =/                      | /=                 |
+--------------------+--------------------+-------------------------+--------------------+
|flip                | />                 |                         |                    |
+--------------------+--------------------+-------------------------+--------------------+
|apply function to   | </ or |>           |                         |                    | 
|value               |                    |                         |                    |
+--------------------+--------------------+-------------------------+--------------------+
|                    |                    |                         |                    |
+--------------------+--------------------+-------------------------+--------------------+
|Functor             |                    |                         |                    |
+--------------------+--------------------+-------------------------+--------------------+
|map                 |<!> or <<|          |  <!> or fmap            | <$> or fmap        |
+--------------------+--------------------+-------------------------+--------------------+
|same as map but     | |>>                |                         |                    |
|arguments           |                    |                         |                    |
|interchanged        |                    |                         |                    |
+--------------------+--------------------+-------------------------+--------------------+
|                    |                    |                         |                    |
+--------------------+--------------------+-------------------------+--------------------+
|Monoid              |                    |                         |                    |
+--------------------+--------------------+-------------------------+--------------------+
|monoid zero element | zero               | mempty                  | mempty             |
+--------------------+--------------------+-------------------------+--------------------+
|append              | ++ or plus         | mappend                 | mappend            |
+--------------------+--------------------+-------------------------+--------------------+
|                    |                    |                         |                    |
+--------------------+--------------------+-------------------------+--------------------+
|Applicative functors|                    |                         |                    |
+--------------------+--------------------+-------------------------+--------------------+
|apply (combine)     | <*>                | <*>                     | <*>                |
+--------------------+--------------------+-------------------------+--------------------+
|Sequence actions,   | *>                 | *>                      | *>                 |
|discarding the value|                    |                         |                    |
|of the first        |                    |                         |                    |
|argument.           |                    |                         |                    |
+--------------------+--------------------+-------------------------+--------------------+
|Sequence actions,   | <*                 | <*                      | <*                 |
|discarding the value|                    |                         |                    |
|of the second       |                    |                         |                    |
|argument.           |                    |                         |                    |
+--------------------+--------------------+-------------------------+--------------------+
|A variant of <*>    | <**>               | <**>                    | <**>               |
|with the arguments  |                    |                         |                    |
| reversed.          |                    |                         |                    |
+--------------------+--------------------+-------------------------+--------------------+
|Lift a value.       | result             | pure'                   | pure               |
+--------------------+--------------------+-------------------------+--------------------+
|                    |                    |                         |                    |
+--------------------+--------------------+-------------------------+--------------------+
|Alternative         |                    |                         |                    |
+--------------------+--------------------+-------------------------+--------------------+
|alternatives: binary| <|>                | <|>                     | <|>                |
|operation           |                    |                         |                    |
+--------------------+--------------------+-------------------------+--------------------+
|                    |                    |                         |                    |
+--------------------+--------------------+-------------------------+--------------------+
|Monad               |                    |                         |                    |
+--------------------+--------------------+-------------------------+--------------------+
|Bind Sequentially   | >>=                | >>=                     | >>=                |
|compose two actions,|                    |                         |                    |
|passing any value   |                    |                         |                    |
|produced by the     |                    |                         |                    |
|first as an argument|                    |                         |                    |
|to the second.      |                    |                         |                    |
+--------------------+--------------------+-------------------------+--------------------+
|Same as >>=, but    | =<<                | =<<                     | =<<                |
|with the arguments  |                    |                         |                    |
|interchanged.       |                    |                         |                    |
+--------------------+--------------------+-------------------------+--------------------+
@wallymathieu
Copy link
Author

Updated with changes from @gusty fork

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment