You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/FSharpPlus/Data/Free.fs
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -33,14 +33,14 @@ module Free =
33
33
| Free.Pure x -> Choice1Of2 x
34
34
| Free.Roll x ->letx= unbox x in Choice2Of2 x
35
35
36
-
let inlinemapf x =
36
+
let inlinemap([<InlineIfLambda>]f)x =
37
37
let recloop(f:'T->'U)(x:Free<'``Functor<'T>``,'T>):Free<'``Functor<'U>``,'U>=
38
38
match run x with
39
39
| Pure x -> Pure (f x)
40
40
| Roll (x:^``Functor<Free<'Functor<'T>,'T>>``)-> Roll (Map.Invoke (loop f : Free<'``Functor<'T>``,'T>->_) x:^``Functor<Free<'Functor<'U>,'U>>``)
41
41
loop f x
42
42
43
-
let inlinebind(f:'T ->Free<'``Functor<'U>``,'U>)(x:Free<'``Functor<'T>``,'T>):Free<'``Functor<'U>``,'U>=
43
+
let inlinebind([<InlineIfLambda>]f:'T ->Free<'``Functor<'U>``,'U>)(x:Free<'``Functor<'T>``,'T>):Free<'``Functor<'U>``,'U>=
44
44
let recloop f (x:Free<_,_>)=
45
45
match run x with
46
46
| Pure r -> f r
@@ -54,30 +54,30 @@ module Free =
54
54
| Roll (f:^``Functor<Free<'Functor<'T->'U>,'T->'U>>``)-> Roll (Map.Invoke (loop x: Free<'``Functor<'T->'U>``,'T->'U>->_) f: '``Functor<Free<'Functor<'U>,'U>>``)
55
55
loop x f
56
56
57
-
let inlinemap2(f:'T->'U->'V)(x:Free<'``Functor<'T>``,'T>)(y:Free<'``Functor<'U>``,'U>):Free<'``Functor<'V>``,'V>=
57
+
let inlinemap2([<InlineIfLambda>]f:'T->'U->'V)(x:Free<'``Functor<'T>``,'T>)(y:Free<'``Functor<'U>``,'U>):Free<'``Functor<'V>``,'V>=
58
58
let recloop(y:Free<_,_>)(x:Free<_,_>)=
59
59
match run x with
60
60
| Pure x -> map<'U,'V,'``Functor<'U>``,'``Functor<Free<'Functor<'U>,'U>>``,'``Functor<Free<'Functor<'V>,'V>>``,'``Functor<'V>``>(f x) y : Free<'``Functor<'V>``,'V>
61
61
| Roll (x:^``Functor<Free<'Functor<'T>,'T>>``)-> Roll (Map.Invoke (loop y: Free<'``Functor<'T>``,'T>->_) x: '``Functor<Free<'Functor<'V>,'V>>``)
62
62
loop y x
63
63
64
-
let inlinemap3(f:'T->'U->'V->'W)(x:Free<'``Functor<'T>``,'T>)(y:Free<'``Functor<'U>``,'U>)(z:Free<'``Functor<'V>``,'V>):Free<'``Functor<'W>``,'W>=
64
+
let inlinemap3([<InlineIfLambda>]f:'T->'U->'V->'W)(x:Free<'``Functor<'T>``,'T>)(y:Free<'``Functor<'U>``,'U>)(z:Free<'``Functor<'V>``,'V>):Free<'``Functor<'W>``,'W>=
65
65
let recloop(y:Free<_,_>)(z:Free<_,_>)(x:Free<_,_>)=
66
66
match run x with
67
67
| Pure x -> map2<'U,'V,'W,'``Functor<'U>``,'``Functor<Free<'Functor<'U>,'U>>``,'``Functor<Free<'Functor<'W>,'W>>``,'``Functor<Free<'Functor<'V>,'V>>``,'``Functor<'V>``,'``Functor<'W>``>(f x) y z : Free<'``Functor<'W>``,'W>
68
68
| Roll (x:^``Functor<Free<'Functor<'T>,'T>>``)-> Roll (Map.Invoke (loop y z: Free<'``Functor<'T>``,'T>->_) x: '``Functor<Free<'Functor<'W>,'W>>``)
69
69
loop y z x
70
70
71
71
/// Folds the Free structure into a Monad
72
-
let inlinefold(f:'``Functor<'T>`` ->'``Monad<'T>``)(x:Free<'``Functor<'U>``,'U>):'``Monad<'U>`` =
72
+
let inlinefold([<InlineIfLambda>]f:'``Functor<'T>`` ->'``Monad<'T>``)(x:Free<'``Functor<'U>``,'U>):'``Monad<'U>`` =
73
73
let recloop f x =
74
74
match run x with
75
75
| Pure a -> Return.Invoke a
76
76
| Roll x -> f x >>= loop f
77
77
loop f x
78
78
79
79
/// Tear down a Free monad using iteration.
80
-
let inlineiterM(f:'``Functor<'Monad<'T>>`` ->'``Monad<'T>``)(x:Free<'``Functor<'T>``,'T>):'``Monad<'T>`` =
80
+
let inlineiterM([<InlineIfLambda>]f:'``Functor<'Monad<'T>>`` ->'``Monad<'T>``)(x:Free<'``Functor<'T>``,'T>):'``Monad<'T>`` =
81
81
let recloop f x =
82
82
match run x with
83
83
| Pure x -> Return.Invoke x
@@ -88,7 +88,7 @@ module Free =
88
88
let inlineliftF(x:'``Functor<'T>``):Free<'``Functor<'T>``,'T>= Roll (Map.Invoke (Pure: 'T -> Free<'``Functor<'T>``,'T>) x : '``Functor<Free<'Functor<'T>,'T>>``)
89
89
90
90
/// Lift a natural transformation from functor F to functor G into a natural transformation from Free of F to Free of G.
91
-
let inlinehoist(f:^``F<Free<'F<'T>,'T>>`` ->^``G<Free<'F<'T>,'T>>``)(x:Free<'``F<'T>``,'T>):Free<'``G<'T>``,'T>=
91
+
let inlinehoist([<InlineIfLambda>]f:^``F<Free<'F<'T>,'T>>`` ->^``G<Free<'F<'T>,'T>>``)(x:Free<'``F<'T>``,'T>):Free<'``G<'T>``,'T>=
0 commit comments