Skip to content

Commit

Permalink
Break out transformer extension methods into their own package
Browse files Browse the repository at this point in the history
  • Loading branch information
louthy committed Jun 4, 2022
1 parent 70b8b28 commit d6fb39a
Show file tree
Hide file tree
Showing 167 changed files with 13,231 additions and 5,800 deletions.
11 changes: 8 additions & 3 deletions LanguageExt.CodeGen/LanguageExt.CodeGen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<!--<Sdk Name="CodeGeneration.Roslyn.Plugin.Sdk" Version="0.7.5-alpha" />-->

<PropertyGroup>
<PackageVersion>4.1.1</PackageVersion>
<PackageVersion>4.1.2</PackageVersion>
<PackageId>LanguageExt.CodeGen</PackageId>
<Title>LanguageExt.CodeGen</Title>
<TargetFramework>netstandard2.0</TargetFramework>
Expand All @@ -17,7 +17,7 @@
<Copyright>Copyright (c) Paul Louth. All rights reserved.</Copyright>
<Description>Design and build-time code-gen for records, unions, lenses and immutable With functions</Description>
<PackageTags>C#, Functional, Language Extension, Lenses, Records, Unions, Monad, Option, Either, Reader, Writer, State, List, Set, Map, Queue, Memo, Memoization, Immutable, Lambda, Pattern Matching, Tuple</PackageTags>
<PackageIconUrl>https://github.com/louthy/language-ext/blob/master/Images/lang-ext-small.png?raw=true</PackageIconUrl>
<PackageIcon>lang-ext-small.png</PackageIcon>
<PackageProjectUrl>https://github.com/louthy/language-ext</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
Expand All @@ -28,7 +28,12 @@
<NoWarn>1701;1702;1705;IDE1006;CS1591;CS1573;CS1712;CS1570;CS1711;CS1572;CS1587</NoWarn>

</PropertyGroup>

<ItemGroup>
<None Include="..\Images\lang-ext-small.png">
<Pack>True</Pack>
<PackagePath/>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="CodeGeneration.Roslyn" Version="$(RoslynCodeGenVersion)" />
</ItemGroup>
Expand Down
2 changes: 0 additions & 2 deletions LanguageExt.Core/Class Instances/Eq/EqSeq.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ public struct EqSeq<EqA, A> : Eq<Seq<A>>
[Pure]
public bool Equals(Seq<A> x, Seq<A> y)
{
if (x == null) return y == null;
if (y == null) return false;
if (x.Count != y.Count) return false;

while (true)
Expand Down
2 changes: 1 addition & 1 deletion LanguageExt.Core/Class Instances/Indexable/SeqIndex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public A Get(Seq<A> ma, int key) =>

[Pure]
public Option<A> TryGet(Seq<A> ma, int key) =>
ma == null || key < 0 || key >= ma.Count
key < 0 || key >= ma.Count
? None
: Some(ma[key]);
}
Expand Down
4 changes: 0 additions & 4 deletions LanguageExt.Core/Class Instances/Ord/OrdSeq.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ public bool Equals(Seq<A> x, Seq<A> y) =>
[Pure]
public int Compare(Seq<A> x, Seq<A> y)
{
if (ReferenceEquals(x, y)) return 0;
if (ReferenceEquals(x, null)) return -1;
if (ReferenceEquals(y, null)) return 1;

using var enumx = x.GetEnumerator();
using var enumy = y.GetEnumerator();

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 7 additions & 4 deletions LanguageExt.Core/Concurrency/AtomHashMap/AtomHashMap.Eq.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,10 @@ public HashMap<EqK, K, V> ToHashMap() =>
/// Map the map the a dictionary
/// </summary>
[Pure]
public IDictionary<KR, VR> ToDictionary<KR, VR>(Func<(K Key, V Value), KR> keySelector, Func<(K Key, V Value), VR> valueSelector) =>
public IDictionary<KR, VR> ToDictionary<KR, VR>(
Func<(K Key, V Value), KR> keySelector,
Func<(K Key, V Value), VR> valueSelector)
where KR : notnull =>
AsEnumerable().ToDictionary(keySelector, valueSelector);

/// <summary>
Expand Down Expand Up @@ -1926,15 +1929,15 @@ public Unit Union<W>(IEnumerable<(K Key, W Value)> rhs, WhenMissing<K, W, V> Map
/// Equality of keys and values with `EqDefault<V>` used for values
/// </summary>
[Pure]
public override bool Equals(object obj) =>
public override bool Equals(object? obj) =>
obj is AtomHashMap<K, V> hm && Equals(hm);

/// <summary>
/// Equality of keys and values with `EqDefault<V>` used for values
/// </summary>
[Pure]
public bool Equals(AtomHashMap<EqK, K, V> other) =>
Items.Equals(other.Items);
public bool Equals(AtomHashMap<EqK, K, V>? other) =>
other is not null && Items.Equals(other.Items);

/// <summary>
/// Equality of keys and values with `EqDefault<V>` used for values
Expand Down
11 changes: 7 additions & 4 deletions LanguageExt.Core/Concurrency/AtomHashMap/AtomHashMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,10 @@ public HashMap<K, V> ToHashMap() =>
/// Map the map the a dictionary
/// </summary>
[Pure]
public IDictionary<KR, VR> ToDictionary<KR, VR>(Func<(K Key, V Value), KR> keySelector, Func<(K Key, V Value), VR> valueSelector) =>
public IDictionary<KR, VR> ToDictionary<KR, VR>(
Func<(K Key, V Value), KR> keySelector,
Func<(K Key, V Value), VR> valueSelector)
where KR : notnull =>
AsEnumerable().ToDictionary(keySelector, valueSelector);

/// <summary>
Expand Down Expand Up @@ -1898,15 +1901,15 @@ public Unit Union<W>(IEnumerable<(K Key, W Value)> rhs, WhenMissing<K, W, V> Map
/// Equality of keys and values with `EqDefault<V>` used for values
/// </summary>
[Pure]
public override bool Equals(object obj) =>
public override bool Equals(object? obj) =>
obj is AtomHashMap<K, V> hm && Equals(hm);

/// <summary>
/// Equality of keys and values with `EqDefault<V>` used for values
/// </summary>
[Pure]
public bool Equals(AtomHashMap<K, V> other) =>
Items.Equals(other.Items);
public bool Equals(AtomHashMap<K, V>? other) =>
other is not null && Items.Equals(other.Items);

/// <summary>
/// Equality of keys and values with `EqDefault<V>` used for values
Expand Down
14 changes: 8 additions & 6 deletions LanguageExt.Core/Concurrency/AtomSeq/AtomSeq.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ public override int GetHashCode() =>

[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int CompareTo(object obj) => obj switch
public int CompareTo(object? obj) => obj switch
{
AtomSeq<A> s => CompareTo(s),
Seq<A> s => CompareTo(s),
Expand Down Expand Up @@ -1150,7 +1150,7 @@ public string ToFullArrayString(string separator = ", ") =>
/// Equality test
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override bool Equals(object obj) => obj switch
public override bool Equals(object? obj) => obj switch
{
AtomSeq<A> s => Equals(s),
Seq<A> s => Equals(s),
Expand All @@ -1171,8 +1171,8 @@ public bool Equals(Seq<A> rhs) =>
/// </summary>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(AtomSeq<A> rhs) =>
Equals<EqDefault<A>>(rhs);
public bool Equals(AtomSeq<A>? rhs) =>
rhs is not null && Equals<EqDefault<A>>(rhs);

/// <summary>
/// Equality test
Expand Down Expand Up @@ -1436,8 +1436,10 @@ public int CompareTo(Seq<A> rhs) =>
/// Compare to another sequence
/// </summary>
[Pure]
public int CompareTo(AtomSeq<A> rhs) =>
CompareTo<OrdDefault<A>>(rhs);
public int CompareTo(AtomSeq<A>? rhs) =>
rhs is null
? 1
: CompareTo<OrdDefault<A>>(rhs);

/// <summary>
/// Compare to another sequence
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ class PropCache<T>

public static async ValueTask<A> Cast<A>(this ValueTask source)
{
if (source == null) throw new ArgumentNullException(nameof(source));
await source.ConfigureAwait(false);
var prop = PropCache<A>.Info;
return prop != null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,16 +372,16 @@ public Unit Except(IEnumerable<K> rhs) =>
/// </summary>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override bool Equals(object obj) =>
public override bool Equals(object? obj) =>
obj is VersionHashMap<ConflictV, K, V> hm && Equals(hm);

/// <summary>
/// Equality of keys and values with `EqDefault<V>` used for values
/// </summary>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(VersionHashMap<ConflictV, K, V> other) =>
Items.Equals(other.Items);
public bool Equals(VersionHashMap<ConflictV, K, V>? other) =>
other is not null && Items.Equals(other.Items);

[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,16 +460,16 @@ public Unit Except(IEnumerable<K> rhs)
/// </summary>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override bool Equals(object obj) =>
public override bool Equals(object? obj) =>
obj is VersionHashMap<ConflictV, OrdActor, EqK, Actor, K, V> hm && Equals(hm);

/// <summary>
/// Equality of keys and values with `EqDefault<V>` used for values
/// </summary>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(VersionHashMap<ConflictV, OrdActor, EqK, Actor, K, V> other) =>
Items.Equals(other.Items);
public bool Equals(VersionHashMap<ConflictV, OrdActor, EqK, Actor, K, V>? other) =>
other is not null && Items.Equals(other.Items);

[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,16 +371,16 @@ public Unit Except(IEnumerable<K> rhs) =>
/// </summary>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override bool Equals(object obj) =>
public override bool Equals(object? obj) =>
obj is VersionHashMap<K, V> hm && Equals(hm);

/// <summary>
/// Equality of keys and values with `EqDefault<V>` used for values
/// </summary>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(VersionHashMap<K, V> other) =>
Items.Equals(other.Items);
public bool Equals(VersionHashMap<K, V>? other) =>
other is not null && Items.Equals(other.Items);

[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down
Loading

0 comments on commit d6fb39a

Please sign in to comment.