Skip to content

Commit 6a3a85b

Browse files
committed
Optimize closure
1 parent 1ffcb23 commit 6a3a85b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/FSharpPlus/Data/DList.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,11 @@ type DList<'T> (length: int, data: DListData<'T>) =
6464
// and so is more appropriately implemented under the foldBack signature
6565
// See http://stackoverflow.com/questions/5324623/functional-o1-append-and-on-iteration-from-first-element-list-data-structure/5334068#5334068
6666
static member foldBack (f: 'T -> 'State -> 'State) (l: DList<'T>) (state: 'State) =
67+
let f = OptimizedClosures.FSharpFunc<_, _, _>.Adapt f
6768
let rec walk lefts l xs =
6869
match l with
6970
| Nil -> finish lefts xs
70-
| Unit x -> finish lefts <| f x xs
71+
| Unit x -> finish lefts <| f.Invoke (x, xs)
7172
| Join (x, y) -> walk (x::lefts) y xs
7273
and finish lefts xs =
7374
match lefts with

0 commit comments

Comments
 (0)