Skip to content

Commit d4be677

Browse files
committed
Minor cleanups
1 parent 58e491b commit d4be677

File tree

18 files changed

+67
-68
lines changed

18 files changed

+67
-68
lines changed

equinox-patterns/Domain/Types.fs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
namespace Patterns.Domain
22

33
open FSharp.UMX
4-
open System
54

65
/// Identifies a single period within a temporally linked chain of periods
76
/// Each Period commences with a Balance `BroughtForward` based on what the predecessor Period
@@ -44,6 +43,8 @@ module ListSeriesId =
4443
let wellKnownId: ListSeriesId = UMX.tag "0"
4544
let toString: ListSeriesId -> string = UMX.untag
4645

46+
namespace global
47+
4748
module Guid =
4849

49-
let toStringN (g: Guid) = g.ToString "N"
50+
let toStringN (g: System.Guid) = g.ToString "N"

equinox-shipping/Domain/Types.fs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,16 @@ module TransactionId =
1919
let parse (x: string): TransactionId = %x
2020
let (|Parse|) = parse
2121

22+
namespace global
23+
2224
module Seq =
2325

2426
let inline chooseV f xs = seq { for x in xs do match f x with ValueSome v -> yield v | ValueNone -> () }
2527

2628
module Guid =
2729

30+
let inline gen () = System.Guid.NewGuid()
2831
let inline toStringN (x: System.Guid) = x.ToString "N"
29-
let generateStringN () = let g = System.Guid.NewGuid() in toStringN g
3032

3133
/// Handles symmetric generation and decoding of StreamNames composed of a series of elements via the FsCodec.StreamId helpers
3234
type internal CategoryId<'elements>(name, gen: 'elements -> FsCodec.StreamId, dec: FsCodec.StreamId -> 'elements) =

equinox-shipping/Watchdog.Integration/Generators.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ let genDefault<'t> = ArbMap.defaults |> ArbMap.generate<'t>
1212

1313
type Custom =
1414

15-
static member GuidStringN() = genDefault |> Gen.map (Shipping.Domain.Guid.toStringN >> GuidStringN) |> Arb.fromGen
15+
static member GuidStringN() = genDefault |> Gen.map (Guid.toStringN >> GuidStringN) |> Arb.fromGen
1616

1717
[<assembly: Properties( Arbitrary = [| typeof<Custom> |] )>] do()

equinox-shipping/Watchdog.Integration/ReactorFixture.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ open System
99
/// See SerilogLogFixture for details of how to expose complete diagnostic messages
1010
type FixtureBase(messageSink, store, dumpStats, createSourceConfig) =
1111
let serilogLog = new SerilogLogFixture(messageSink) // create directly to ensure correct sequencing and no loss of messages
12-
let contextId = Shipping.Domain.Guid.generateStringN ()
12+
let contextId = Guid.gen () |> Guid.toStringN
1313
let manager =
1414
let maxDop = 4
1515
Shipping.Domain.FinalizationProcess.Factory.create maxDop store

equinox-web/Domain/Todo.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module Fold =
3434
let initial = { items = []; nextId = 0 }
3535
/// Compute State change implied by a given Event
3636
let evolve state = function
37-
| Events.Added item -> { state with items = item :: state.items; nextId = state.nextId + 1 }
37+
| Events.Added item -> { items = item :: state.items; nextId = state.nextId + 1 }
3838
| Events.Updated value -> { state with items = state.items |> List.map (function { id = id } when id = value.id -> value | item -> item) }
3939
| Events.Deleted e -> { state with items = state.items |> List.filter (fun x -> x.id <> e.id) }
4040
| Events.Cleared e -> { nextId = e.nextId; items = [] }

equinox-web/Web/Startup.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ type Startup() =
190190
.UseSerilogRequestLogging() // see https://nblumhardt.com/2019/10/serilog-in-aspnetcore-3/
191191
#if todos
192192
// NB Jet does now own, control or audit https://todobackend.com; it is a third party site; please satisfy yourself that this is a safe thing use in your environment before using it._
193-
.UseCors(fun x -> x.WithOrigins([|"https://www.todobackend.com"|]).AllowAnyHeader().AllowAnyMethod() |> ignore)
193+
.UseCors(x -> x.WithOrigins([|"https://www.todobackend.com"|]).AllowAnyHeader().AllowAnyMethod() |> ignore)
194194
#endif
195195
.UseEndpoints(fun endpoints ->
196196
endpoints.MapMetrics() |> ignore // Host /metrics for Prometheus

feed-source/FeedApi/Program.fs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ module Args =
1919
| [<AltCommandLine "-V"; Unique>] Verbose
2020
| [<CliPrefix(CliPrefix.None)>] Cosmos of ParseResults<CosmosParameters>
2121
interface IArgParserTemplate with
22-
member a.Usage =
23-
match a with
22+
member a.Usage = a |> function
2423
| Verbose -> "request Verbose Logging. Default: off."
2524
| Cosmos _ -> "specify CosmosDB input parameters."
2625
and Arguments(config: Configuration, p: ParseResults<Parameters>) =

propulsion-consumer/Examples.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ module MultiStreams =
118118

119119
// Dump stats relating to how much information is being held - note it's likely for requests to be in flighht during the call
120120
member _.DumpState(log: ILogger) =
121-
log.Information(" Favorited {total}/{users}", faves.Values |> Seq.sumBy (fun x -> x.Count), faves.Count)
122-
log.Information(" SavedForLater {total}/{users}", saves.Values |> Seq.sumBy (fun x -> x.Length), saves.Count)
121+
log.Information(" Favorited {total}/{users}", faves.Values |> Seq.sumBy _.Count, faves.Count)
122+
log.Information(" SavedForLater {total}/{users}", saves.Values |> Seq.sumBy _.Length, saves.Count)
123123

124124
type Stats(log, statsInterval, stateInterval) =
125125
inherit Propulsion.Streams.Stats<Stat>(log, statsInterval, stateInterval)

propulsion-hotel/Domain/Domain.fsproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
</ItemGroup>
1717

1818
<ItemGroup>
19+
<Compile Include="Infrastructure.fs" />
1920
<Compile Include="Store.fs" />
2021
<Compile Include="Types.fs" />
2122
<Compile Include="GuestStay.fs" />

propulsion-hotel/Domain/GroupCheckout.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ module Fold =
4444
| StaysMerged e ->
4545
{ removePending (seq { for s in e.residuals -> s.stay }) state with
4646
checkedOut = Array.append state.checkedOut e.residuals
47-
balance = state.balance + (e.residuals |> Seq.sumBy (fun x -> x.residual)) }
47+
balance = state.balance + (e.residuals |> Seq.sumBy _.residual) }
4848
| MergesFailed e ->
4949
{ removePending e.stays state with
5050
failed = Array.append state.failed e.stays }

0 commit comments

Comments
 (0)