Snippets

orbitzN boaR6: Untitled snippet

Created by orbitzN

File applicative.ml Added

  • Ignore whitespace
  • Hide word diff
+let app f_opt v_opt =
+  match (f_opt, v_opt) with
+    | (Some f, Some v) -> Some (f v)
+    | _ -> None
+;;
+
+let ( <*> ) = app
+;;
+
+let fmap f = function
+  | Some v -> Some (f v)
+  | None -> None
+;;
+
+let ( <$> ) = fmap
+;;
+
+(+) <$> Some 1 <*> Some 2
+;;
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.