Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ShalokShalom/11cf9b1943d36ac51939e83bb0fced84 to your computer and use it in GitHub Desktop.
Save ShalokShalom/11cf9b1943d36ac51939e83bb0fced84 to your computer and use it in GitHub Desktop.
Haskell operator compatibility layer for F-Sharp
+----------------------+--------------------+--------------------+--------------------+
|      Operation       |      F-Sharp       |     Compability    |      Haskell       |
+======================+====================+====================+====================+
| List.append          |         @          |                    |        ++          |
+----------------------+--------------------+--------------------+--------------------+
| Function composition |       f << g       |       f . (g)      |       f . g        |
+----------------------+--------------------+--------------------+--------------------+
|                      |         =          |        ==          |        ==          |
+----------------------+--------------------+--------------------+--------------------+
|                      |         <|         |        $           |        $           |
+----------------------+--------------------+--------------------+--------------------+
|                      |         <>         |        =/          |        /=          |
+----------------------+--------------------+--------------------+--------------------+
| flip                 |         />         |                    |                    |
+----------------------+--------------------+--------------------+--------------------+
| apply function to    |      </ or |>      |   not available    |  not available     | 
| a value              |                    |     in Haskell     |    in Haskell      |
+----------------------+--------------------+--------------------+--------------------+
|                      |                    |                    |                    |
+----------------------+--------------------+--------------------+--------------------+
|                                        Functors                                     |
+----------------------+--------------------+--------------------+--------------------+
| map                  |     <!> or <<|     |     <!> or fmap    |    <$> or fmap     |
+----------------------+--------------------+--------------------+--------------------+
| map with             |                    |                    |                    |
| interchanged         |        |>>         |                    |                    |
| arguments            |                    |                    |                    |
+----------------------+--------------------+--------------------+--------------------+
|                      |                    |                    |                    |
+----------------------+--------------------+--------------------+--------------------+
|                                        Monoids                                      |
+----------------------+--------------------+--------------------+--------------------+
| zero element         |        zero        |       mempty       |       mempty       |
+----------------------+--------------------+--------------------+--------------------+
| append               |     ++ or plus     |       mappen       |       mappend      |
+----------------------+--------------------+--------------------+--------------------+
|                      |                    |                    |                    |
+----------------------+--------------------+--------------------+--------------------+
|                                 Applicative functors                                |
+----------------------+--------------------+--------------------+--------------------+
| apply (combine)      |        <*>         |        <*>         |       <*>          |
+----------------------+--------------------+--------------------+--------------------+
| Sequence actions     |                    |                    |                    |
| and discard values   |        *>          |        *>          |       *>           |
| of first argument    |                    |                    |                    |
+----------------------+--------------------+--------------------+--------------------+
| Sequence actions     |                    |                    |                    |
| and discard values   |        <*          |        <*          |       <*           |
| of second argument   |                    |                    |                    |
+----------------------+--------------------+--------------------+--------------------+
| A variant of <*>     |                    |                    |                    |
| with the arguments   |        <**>        |        <**>        |        <**>        |
| reversed.            |                    |                    |                    |
+----------------------+--------------------+--------------------+--------------------+
| Lift a value.        |       result       |        pure'       |        pure        |
+----------------------+--------------------+--------------------+--------------------+
|                      |                    |                    |                    |
+----------------------+--------------------+--------------------+--------------------+
|                                      Alternatives                                   |
+----------------------+--------------------+--------------------+--------------------+
| binary operation     |                    |        <|>         |        <|>         |
+----------------------+--------------------+--------------------+--------------------+
|                      |                    |                    |                    |
+----------------------+--------------------+--------------------+--------------------+
|                                         Monads                                      |
+----------------------+--------------------+--------------------+--------------------+
| Bind sequentially    |                    |                    |                    |
| compose two actions, |                    |                    |                    |
| passing any value    |                    |        >>=         |        >>=         |
| produced by the      |                    |                    |                    |
| first as an argument |                    |                    |                    |
| to the second.       |                    |                    |                    |
+----------------------+--------------------+--------------------+--------------------+
| Bind with            |                    |                    |                    |
| interchanged         |                    |        =<<         |        =<<         |
| arguments.           |                    |                    |                    |
+----------------------+--------------------+--------------------+--------------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment