From cf3c0c9df80a205e4d4465b0800dfd33692ca9a9 Mon Sep 17 00:00:00 2001 From: gusty <1261319+gusty@users.noreply.github.com> Date: Tue, 26 Sep 2023 11:12:02 +0200 Subject: [PATCH] Cleanup --- src/FSharpPlus/Data/NonEmptySeq.fs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/FSharpPlus/Data/NonEmptySeq.fs b/src/FSharpPlus/Data/NonEmptySeq.fs index 529b63f22..b3fa54980 100644 --- a/src/FSharpPlus/Data/NonEmptySeq.fs +++ b/src/FSharpPlus/Data/NonEmptySeq.fs @@ -53,7 +53,7 @@ type NonEmptySeq<'t> = static member ``<*>`` (f: NonEmptySeq<_> , x: NonEmptySeq<'T>) : NonEmptySeq<'U> = NonEmptySeq<_>.apply f x static member Lift2 (f, x: NonEmptySeq<_> , y: NonEmptySeq<_>) = NonEmptySeq<_>.lift2 f x y static member Lift3 (f, x: NonEmptySeq<_> , y: NonEmptySeq<_> , z: NonEmptySeq<_>) = NonEmptySeq<_>.lift3 f x y z - static member IsLeftZero (_: NonEmptySeq<_>) = printfn "asking if it's left zero"; false + static member IsLeftZero (_: NonEmptySeq<_>) = false // no need, it should take the one from Seq --> member this.Head (x: NonEmptySeq<'T> , []_impl: Head ) = x.First @@ -78,19 +78,16 @@ type NonEmptySeq<'t> = static member inline Traverse (t: _ seq, f) = - printfn "traverse 1" let cons x y = seq {yield x; yield! y} let cons_f x ys = Map.Invoke (cons: 'a->seq<_>->seq<_>) (f x) <*> ys Map.Invoke NonEmptySeq<_>.unsafeOfSeq (Seq.foldBack cons_f t (result Seq.empty)) static member inline Traverse (t: NonEmptySeq<'T>, f: 'T->'``Functor<'U>``) = - printfn "traverse 2" let mapped = NonEmptySeq<_>.map f t Sequence.ForInfiniteSequences (mapped, IsLeftZero.Invoke, NonEmptySeq<_>.ofList) : '``Functor>`` #if !FABLE_COMPILER static member Traverse (t: 't NonEmptySeq, f: 't->Async<'u>) : Async> = async { - printfn "traverse 3" let! ct = Async.CancellationToken return seq { use enum = t.GetEnumerator () @@ -98,16 +95,7 @@ type NonEmptySeq<'t> = yield Async.RunSynchronously (f enum.Current, cancellationToken = ct) } |> NonEmptySeq<_>.unsafeOfSeq } #endif - static member inline Sequence (t: NonEmptySeq<'``Applicative<'T>``>) = printfn "sequence 1"; Sequence.ForInfiniteSequences (t, IsLeftZero.Invoke, NonEmptySeq<_>.ofList) : '``Applicative>`` - // static member inline Sequence (t: NonEmptySeq<'``Applicative<'T>``>, []_output: '``Applicative>`` , []_impl: obj) = printfn "sequence 1"; Sequence.ForInfiniteSequences (t, IsLeftZero.Invoke, NonEmptySeq<_>.ofList) : '``Applicative>`` - // static member Sequence (t: NonEmptySeq> ) = Sequence.ForInfiniteSequences(t, Option.isNone, NonEmptySeq<_>.ofList) : option> - // static member Sequence (t: NonEmptySeq>) = Sequence.ForInfiniteSequences(t, (function Error _ -> true | _ -> false), NonEmptySeq<_>.ofList) : Result, 'e> - // static member Sequence (t: NonEmptySeq>) = Sequence.ForInfiniteSequences(t, (function Choice2Of2 _ -> true | _ -> false), NonEmptySeq<_>.ofList) : Choice, 'e> - // static member Sequence (t: NonEmptySeq> ) = Sequence.ForInfiniteSequences(t, List.isEmpty, NonEmptySeq<_>.ofList) : list> - // static member Sequence (t: NonEmptySeq<'t []> ) = Sequence.ForInfiniteSequences(t, Array.isEmpty, NonEmptySeq<_>.ofList) : NonEmptySeq<'t> [] - // #if !FABLE_COMPILER - // static member Sequence (t: NonEmptySeq>) = Async.Sequence t |> Async.map NonEmptySeq<_>.unsafeOfSeq : Async> - // #endif + static member inline Sequence (t: NonEmptySeq<'``Applicative<'T>``>) = Sequence.ForInfiniteSequences (t, IsLeftZero.Invoke, NonEmptySeq<_>.ofList) : '``Applicative>`` /// A type alias for NonEmptySeq<'t> type neseq<'t> = NonEmptySeq<'t>