From 84ac6814208adf76ddb3a494009ac8aadd3ab830 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Thu, 2 Jun 2022 19:58:35 +0100 Subject: [PATCH] wider lists --- .editorconfig | 1 + README.md | 5 +++++ src/CommonRuntime/StructuralInference.fs | 23 ++++------------------- src/CommonRuntime/TextConversions.fs | 10 +--------- src/Html/HtmlRuntime.fs | 18 ++---------------- src/Json/JsonGenerator.fs | 7 ++----- src/WorldBank/WorldBankProvider.fs | 3 +-- src/WorldBank/WorldBankRuntime.fs | 8 +------- src/Xml/XmlGenerator.fs | 12 +++--------- 9 files changed, 20 insertions(+), 67 deletions(-) diff --git a/.editorconfig b/.editorconfig index f21606656..06e694cd9 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,6 +13,7 @@ insert_final_newline = true trim_trailing_whitespace = false [*.fs] +fsharp_max_array_or_list_width=80 fsharp_max_array_or_list_number_of_items=5 fsharp_max_if_then_else_short_width=60 fsharp_max_dot_get_expression_width=80 diff --git a/README.md b/README.md index 89b7a21d0..f70633a1c 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,11 @@ You can see the version history [here](RELEASE_NOTES.md). - Install the .NET SDK specified in the `global.json` file - `build.sh -t Build` or `build.cmd -t Build` +## Formatting + + dotnet fake build -t Format + dotnet fake build -t CheckFormat + ## Documentation This library comes with comprehensive documentation. The documentation is diff --git a/src/CommonRuntime/StructuralInference.fs b/src/CommonRuntime/StructuralInference.fs index 65cb33fe0..0891afe89 100644 --- a/src/CommonRuntime/StructuralInference.fs +++ b/src/CommonRuntime/StructuralInference.fs @@ -95,25 +95,10 @@ let typeTag = let private conversionTable = [ typeof, [ typeof; typeof ] - typeof, - [ typeof - typeof - typeof ] - typeof, - [ typeof - typeof - typeof ] - typeof, - [ typeof - typeof - typeof - typeof ] - typeof, - [ typeof - typeof - typeof - typeof - typeof ] + typeof, [ typeof; typeof; typeof ] + typeof, [ typeof; typeof; typeof ] + typeof, [ typeof; typeof; typeof; typeof ] + typeof, [ typeof; typeof; typeof; typeof; typeof ] typeof, [ typeof typeof diff --git a/src/CommonRuntime/TextConversions.fs b/src/CommonRuntime/TextConversions.fs index c4c68dde3..f6dede45c 100644 --- a/src/CommonRuntime/TextConversions.fs +++ b/src/CommonRuntime/TextConversions.fs @@ -51,15 +51,7 @@ module private Helpers = type TextConversions private () = /// `NaN` `NA` `N/A` `#N/A` `:` `-` `TBA` `TBD` - static member val DefaultMissingValues = - [| "NaN" - "NA" - "N/A" - "#N/A" - ":" - "-" - "TBA" - "TBD" |] + static member val DefaultMissingValues = [| "NaN"; "NA"; "N/A"; "#N/A"; ":"; "-"; "TBA"; "TBD" |] /// `%` `‰` `‱` static member val DefaultNonCurrencyAdorners = [| '%'; '‰'; '‱' |] |> Set.ofArray diff --git a/src/Html/HtmlRuntime.fs b/src/Html/HtmlRuntime.fs index b065729c4..8ddaa8290 100644 --- a/src/Html/HtmlRuntime.fs +++ b/src/Html/HtmlRuntime.fs @@ -272,15 +272,7 @@ module HtmlRuntime = let data = let getContents contents = contents - |> List.map ( - innerTextExcluding - [ "table" - "ul" - "ol" - "dl" - "sup" - "sub" ] - ) + |> List.map (innerTextExcluding [ "table"; "ul"; "ol"; "dl"; "sup"; "sub" ]) |> String.Concat |> normalizeWs @@ -362,13 +354,7 @@ module HtmlRuntime = let rows = list.Descendants("li", true) |> Seq.map ( - innerTextExcluding - [ "table" - "ul" - "ol" - "dl" - "sup" - "sub" ] + innerTextExcluding [ "table"; "ul"; "ol"; "dl"; "sup"; "sub" ] >> normalizeWs ) |> Seq.toArray diff --git a/src/Json/JsonGenerator.fs b/src/Json/JsonGenerator.fs index 481e3fe75..b85c767ee 100644 --- a/src/Json/JsonGenerator.fs +++ b/src/Json/JsonGenerator.fs @@ -400,8 +400,7 @@ module JsonTypeBuilder = let tupleType = Microsoft.FSharp.Reflection.FSharpType.MakeTupleType( - [| keyResult.ConvertedType - valueResult.ConvertedType |] + [| keyResult.ConvertedType; valueResult.ConvertedType |] ) let itemsSeqType = typedefof<_ seq>.MakeGenericType ([| tupleType |]) @@ -566,9 +565,7 @@ module JsonTypeBuilder = typeof, args |> List.mapi (fun i a -> - Expr.NewTuple - [ Expr.Value names.[i] - Expr.Coerce(a, typeof) ]) + Expr.NewTuple [ Expr.Value names.[i]; Expr.Coerce(a, typeof) ]) ) let cultureStr = ctx.CultureStr diff --git a/src/WorldBank/WorldBankProvider.fs b/src/WorldBank/WorldBankProvider.fs index 7e38500f6..cf1813e43 100644 --- a/src/WorldBank/WorldBankProvider.fs +++ b/src/WorldBank/WorldBankProvider.fs @@ -340,8 +340,7 @@ type public WorldBankProvider(cfg: TypeProviderConfig) as this = // ASSUMPTION: Follow www.worldbank.org and only show these sources by default. The others are very sparsely populated. let defaultSources = - [ "World Development Indicators" - "Global Financial Development" ] + [ "World Development Indicators"; "Global Financial Development" ] let worldBankType = createTypesForSources (defaultSources, "WorldBankData", false, false) diff --git a/src/WorldBank/WorldBankRuntime.fs b/src/WorldBank/WorldBankRuntime.fs index f850a00c8..91e7b5379 100644 --- a/src/WorldBank/WorldBankRuntime.fs +++ b/src/WorldBank/WorldBankRuntime.fs @@ -259,13 +259,7 @@ module Implementation = member internal __.GetDataAsync(countryOrRegionCode, indicatorCode) = async { let! data = - getData - [ "countries" - countryOrRegionCode - "indicators" - indicatorCode ] - [ "date", "" ] - "date" + getData [ "countries"; countryOrRegionCode; "indicators"; indicatorCode ] [ "date", "" ] "date" return seq { diff --git a/src/Xml/XmlGenerator.fs b/src/Xml/XmlGenerator.fs index bcfdb67f6..78155cd54 100644 --- a/src/Xml/XmlGenerator.fs +++ b/src/Xml/XmlGenerator.fs @@ -572,9 +572,7 @@ module internal XmlTypeBuilder = |> Seq.take attrParameters.Length |> Seq.toList |> List.mapi (fun i a -> - Expr.NewTuple - [ Expr.Value attrNames.[i] - Expr.Coerce(a, typeof) ]) + Expr.NewTuple [ Expr.Value attrNames.[i]; Expr.Coerce(a, typeof) ]) ) let elements = @@ -587,16 +585,12 @@ module internal XmlTypeBuilder = ) |> Seq.toList |> List.mapi (fun i a -> - Expr.NewTuple - [ Expr.Value childElemNames.[i] - Expr.Coerce(a, typeof) ]) + Expr.NewTuple [ Expr.Value childElemNames.[i]; Expr.Coerce(a, typeof) ]) let elements = match primitiveParam with | Some _ -> - Expr.NewTuple - [ Expr.Value "" - Expr.Coerce(args.[attrParameters.Length], typeof) ] + Expr.NewTuple [ Expr.Value ""; Expr.Coerce(args.[attrParameters.Length], typeof) ] :: elements | None -> elements