Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/content/1.4/code/ocaml/snippet04.ml
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
let pure x = x, ""
let ( >=> ) = fun m1 m2 ->
let y, s1 = m1 x in
let z, s2 = m2 x in
z, StringLabels.concat ~sep:"" [ s1; s2 ]
4 changes: 1 addition & 3 deletions src/content/1.4/code/ocaml/snippet05.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
let up_case : string -> string writer =
fun s -> String.uppercase s, "up_case "
;;
let return : 'a -> 'a writer = fun a -> a, ""
4 changes: 4 additions & 0 deletions src/content/1.4/code/ocaml/snippet06.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
let up_case : string -> string writer =
fun s -> String.uppercase s, "up_case "
;;

let to_words : string -> string list writer =
fun s -> String.split s ~on:' ', "to_words "
;;
8 changes: 7 additions & 1 deletion src/content/1.4/code/reason/snippet04.re
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
let pure = x => (x, "");
let (>=>) = (m1, m2) => {
let (y, s1) = m1(x);

let (z, s2) = m2(x);

(z, StringLabels.concat(~sep="", [s1, s2]));
};
3 changes: 1 addition & 2 deletions src/content/1.4/code/reason/snippet05.re
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
let up_case: string => writer(string) =
s => (String.uppercase(s), "up_case ");
let return: 'a => writer('a) = a => (a, "");
9 changes: 5 additions & 4 deletions src/content/1.4/code/reason/snippet06.re
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
let to_words: string => writer(list(string)) = (
s => (String.split(s, ~on=' '), "to_words "):
string => writer(list(string))
);
let up_case: string => writer(string) =
s => (String.uppercase(s), "up_case ");

let to_words: string => writer(list(string)) =
s => (String.split(s, ~on=' '), "to_words ");kkkk