File tree Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -8,13 +8,16 @@ open FSharpPlus.Control
88
99
1010/// A type-safe list that contains at least one element.
11+ [<StructuredFormatDisplay( " {StructuredFormatDisplay}" ) >]
1112type NonEmptyList < 't > = { Head: 't ; Tail: 't list } with
1213 interface IEnumerable< 't> with member x.GetEnumerator () = ( let { Head = x ; Tail = xs } = x in seq ( x:: xs)) .GetEnumerator ()
1314 interface System.Collections.IEnumerable with member x.GetEnumerator () = ( let { Head = x ; Tail = xs } = x in seq ( x:: xs)) .GetEnumerator () :> System.Collections.IEnumerator
1415 interface IReadOnlyCollection< 't> with member s.Count = 1 + List.length s.Tail
1516 interface IReadOnlyList< 't> with member s.Item with get index = s.Item index
1617 interface NonEmptySeq< 't> with member s.First = s.Head
1718
19+ member private this.StructuredFormatDisplay = " nelist {" + ( sprintf " %A " ( this.Head:: this.Tail)).[ 1 ..^ 1 ] + " }"
20+
1821 [<System.Obsolete( " Use Head instead." ) >]
1922 member this.head = let { Head = a ; Tail = _ } = this in a
2023
You can’t perform that action at this time.
0 commit comments