Rather dubious struct-based stuff all plumbed through
This commit is contained in:
@@ -64,7 +64,8 @@ module App =
|
||||
| RegisterClientResponse.Success client ->
|
||||
try
|
||||
clients.Add (client, HashSet ())
|
||||
with :? ArgumentException ->
|
||||
with _ ->
|
||||
// This is ArgumentException, but Fable can't type-test that
|
||||
failwith "TODO: got a response a second time - need to handle this in the UI"
|
||||
| RegisterClientResponse.NotLeader hint -> failwith "TODO: asked a non-leader, have to handle it"
|
||||
)
|
||||
@@ -157,7 +158,7 @@ module App =
|
||||
ActionHistory = []
|
||||
}
|
||||
|
||||
(promise { return () }, userPrefs.Value.ActionHistory)
|
||||
(promise { return () }, newPrefs.ActionHistory)
|
||||
||> List.fold (fun (inPromise : Promise<unit>) action ->
|
||||
promise {
|
||||
let! _ = inPromise
|
||||
|
@@ -402,13 +402,20 @@ module Ui =
|
||||
: Result<UserPreferences<'a>, string>
|
||||
=
|
||||
let actionHistory =
|
||||
ui.ActionHistoryList.value.Split "\n"
|
||||
|> Seq.filter (not << System.String.IsNullOrEmpty)
|
||||
|> Seq.map (
|
||||
NetworkAction.tryParse<'a> parse None handleRegisterClientResponse handleClientDataResponse clusterSize
|
||||
)
|
||||
|> Result.allOkOrError
|
||||
|> Result.map List.ofSeq
|
||||
let arr = ResizeArray ()
|
||||
|
||||
for i in StringSplitEnumerator.make '\n' ui.ActionHistoryList.value do
|
||||
if not (EfficientString.isEmpty i) then
|
||||
NetworkAction.tryParse<'a>
|
||||
parse
|
||||
None
|
||||
handleRegisterClientResponse
|
||||
handleClientDataResponse
|
||||
clusterSize
|
||||
i
|
||||
|> arr.Add
|
||||
|
||||
Result.allOkOrError arr |> Result.map List.ofSeq
|
||||
|
||||
match actionHistory with
|
||||
| Result.Ok actionHistory ->
|
||||
|
Reference in New Issue
Block a user