Skip to content

Commit 986fe87

Browse files
committed
Add VOption to Head and Length
1 parent 2a428be commit 986fe87

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/FSharpPlus/Control/Foldable.fs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ type Head =
259259
static member inline Head (x: '``Foldable<'T>``, [<Optional>]_impl: Default2) = Seq.head (ToSeq.Invoke x) : 'T
260260
static member inline Head (x: '``Foldable<'T>``, [<Optional>]_impl: Default1) = (^``Foldable<'T>`` : (member Head : 'T) x)
261261
static member Head (x: 'T option , [<Optional>]_impl: Head ) = x.Value
262+
static member Head (x: 'T voption , [<Optional>]_impl: Head ) = x.Value
262263
static member Head (x: 'T [] , [<Optional>]_impl: Head ) = x.[0]
263264
static member Head (x: NonEmptySeq<'T> , [<Optional>]_impl: Head ) = x.First
264265
static member Head (x: Id<'T> , [<Optional>]_impl: Head ) = x.getValue
@@ -418,6 +419,7 @@ type Length =
418419
static member Length (x: ResizeArray<'T> , [<Optional>]_impl: Length ) = x.Count
419420
static member Length (x: 'T list , [<Optional>]_impl: Length ) = List.length x
420421
static member Length (x: option<'T> , [<Optional>]_impl: Length ) = if x.IsSome then 1 else 0
422+
static member Length (x: voption<'T> , [<Optional>]_impl: Length ) = if x.IsSome then 1 else 0
421423
static member Length (x: 'T [] , [<Optional>]_impl: Length ) = Array.length x
422424

423425
static member inline Invoke (source: '``Foldable<'T>``) =

0 commit comments

Comments
 (0)