From 838ce5e34073cf92f65e2b484ad90ca657f3b87c Mon Sep 17 00:00:00 2001 From: Daniel Slapman Date: Sat, 18 Nov 2023 18:52:17 +0100 Subject: [PATCH 1/3] Drop F# project --- readme.md | 4 - src/Tinkoff.Visor.Gen.FSharp/Gen.fs | 17 ---- src/Tinkoff.Visor.Gen.FSharp/Impl.fs | 94 ------------------- .../Tinkoff.Visor.Gen.FSharp.fsproj | 26 ----- src/Visor.sln | 6 -- 5 files changed, 147 deletions(-) delete mode 100644 src/Tinkoff.Visor.Gen.FSharp/Gen.fs delete mode 100644 src/Tinkoff.Visor.Gen.FSharp/Impl.fs delete mode 100644 src/Tinkoff.Visor.Gen.FSharp/Tinkoff.Visor.Gen.FSharp.fsproj diff --git a/readme.md b/readme.md index dd1cb8f..cbcf63e 100644 --- a/readme.md +++ b/readme.md @@ -2,10 +2,6 @@ Tinkoff.Visor is a optics library for .NET -Tinkoff.Visor includes the following features: -- C# & F# support -- incremental lens code generator - ## Rationale C# introduced record types, which are a first-class implementation of immutable data types. diff --git a/src/Tinkoff.Visor.Gen.FSharp/Gen.fs b/src/Tinkoff.Visor.Gen.FSharp/Gen.fs deleted file mode 100644 index e47a0a8..0000000 --- a/src/Tinkoff.Visor.Gen.FSharp/Gen.fs +++ /dev/null @@ -1,17 +0,0 @@ -namespace Tinkoff.Visor.Gen.FSharp - -open FSharp.Quotations -open Tinkoff.Visor -open System -open TypeShape.Clone - -module Gen = - let mkLens<'T, 'F> (expr : Expr<'T -> 'F>) : ILens<'T, 'F> = - let path = Impl.extractPath expr - let lens = Impl.mkLensAux<'T, 'F> path - - Lens.New( - lens.get, - // TypeShape native lenses rely on mutation, so we clone to hide this fact - fun (f: Func<'F, 'F>) -> Func<'T, 'T>(fun t -> lens.set (clone t) (f.Invoke(lens.get t))) - ) \ No newline at end of file diff --git a/src/Tinkoff.Visor.Gen.FSharp/Impl.fs b/src/Tinkoff.Visor.Gen.FSharp/Impl.fs deleted file mode 100644 index 56686d2..0000000 --- a/src/Tinkoff.Visor.Gen.FSharp/Impl.fs +++ /dev/null @@ -1,94 +0,0 @@ -namespace Tinkoff.Visor.Gen.FSharp - -open FSharp.Quotations -open FSharp.Quotations.Patterns -open TypeShape.Core - -(* - Initially based on http://www.fssnip.net/7VY/title/Lens-Generation-using-TypeShape -*) - -type private Lens<'T, 'F> = - { - get : 'T -> 'F - set : 'T -> 'F -> 'T - } - -module private Impl = - type Path = Node list - and Node = - | Property of string - | Item of int - - // converts a quotation of the form <@ fun x -> x.Foo.Bar.[0].Baz @> into a path - let extractPath (e : Expr<'T -> 'F>) : Path = - let rec aux v acc e = - match e with - | Var v' when v = v' -> acc - | PropertyGet(Some o, p, [Value((:? int as i), _)]) when p.Name = "Item" -> aux v (Item i :: acc) o - | PropertyGet(Some o, p, []) -> aux v (Property p.Name :: acc) o - | Call(None, m, [o ; Value(:? int as i, _)]) when m.Name = "GetArray" && o.Type.IsArray && e.Type = o.Type.GetElementType() -> aux v (Item i :: acc) o - // we support tuples, as they are often used to encode fields in erased type providers - | TupleGet(x, i) -> aux v (Item i :: acc) x - | _ -> invalidArg "expr" "invalid lens expression" - - match e with - | Lambda(v, body) -> aux v [] body - | _ -> invalidArg "expr" "lens expressions must be lambda literals" - - let rec mkLensAux<'T, 'F> (path : Path) : Lens<'T, 'F> = - let wrap (l : Lens<'a,'b>) : Lens<'T, 'F> = unbox l - - let nest chain (m : IShapeMember<'T>) = - m.Accept { new IMemberVisitor<'T, Lens<'T, 'F>> with - member _.Visit<'F0> (m : ShapeMember<'T, 'F0>) = - let inner = mkLensAux<'F0, 'F> chain - { - get = fun (t:'T) -> inner.get (m.Get t) - set = fun (t:'T) (f:'F) -> m.Set t (inner.set (m.Get t) f) - } - - } - - match shapeof<'T>, path with - | _, [] -> wrap { get = id<'F> ; set = fun (_:'F) (y:'F) -> y } - | Shape.FSharpList s, Item i :: rest -> - s.Element.Accept { new ITypeVisitor> with - member _.Visit<'t> () = - let inner = mkLensAux<'t, 'F> rest - wrap { - get = fun (ts : 't list) -> inner.get ts.[i] - set = fun (ts : 't list) (f : 'F) -> ts |> List.mapi (fun j t -> if j = i then inner.set t f else t) - } - } - - | Shape.FSharpOption s, Property "Value" :: rest -> - s.Element.Accept { new ITypeVisitor> with - member _.Visit<'t> () = - let inner = mkLensAux<'t, 'F> rest - wrap { - get = fun (ts : 't option) -> inner.get (Option.get ts) - set = fun (ts : 't option) (f : 'F) -> inner.set (Option.get ts) f |> Some - } - } - - | Shape.Tuple (:? ShapeTuple<'T> as s), Item i :: rest -> - s.Elements.[i] |> nest rest - - | Shape.Array s, Item i :: rest when s.Rank = 1 -> - s.Element.Accept { new ITypeVisitor> with - member _.Visit<'t> () = - let inner = mkLensAux<'t, 'F> rest - wrap { - get = fun (ts : 't[]) -> inner.get ts.[i] - set = fun (ts : 't[]) (f : 'F) -> ts.[i] <- inner.set ts.[i] f ; ts - } - } - - | Shape.FSharpRecord (:? ShapeFSharpRecord<'T> as s) & Shape.FSharpRef _, Property "Value" :: rest -> - s.Fields |> Array.find (fun p -> p.Label = "contents") |> nest rest - - | Shape.FSharpRecord (:? ShapeFSharpRecord<'T> as s), Property id :: rest -> - s.Fields |> Array.find (fun p -> p.Label = id) |> nest rest - - | _ -> failwithf "unsupported lens type %O" typeof<'T> \ No newline at end of file diff --git a/src/Tinkoff.Visor.Gen.FSharp/Tinkoff.Visor.Gen.FSharp.fsproj b/src/Tinkoff.Visor.Gen.FSharp/Tinkoff.Visor.Gen.FSharp.fsproj deleted file mode 100644 index 43252f5..0000000 --- a/src/Tinkoff.Visor.Gen.FSharp/Tinkoff.Visor.Gen.FSharp.fsproj +++ /dev/null @@ -1,26 +0,0 @@ - - - - true - danslapman - Visor is an optics library for .NET - https://github.com/Tinkoff/Visor - https://github.com/Tinkoff/Visor - Apache-2.0 - - - - - - - - - - - - - - - - - diff --git a/src/Visor.sln b/src/Visor.sln index e78e760..ccda949 100644 --- a/src/Visor.sln +++ b/src/Visor.sln @@ -9,8 +9,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tinkoff.Visor", "Tinkoff.Vi EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tinkoff.Visor.Tests", "Tinkoff.Visor.Tests\Tinkoff.Visor.Tests.csproj", "{55D94966-7858-44C6-97A6-2CC0B3D22FDB}" EndProject -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Tinkoff.Visor.Gen.FSharp", "Tinkoff.Visor.Gen.FSharp\Tinkoff.Visor.Gen.FSharp.fsproj", "{77D2D99A-6BDF-4C76-8D4D-F0BF67A5EFE1}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tinkoff.Visor.LanguageExt", "Tinkoff.Visor.LanguageExt\Tinkoff.Visor.LanguageExt.csproj", "{F9037238-BB0D-456C-A3AA-FED9CC7B7B05}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tinkoff.Visor.LanguageExt.Tests", "Tinkoff.Visor.LanguageExt.Tests\Tinkoff.Visor.LanguageExt.Tests.csproj", "{0AE99366-1370-4DD4-A1AA-46B969FC9DA0}" @@ -37,10 +35,6 @@ Global {55D94966-7858-44C6-97A6-2CC0B3D22FDB}.Debug|Any CPU.Build.0 = Debug|Any CPU {55D94966-7858-44C6-97A6-2CC0B3D22FDB}.Release|Any CPU.ActiveCfg = Release|Any CPU {55D94966-7858-44C6-97A6-2CC0B3D22FDB}.Release|Any CPU.Build.0 = Release|Any CPU - {77D2D99A-6BDF-4C76-8D4D-F0BF67A5EFE1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {77D2D99A-6BDF-4C76-8D4D-F0BF67A5EFE1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {77D2D99A-6BDF-4C76-8D4D-F0BF67A5EFE1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {77D2D99A-6BDF-4C76-8D4D-F0BF67A5EFE1}.Release|Any CPU.Build.0 = Release|Any CPU {F9037238-BB0D-456C-A3AA-FED9CC7B7B05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F9037238-BB0D-456C-A3AA-FED9CC7B7B05}.Debug|Any CPU.Build.0 = Debug|Any CPU {F9037238-BB0D-456C-A3AA-FED9CC7B7B05}.Release|Any CPU.ActiveCfg = Release|Any CPU From 294a525fdbeb16ba8f9c26930cd31f680bc20567 Mon Sep 17 00:00:00 2001 From: Daniel Slapman Date: Sat, 18 Nov 2023 19:05:58 +0100 Subject: [PATCH 2/3] Rename projects & namespaces --- .github/workflows/publish.yml | 18 +++++++++--------- readme.md | 4 ++-- src/Directory.Build.props | 2 +- .../ChainedOpticTests.cs | 2 +- .../LeviySoft.Visor.Gen.Tests.csproj} | 4 ++-- .../OpticTests.cs | 2 +- .../Sample.cs | 2 +- .../ContainingTypesBuilder.cs | 8 ++++---- .../LensGenerator.cs | 6 +++--- .../LeviySoft.Visor.Gen.csproj} | 0 .../SymbolHelpers.cs | 2 +- .../LeviySoft.Visor.LanguageExt.Tests.csproj} | 2 +- .../PropertyTests.cs | 2 +- .../LeviySoft.Visor.LanguageExt.csproj} | 2 +- .../Property.cs | 2 +- .../LeviySoft.Visor.Tests.csproj} | 2 +- .../IGetter.cs | 2 +- .../ILens.cs | 2 +- .../IProperty.cs | 2 +- .../ISetter.cs | 2 +- .../LeviySoft.Visor.csproj} | 0 .../OpticsAttribute.cs | 2 +- src/Visor.sln | 12 ++++++------ 23 files changed, 41 insertions(+), 41 deletions(-) rename src/{Tinkoff.Visor.Gen.Tests => LeviySoft.Visor.Gen.Tests}/ChainedOpticTests.cs (90%) rename src/{Tinkoff.Visor.Gen.Tests/Tinkoff.Visor.Gen.Tests.csproj => LeviySoft.Visor.Gen.Tests/LeviySoft.Visor.Gen.Tests.csproj} (84%) rename src/{Tinkoff.Visor.Gen.Tests => LeviySoft.Visor.Gen.Tests}/OpticTests.cs (96%) rename src/{Tinkoff.Visor.Gen.Tests => LeviySoft.Visor.Gen.Tests}/Sample.cs (92%) rename src/{Tinkoff.Visor.Gen => LeviySoft.Visor.Gen}/ContainingTypesBuilder.cs (94%) rename src/{Tinkoff.Visor.Gen => LeviySoft.Visor.Gen}/LensGenerator.cs (95%) rename src/{Tinkoff.Visor.Gen/Tinkoff.Visor.Gen.csproj => LeviySoft.Visor.Gen/LeviySoft.Visor.Gen.csproj} (100%) rename src/{Tinkoff.Visor.Gen => LeviySoft.Visor.Gen}/SymbolHelpers.cs (97%) rename src/{Tinkoff.Visor.LanguageExt.Tests/Tinkoff.Visor.LanguageExt.Tests.csproj => LeviySoft.Visor.LanguageExt.Tests/LeviySoft.Visor.LanguageExt.Tests.csproj} (87%) rename src/{Tinkoff.Visor.LanguageExt.Tests => LeviySoft.Visor.LanguageExt.Tests}/PropertyTests.cs (91%) rename src/{Tinkoff.Visor.LanguageExt/Tinkoff.Visor.LanguageExt.csproj => LeviySoft.Visor.LanguageExt/LeviySoft.Visor.LanguageExt.csproj} (85%) rename src/{Tinkoff.Visor.LanguageExt => LeviySoft.Visor.LanguageExt}/Property.cs (96%) rename src/{Tinkoff.Visor.Tests/Tinkoff.Visor.Tests.csproj => LeviySoft.Visor.Tests/LeviySoft.Visor.Tests.csproj} (92%) rename src/{Tinkoff.Visor => LeviySoft.Visor}/IGetter.cs (97%) rename src/{Tinkoff.Visor => LeviySoft.Visor}/ILens.cs (98%) rename src/{Tinkoff.Visor => LeviySoft.Visor}/IProperty.cs (98%) rename src/{Tinkoff.Visor => LeviySoft.Visor}/ISetter.cs (97%) rename src/{Tinkoff.Visor/Tinkoff.Visor.csproj => LeviySoft.Visor/LeviySoft.Visor.csproj} (100%) rename src/{Tinkoff.Visor => LeviySoft.Visor}/OpticsAttribute.cs (90%) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 57f8419..32b5b86 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -21,23 +21,23 @@ jobs: - name: prepare version run: | echo "$VERSION" - - name: pack Tinkoff.Visor + - name: pack LeviySoft.Visor run: | cd src - dotnet pack Tinkoff.Visor/Tinkoff.Visor.csproj -c Release /p:Version=${{env.VERSION}} /p:PackageVersion=${{env.VERSION}} - - name: pack Tinkoff.Visor.Gen + dotnet pack LeviySoft.Visor/LeviySoft.Visor.csproj -c Release /p:Version=${{env.VERSION}} /p:PackageVersion=${{env.VERSION}} + - name: pack LeviySoft.Visor.Gen run: | cd src - dotnet pack Tinkoff.Visor.Gen/Tinkoff.Visor.Gen.csproj -c Release /p:Version=${{env.VERSION}} /p:PackageVersion=${{env.VERSION}} - - name: pack Tinkoff.Visor.Gen.FSharp + dotnet pack LeviySoft.Visor.Gen/LeviySoft.Visor.Gen.csproj -c Release /p:Version=${{env.VERSION}} /p:PackageVersion=${{env.VERSION}} + - name: pack LeviySoft.Visor.Gen.FSharp run: | cd src - dotnet pack Tinkoff.Visor.Gen.FSharp/Tinkoff.Visor.Gen.FSharp.fsproj -c Release /p:Version=${{env.VERSION}} /p:PackageVersion=${{env.VERSION}} - - name: pack Tinkoff.Visor.LanguageExt + dotnet pack LeviySoft.Visor.Gen.FSharp/LeviySoft.Visor.Gen.FSharp.fsproj -c Release /p:Version=${{env.VERSION}} /p:PackageVersion=${{env.VERSION}} + - name: pack LeviySoft.Visor.LanguageExt run: | cd src - dotnet pack Tinkoff.Visor.LanguageExt/Tinkoff.Visor.LanguageExt.csproj -c Release /p:Version=${{env.VERSION}} /p:PackageVersion=${{env.VERSION}} + dotnet pack LeviySoft.Visor.LanguageExt/LeviySoft.Visor.LanguageExt.csproj -c Release /p:Version=${{env.VERSION}} /p:PackageVersion=${{env.VERSION}} - name: publish run: | cd src - dotnet nuget push **/Tinkoff.Visor.*.nupkg -k ${{secrets.NUGET_APIKEY}} -s https://www.nuget.org \ No newline at end of file + dotnet nuget push **/LeviySoft.Visor.*.nupkg -k ${{secrets.NUGET_APIKEY}} -s https://www.nuget.org \ No newline at end of file diff --git a/readme.md b/readme.md index cbcf63e..1ee43df 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ # Visor -Tinkoff.Visor is a optics library for .NET +LeviySoft.Visor is a optics library for .NET ## Rationale @@ -46,7 +46,7 @@ abstract over subtyping, with `Traverse` over enumerable structures etc. ## How-to -- install `Tinkoff.Visor` and `Tinkoff.Visor.Gen` +- install `LeviySoft.Visor` and `LeviySoft.Visor.Gen` - add `[Optics]` attribute on your record and make your record partial ```csharp diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 628545a..518b758 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -2,7 +2,7 @@ net6.0 enable - Nullable,FS0025,FS0026 + Nullable diff --git a/src/Tinkoff.Visor.Gen.Tests/ChainedOpticTests.cs b/src/LeviySoft.Visor.Gen.Tests/ChainedOpticTests.cs similarity index 90% rename from src/Tinkoff.Visor.Gen.Tests/ChainedOpticTests.cs rename to src/LeviySoft.Visor.Gen.Tests/ChainedOpticTests.cs index 44229f1..463e88d 100644 --- a/src/Tinkoff.Visor.Gen.Tests/ChainedOpticTests.cs +++ b/src/LeviySoft.Visor.Gen.Tests/ChainedOpticTests.cs @@ -1,7 +1,7 @@ using Shouldly; using Xunit; -namespace Tinkoff.Visor.Gen.Tests; +namespace LeviySoft.Visor.Gen.Tests; public class ChainedOpticTests { diff --git a/src/Tinkoff.Visor.Gen.Tests/Tinkoff.Visor.Gen.Tests.csproj b/src/LeviySoft.Visor.Gen.Tests/LeviySoft.Visor.Gen.Tests.csproj similarity index 84% rename from src/Tinkoff.Visor.Gen.Tests/Tinkoff.Visor.Gen.Tests.csproj rename to src/LeviySoft.Visor.Gen.Tests/LeviySoft.Visor.Gen.Tests.csproj index ebd638b..270a654 100644 --- a/src/Tinkoff.Visor.Gen.Tests/Tinkoff.Visor.Gen.Tests.csproj +++ b/src/LeviySoft.Visor.Gen.Tests/LeviySoft.Visor.Gen.Tests.csproj @@ -20,8 +20,8 @@ - - + + diff --git a/src/Tinkoff.Visor.Gen.Tests/OpticTests.cs b/src/LeviySoft.Visor.Gen.Tests/OpticTests.cs similarity index 96% rename from src/Tinkoff.Visor.Gen.Tests/OpticTests.cs rename to src/LeviySoft.Visor.Gen.Tests/OpticTests.cs index ad4351d..f8c95e0 100644 --- a/src/Tinkoff.Visor.Gen.Tests/OpticTests.cs +++ b/src/LeviySoft.Visor.Gen.Tests/OpticTests.cs @@ -1,7 +1,7 @@ using Shouldly; using Xunit; -namespace Tinkoff.Visor.Gen.Tests; +namespace LeviySoft.Visor.Gen.Tests; public class OpticTests { diff --git a/src/Tinkoff.Visor.Gen.Tests/Sample.cs b/src/LeviySoft.Visor.Gen.Tests/Sample.cs similarity index 92% rename from src/Tinkoff.Visor.Gen.Tests/Sample.cs rename to src/LeviySoft.Visor.Gen.Tests/Sample.cs index 2ef9263..7ab0681 100644 --- a/src/Tinkoff.Visor.Gen.Tests/Sample.cs +++ b/src/LeviySoft.Visor.Gen.Tests/Sample.cs @@ -1,4 +1,4 @@ -namespace Tinkoff.Visor.Gen.Tests; +namespace LeviySoft.Visor.Gen.Tests; [Optics] internal partial record Inner(string Field); diff --git a/src/Tinkoff.Visor.Gen/ContainingTypesBuilder.cs b/src/LeviySoft.Visor.Gen/ContainingTypesBuilder.cs similarity index 94% rename from src/Tinkoff.Visor.Gen/ContainingTypesBuilder.cs rename to src/LeviySoft.Visor.Gen/ContainingTypesBuilder.cs index 489193c..7e22f2a 100644 --- a/src/Tinkoff.Visor.Gen/ContainingTypesBuilder.cs +++ b/src/LeviySoft.Visor.Gen/ContainingTypesBuilder.cs @@ -4,7 +4,7 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; -namespace Tinkoff.Visor.Gen +namespace LeviySoft.Visor.Gen { internal static class ContainingTypesBuilder { @@ -60,8 +60,8 @@ static void BuildType(ITypeSymbol symbol, StringBuilder output, bool buildNested if (propertyType.EndsWith("?")) output.AppendLine("#nullable enable"); - output.AppendLine($"{Indent(initialIndent + 2)}public static global::Tinkoff.Visor.ILens<{symbol.ToFQF()}, {propertyType}> {propertyName}Lens =>"); - output.AppendLine($"{Indent(initialIndent + 3)}global::Tinkoff.Visor.Lens<{symbol.ToFQF()}, {propertyType}>.New("); + output.AppendLine($"{Indent(initialIndent + 2)}public static global::LeviySoft.Visor.ILens<{symbol.ToFQF()}, {propertyType}> {propertyName}Lens =>"); + output.AppendLine($"{Indent(initialIndent + 3)}global::LeviySoft.Visor.Lens<{symbol.ToFQF()}, {propertyType}>.New("); output.AppendLine($"{Indent(initialIndent + 4)}p => p.{propertyName},"); output.AppendLine($"{Indent(initialIndent + 4)}f => p => p with {{{propertyName} = f(p.{propertyName})}}"); output.AppendLine($"{Indent(initialIndent + 3)});"); @@ -94,7 +94,7 @@ static void BuildNested(ITypeSymbol rootType, string suffix, IPropertySymbol sym if (propertyType.EndsWith("?")) output.AppendLine("#nullable enable"); - output.AppendLine($"{Indent(initialIndent + 2)}public static global::Tinkoff.Visor.ILens<{rootType.ToFQF()}, {propertyType}> {propertyName}Lens =>"); + output.AppendLine($"{Indent(initialIndent + 2)}public static global::LeviySoft.Visor.ILens<{rootType.ToFQF()}, {propertyType}> {propertyName}Lens =>"); output.AppendLine($"{Indent(initialIndent + 3)}{rootType.ToFQF()}.{suffix}{basePropertyName}Lens.Compose({basePropertyType}.{propertyName}Lens);"); if (propertyType.EndsWith("?")) diff --git a/src/Tinkoff.Visor.Gen/LensGenerator.cs b/src/LeviySoft.Visor.Gen/LensGenerator.cs similarity index 95% rename from src/Tinkoff.Visor.Gen/LensGenerator.cs rename to src/LeviySoft.Visor.Gen/LensGenerator.cs index 893d3f3..ceb94c2 100644 --- a/src/Tinkoff.Visor.Gen/LensGenerator.cs +++ b/src/LeviySoft.Visor.Gen/LensGenerator.cs @@ -4,7 +4,7 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; -namespace Tinkoff.Visor.Gen +namespace LeviySoft.Visor.Gen { [Generator] public class LensGenerator : IIncrementalGenerator @@ -31,7 +31,7 @@ static bool IsSyntaxTargetForGeneration(SyntaxNode node) static RecordDeclarationSyntax GetSemanticTargetForGeneration(GeneratorSyntaxContext context) { var rec = (RecordDeclarationSyntax)context.Node; - var attributeMetadata = context.SemanticModel.Compilation.GetTypeByMetadataName("Tinkoff.Visor.OpticsAttribute"); + var attributeMetadata = context.SemanticModel.Compilation.GetTypeByMetadataName("LeviySoft.Visor.OpticsAttribute"); var model = context.SemanticModel.Compilation.GetSemanticModel(rec.SyntaxTree); var symbol = model.GetDeclaredSymbol(rec) as ITypeSymbol; @@ -46,7 +46,7 @@ static RecordDeclarationSyntax GetSemanticTargetForGeneration(GeneratorSyntaxCon private void Execute(Compilation compilation, ImmutableArray records, SourceProductionContext context) { - INamedTypeSymbol attributeMetadata = compilation.GetTypeByMetadataName("Tinkoff.Visor.OpticsAttribute"); + INamedTypeSymbol attributeMetadata = compilation.GetTypeByMetadataName("LeviySoft.Visor.OpticsAttribute"); foreach (var rec in records.Distinct()) { diff --git a/src/Tinkoff.Visor.Gen/Tinkoff.Visor.Gen.csproj b/src/LeviySoft.Visor.Gen/LeviySoft.Visor.Gen.csproj similarity index 100% rename from src/Tinkoff.Visor.Gen/Tinkoff.Visor.Gen.csproj rename to src/LeviySoft.Visor.Gen/LeviySoft.Visor.Gen.csproj diff --git a/src/Tinkoff.Visor.Gen/SymbolHelpers.cs b/src/LeviySoft.Visor.Gen/SymbolHelpers.cs similarity index 97% rename from src/Tinkoff.Visor.Gen/SymbolHelpers.cs rename to src/LeviySoft.Visor.Gen/SymbolHelpers.cs index c9d68bd..81ff237 100644 --- a/src/Tinkoff.Visor.Gen/SymbolHelpers.cs +++ b/src/LeviySoft.Visor.Gen/SymbolHelpers.cs @@ -2,7 +2,7 @@ using System.Linq; using Microsoft.CodeAnalysis; -namespace Tinkoff.Visor.Gen +namespace LeviySoft.Visor.Gen { public static class SymbolHelpers { diff --git a/src/Tinkoff.Visor.LanguageExt.Tests/Tinkoff.Visor.LanguageExt.Tests.csproj b/src/LeviySoft.Visor.LanguageExt.Tests/LeviySoft.Visor.LanguageExt.Tests.csproj similarity index 87% rename from src/Tinkoff.Visor.LanguageExt.Tests/Tinkoff.Visor.LanguageExt.Tests.csproj rename to src/LeviySoft.Visor.LanguageExt.Tests/LeviySoft.Visor.LanguageExt.Tests.csproj index a3ac15b..142658a 100644 --- a/src/Tinkoff.Visor.LanguageExt.Tests/Tinkoff.Visor.LanguageExt.Tests.csproj +++ b/src/LeviySoft.Visor.LanguageExt.Tests/LeviySoft.Visor.LanguageExt.Tests.csproj @@ -20,7 +20,7 @@ - + diff --git a/src/Tinkoff.Visor.LanguageExt.Tests/PropertyTests.cs b/src/LeviySoft.Visor.LanguageExt.Tests/PropertyTests.cs similarity index 91% rename from src/Tinkoff.Visor.LanguageExt.Tests/PropertyTests.cs rename to src/LeviySoft.Visor.LanguageExt.Tests/PropertyTests.cs index 9b2f413..59b1df7 100644 --- a/src/Tinkoff.Visor.LanguageExt.Tests/PropertyTests.cs +++ b/src/LeviySoft.Visor.LanguageExt.Tests/PropertyTests.cs @@ -2,7 +2,7 @@ using Xunit; using static LanguageExt.Prelude; -namespace Tinkoff.Visor.LanguageExt.Tests; +namespace LeviySoft.Visor.LanguageExt.Tests; public class PropertyTests { diff --git a/src/Tinkoff.Visor.LanguageExt/Tinkoff.Visor.LanguageExt.csproj b/src/LeviySoft.Visor.LanguageExt/LeviySoft.Visor.LanguageExt.csproj similarity index 85% rename from src/Tinkoff.Visor.LanguageExt/Tinkoff.Visor.LanguageExt.csproj rename to src/LeviySoft.Visor.LanguageExt/LeviySoft.Visor.LanguageExt.csproj index b1936e5..53a606c 100644 --- a/src/Tinkoff.Visor.LanguageExt/Tinkoff.Visor.LanguageExt.csproj +++ b/src/LeviySoft.Visor.LanguageExt/LeviySoft.Visor.LanguageExt.csproj @@ -14,7 +14,7 @@ - + diff --git a/src/Tinkoff.Visor.LanguageExt/Property.cs b/src/LeviySoft.Visor.LanguageExt/Property.cs similarity index 96% rename from src/Tinkoff.Visor.LanguageExt/Property.cs rename to src/LeviySoft.Visor.LanguageExt/Property.cs index 2968ff7..2062858 100644 --- a/src/Tinkoff.Visor.LanguageExt/Property.cs +++ b/src/LeviySoft.Visor.LanguageExt/Property.cs @@ -1,7 +1,7 @@ using LanguageExt; using System; -namespace Tinkoff.Visor.LanguageExt; +namespace LeviySoft.Visor.LanguageExt; public static class Property { diff --git a/src/Tinkoff.Visor.Tests/Tinkoff.Visor.Tests.csproj b/src/LeviySoft.Visor.Tests/LeviySoft.Visor.Tests.csproj similarity index 92% rename from src/Tinkoff.Visor.Tests/Tinkoff.Visor.Tests.csproj rename to src/LeviySoft.Visor.Tests/LeviySoft.Visor.Tests.csproj index 11d518e..14017df 100644 --- a/src/Tinkoff.Visor.Tests/Tinkoff.Visor.Tests.csproj +++ b/src/LeviySoft.Visor.Tests/LeviySoft.Visor.Tests.csproj @@ -20,7 +20,7 @@ - + diff --git a/src/Tinkoff.Visor/IGetter.cs b/src/LeviySoft.Visor/IGetter.cs similarity index 97% rename from src/Tinkoff.Visor/IGetter.cs rename to src/LeviySoft.Visor/IGetter.cs index 1264643..c7b0d90 100644 --- a/src/Tinkoff.Visor/IGetter.cs +++ b/src/LeviySoft.Visor/IGetter.cs @@ -1,6 +1,6 @@ using System; -namespace Tinkoff.Visor; +namespace LeviySoft.Visor; /// /// Interface of Getter optic. diff --git a/src/Tinkoff.Visor/ILens.cs b/src/LeviySoft.Visor/ILens.cs similarity index 98% rename from src/Tinkoff.Visor/ILens.cs rename to src/LeviySoft.Visor/ILens.cs index fe5148b..230bc8a 100644 --- a/src/Tinkoff.Visor/ILens.cs +++ b/src/LeviySoft.Visor/ILens.cs @@ -1,6 +1,6 @@ using System; -namespace Tinkoff.Visor; +namespace LeviySoft.Visor; /// /// Interface of Lens optic. diff --git a/src/Tinkoff.Visor/IProperty.cs b/src/LeviySoft.Visor/IProperty.cs similarity index 98% rename from src/Tinkoff.Visor/IProperty.cs rename to src/LeviySoft.Visor/IProperty.cs index 356a14a..1670ff4 100644 --- a/src/Tinkoff.Visor/IProperty.cs +++ b/src/LeviySoft.Visor/IProperty.cs @@ -1,6 +1,6 @@ using System; -namespace Tinkoff.Visor; +namespace LeviySoft.Visor; /// /// Interface of Property optic (aka Optional). diff --git a/src/Tinkoff.Visor/ISetter.cs b/src/LeviySoft.Visor/ISetter.cs similarity index 97% rename from src/Tinkoff.Visor/ISetter.cs rename to src/LeviySoft.Visor/ISetter.cs index 42d56c5..3aaca14 100644 --- a/src/Tinkoff.Visor/ISetter.cs +++ b/src/LeviySoft.Visor/ISetter.cs @@ -1,6 +1,6 @@ using System; -namespace Tinkoff.Visor; +namespace LeviySoft.Visor; /// /// Interface of Setter optic. diff --git a/src/Tinkoff.Visor/Tinkoff.Visor.csproj b/src/LeviySoft.Visor/LeviySoft.Visor.csproj similarity index 100% rename from src/Tinkoff.Visor/Tinkoff.Visor.csproj rename to src/LeviySoft.Visor/LeviySoft.Visor.csproj diff --git a/src/Tinkoff.Visor/OpticsAttribute.cs b/src/LeviySoft.Visor/OpticsAttribute.cs similarity index 90% rename from src/Tinkoff.Visor/OpticsAttribute.cs rename to src/LeviySoft.Visor/OpticsAttribute.cs index 17f4dc2..a23437a 100644 --- a/src/Tinkoff.Visor/OpticsAttribute.cs +++ b/src/LeviySoft.Visor/OpticsAttribute.cs @@ -1,6 +1,6 @@ using System; -namespace Tinkoff.Visor; +namespace LeviySoft.Visor; [AttributeUsage(AttributeTargets.Class)] public class OpticsAttribute : Attribute diff --git a/src/Visor.sln b/src/Visor.sln index ccda949..d4e5b8c 100644 --- a/src/Visor.sln +++ b/src/Visor.sln @@ -1,17 +1,17 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tinkoff.Visor.Gen", "Tinkoff.Visor.Gen\Tinkoff.Visor.Gen.csproj", "{E8D2803F-6E57-440F-806A-27BB2575C0EB}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LeviySoft.Visor.Gen", "LeviySoft.Visor.Gen\LeviySoft.Visor.Gen.csproj", "{E8D2803F-6E57-440F-806A-27BB2575C0EB}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tinkoff.Visor.Gen.Tests", "Tinkoff.Visor.Gen.Tests\Tinkoff.Visor.Gen.Tests.csproj", "{49597BF6-5B5E-4B82-8835-AF91B923D6F9}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LeviySoft.Visor.Gen.Tests", "LeviySoft.Visor.Gen.Tests\LeviySoft.Visor.Gen.Tests.csproj", "{49597BF6-5B5E-4B82-8835-AF91B923D6F9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tinkoff.Visor", "Tinkoff.Visor\Tinkoff.Visor.csproj", "{2B90E9E6-6C06-42AA-95D2-C3366F79E98B}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LeviySoft.Visor", "LeviySoft.Visor\LeviySoft.Visor.csproj", "{2B90E9E6-6C06-42AA-95D2-C3366F79E98B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tinkoff.Visor.Tests", "Tinkoff.Visor.Tests\Tinkoff.Visor.Tests.csproj", "{55D94966-7858-44C6-97A6-2CC0B3D22FDB}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LeviySoft.Visor.Tests", "LeviySoft.Visor.Tests\LeviySoft.Visor.Tests.csproj", "{55D94966-7858-44C6-97A6-2CC0B3D22FDB}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tinkoff.Visor.LanguageExt", "Tinkoff.Visor.LanguageExt\Tinkoff.Visor.LanguageExt.csproj", "{F9037238-BB0D-456C-A3AA-FED9CC7B7B05}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LeviySoft.Visor.LanguageExt", "LeviySoft.Visor.LanguageExt\LeviySoft.Visor.LanguageExt.csproj", "{F9037238-BB0D-456C-A3AA-FED9CC7B7B05}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tinkoff.Visor.LanguageExt.Tests", "Tinkoff.Visor.LanguageExt.Tests\Tinkoff.Visor.LanguageExt.Tests.csproj", "{0AE99366-1370-4DD4-A1AA-46B969FC9DA0}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LeviySoft.Visor.LanguageExt.Tests", "LeviySoft.Visor.LanguageExt.Tests\LeviySoft.Visor.LanguageExt.Tests.csproj", "{0AE99366-1370-4DD4-A1AA-46B969FC9DA0}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution From 93cc744d8b771db001648e0f6a8294cccdbeb215 Mon Sep 17 00:00:00 2001 From: Daniel Slapman Date: Sat, 18 Nov 2023 19:13:43 +0100 Subject: [PATCH 3/3] Add clarification note --- readme.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 1ee43df..0fa329e 100644 --- a/readme.md +++ b/readme.md @@ -67,4 +67,8 @@ Sample.DescriptionLens.Set("replaced")(...); - Traverse - Fold - Iso -- utility optics for collections \ No newline at end of file +- utility optics for collections + +## Other notes + +LeviySoft.Visor is a fork of Tinkoff.Visor maintained independently and not related to Tinkoff in any kind. \ No newline at end of file