Skip to content

Commit

Permalink
Add Option.fs
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolamilekic committed Dec 16, 2018
1 parent 6b4e040 commit 1b317cb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Milekic.YoLo/Milekic.YoLo.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<Compile Include="Result.fs" />
<Compile Include="Eventually.fs" />
<Compile Include="Update.fs" />
<Compile Include="Option.fs" />
<Compile Include="AutoOpen.fs" />
</ItemGroup>

Expand Down
13 changes: 13 additions & 0 deletions src/Milekic.YoLo/Option.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Milekic.YoLo

module Seq =
let onlySome xs = seq {
for x in xs do match x with | Some v -> yield v | None -> ()
}

module List =
let onlySome list =
List.foldBack
(fun x xs -> match x with | None -> xs | Some v -> v::xs )
list
[]

0 comments on commit 1b317cb

Please sign in to comment.