From a874a79970383f8b50713e4f59f9b069a54e8fdb Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Mon, 30 Oct 2017 19:41:37 -0400 Subject: [PATCH] Add Option.bindLens function. --- src/Freya.Core/Prelude.fs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Freya.Core/Prelude.fs b/src/Freya.Core/Prelude.fs index 9555c4b..6b6ecf5 100644 --- a/src/Freya.Core/Prelude.fs +++ b/src/Freya.Core/Prelude.fs @@ -109,6 +109,9 @@ module Option = let mapLens (l: Lens<'a,'b>) : Prism<'a option,'b> = Option.map (fst l), snd l >> Option.map + let bindLens (p : Lens<'a, 'b option>) : Lens<'a option, 'b option> = + Option.bind (fst p), snd p >> Option.map + // Constants /// Literal constants for the values of keys within the OWIN environment, @@ -309,4 +312,4 @@ module Constants = let [] ClientCloseStatus = "websocket.ClientCloseStatus" [] - let [] ClientCloseDescription = "websocket.ClientCloseDescription" \ No newline at end of file + let [] ClientCloseDescription = "websocket.ClientCloseDescription"