From 75a0a8e49f601131932f36f5deeebccc59276bb3 Mon Sep 17 00:00:00 2001 From: Jakub Svec Date: Sun, 19 Jan 2025 17:35:14 -0800 Subject: [PATCH 1/3] Update snippet06.ml to match Haskell snippet This code is copied and pasted from the previous content in "src/content/1.4/ocaml/snippet05.ml" to match the Haskell code to which it is associated --- src/content/1.4/code/ocaml/snippet06.ml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/content/1.4/code/ocaml/snippet06.ml b/src/content/1.4/code/ocaml/snippet06.ml index ed0f0d298..461f7320d 100644 --- a/src/content/1.4/code/ocaml/snippet06.ml +++ b/src/content/1.4/code/ocaml/snippet06.ml @@ -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 " ;; From 951a19732470f78072001fdad373759fc250eac9 Mon Sep 17 00:00:00 2001 From: Jakub Svec Date: Sun, 19 Jan 2025 17:38:18 -0800 Subject: [PATCH 2/3] Update snippet05.ml to match Haskell snippet This code is the same code found in the KleisliIdentity module in section 8.5 in order to match the Haskell code to which it is associated --- src/content/1.4/code/ocaml/snippet05.ml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/content/1.4/code/ocaml/snippet05.ml b/src/content/1.4/code/ocaml/snippet05.ml index 380e46a53..c3310c8c9 100644 --- a/src/content/1.4/code/ocaml/snippet05.ml +++ b/src/content/1.4/code/ocaml/snippet05.ml @@ -1,3 +1 @@ -let up_case : string -> string writer = - fun s -> String.uppercase s, "up_case " -;; +let return : 'a -> 'a writer = fun a -> a, "" From c945c79689bcae93e1e50787c7a89824eda19ebc Mon Sep 17 00:00:00 2001 From: Jakub Svec Date: Sun, 19 Jan 2025 17:41:04 -0800 Subject: [PATCH 3/3] Update snippet04.ml to match Haskell snippet This is the same code found in section 8.5 in the KleisliComposition module in order to match the Haskell code to which it is associated --- src/content/1.4/code/ocaml/snippet04.ml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/content/1.4/code/ocaml/snippet04.ml b/src/content/1.4/code/ocaml/snippet04.ml index d7c311f4f..ccaab18c8 100644 --- a/src/content/1.4/code/ocaml/snippet04.ml +++ b/src/content/1.4/code/ocaml/snippet04.ml @@ -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 ]