Skip to content

Commit b18fe25

Browse files
committed
Format
1 parent e1d6a70 commit b18fe25

1 file changed

Lines changed: 41 additions & 44 deletions

File tree

src/Fabulous/Cmd.fs

Lines changed: 41 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -172,60 +172,57 @@ module Cmd =
172172

173173
module OfTask =
174174
/// Command to call a task and map the results
175-
let inline either ([<InlineIfLambda>] task: 'a -> Task<_>) (arg: 'a) ([<InlineIfLambda>] ofSuccess: _ -> 'msg) ([<InlineIfLambda>] ofError: _ -> 'msg) : Cmd<'msg> =
176-
[
177-
fun dispatch ->
178-
backgroundTask {
179-
try
180-
let! r = task arg
181-
ofSuccess r |> dispatch
182-
with e ->
183-
ofError e |> dispatch
184-
}
185-
|> ignore<Task<_>>
186-
]
175+
let inline either
176+
([<InlineIfLambda>] task: 'a -> Task<_>)
177+
(arg: 'a)
178+
([<InlineIfLambda>] ofSuccess: _ -> 'msg)
179+
([<InlineIfLambda>] ofError: _ -> 'msg)
180+
: Cmd<'msg> =
181+
[ fun dispatch ->
182+
backgroundTask {
183+
try
184+
let! r = task arg
185+
ofSuccess r |> dispatch
186+
with e ->
187+
ofError e |> dispatch
188+
}
189+
|> ignore<Task<_>> ]
187190

188191
/// Command to call a task and map the success
189192
let inline perform ([<InlineIfLambda>] task: 'a -> Task<_>) (arg: 'a) ([<InlineIfLambda>] ofSuccess: _ -> 'msg) : Cmd<'msg> =
190-
[
191-
fun dispatch ->
192-
backgroundTask {
193-
try
194-
let! r = task arg
195-
ofSuccess r |> dispatch
196-
with _ ->
197-
()
198-
}
199-
|> ignore<Task<_>>
200-
]
193+
[ fun dispatch ->
194+
backgroundTask {
195+
try
196+
let! r = task arg
197+
ofSuccess r |> dispatch
198+
with _ ->
199+
()
200+
}
201+
|> ignore<Task<_>> ]
201202

202203
/// Command to call a task and map the error
203204
let inline attempt ([<InlineIfLambda>] task: 'a -> #Task) (arg: 'a) ([<InlineIfLambda>] ofError: _ -> 'msg) : Cmd<'msg> =
204-
[
205-
fun dispatch ->
206-
backgroundTask {
207-
try
208-
do! task arg
209-
with e ->
210-
ofError e |> dispatch
211-
}
212-
|> ignore<Task<_>>
213-
]
205+
[ fun dispatch ->
206+
backgroundTask {
207+
try
208+
do! task arg
209+
with e ->
210+
ofError e |> dispatch
211+
}
212+
|> ignore<Task<_>> ]
214213

215214
let inline msg (task: Task<'msg>) = perform (fun () -> task) () id
216215

217216
let inline msgOption (task: Task<'msg option>) =
218-
[
219-
fun dispatch ->
220-
backgroundTask {
221-
let! r = task
222-
223-
match r with
224-
| Some x -> dispatch x
225-
| None -> ()
226-
}
227-
|> ignore<Task<_>>
228-
]
217+
[ fun dispatch ->
218+
backgroundTask {
219+
let! r = task
220+
221+
match r with
222+
| Some x -> dispatch x
223+
| None -> ()
224+
}
225+
|> ignore<Task<_>> ]
229226

230227
/// Command to issue a message if no other message has been issued within the specified timeout
231228
let debounce (timeout: int) (fn: 'value -> 'msg) : 'value -> Cmd<'msg> =

0 commit comments

Comments
 (0)