Skip to content

Commit

Permalink
Move Result and OptionalResult into LanguageExt.Common namespace
Browse files Browse the repository at this point in the history
 - These types shouldn't really be used directly, so moving them away from the main namespace will reduce the possibility of clashes with other libaries or user code that uses the common name Result
  • Loading branch information
louthy committed Aug 21, 2019
1 parent 53588c0 commit 55f36a3
Show file tree
Hide file tree
Showing 41 changed files with 47 additions and 45 deletions.
2 changes: 1 addition & 1 deletion LanguageExt.CodeGen/LanguageExt.CodeGen.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk" DefaultTargets="Build">
<Project Sdk="Microsoft.NET.Sdk" DefaultTargets="Build">

<PropertyGroup>
<PackageVersion>3.3.18</PackageVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using static LanguageExt.Prelude;
using System.Diagnostics.Contracts;
using System.Threading.Tasks;
using LanguageExt.Common;

namespace LanguageExt.ClassInstances
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using static LanguageExt.Prelude;
using System.Diagnostics.Contracts;
using System.Threading.Tasks;
using LanguageExt.Common;

namespace LanguageExt.ClassInstances
{
Expand Down
4 changes: 2 additions & 2 deletions LanguageExt.Core/ClassInstances/Eq/EqResult.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

using LanguageExt.TypeClasses;
using LanguageExt.TypeClasses;
using System.Reflection;
using LanguageExt.Common;

namespace LanguageExt.ClassInstances
{
Expand Down
1 change: 1 addition & 0 deletions LanguageExt.Core/ClassInstances/Functor/FTryAsync.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using LanguageExt.Common;
using LanguageExt.TypeClasses;
using static LanguageExt.Prelude;
using System.Diagnostics.Contracts;
Expand Down
1 change: 1 addition & 0 deletions LanguageExt.Core/ClassInstances/Functor/FTryOptionAsync.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using LanguageExt.Common;
using LanguageExt.TypeClasses;
using static LanguageExt.Prelude;
using System.Diagnostics.Contracts;
Expand Down
1 change: 1 addition & 0 deletions LanguageExt.Core/ClassInstances/Monad/MTry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using LanguageExt.TypeClasses;
using System.Diagnostics.Contracts;
using static LanguageExt.Prelude;
using LanguageExt.Common;

namespace LanguageExt.ClassInstances
{
Expand Down
2 changes: 1 addition & 1 deletion LanguageExt.Core/ClassInstances/Monad/MTryAsync.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using LanguageExt.TypeClasses;
using System.Diagnostics.Contracts;
using static LanguageExt.Prelude;
using LanguageExt.Common;
using System.Threading.Tasks;

namespace LanguageExt.ClassInstances
Expand Down
1 change: 1 addition & 0 deletions LanguageExt.Core/ClassInstances/Monad/MTryFirstAsync.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using LanguageExt.Common;
using LanguageExt.TypeClasses;
using System.Diagnostics.Contracts;
using static LanguageExt.Prelude;
Expand Down
1 change: 1 addition & 0 deletions LanguageExt.Core/ClassInstances/Monad/MTryOption.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using LanguageExt.Common;
using LanguageExt.TypeClasses;
using System.Diagnostics.Contracts;
using static LanguageExt.Prelude;
Expand Down
1 change: 1 addition & 0 deletions LanguageExt.Core/ClassInstances/Monad/MTryOptionAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using LanguageExt.TypeClasses;
using System.Diagnostics.Contracts;
using System.Threading.Tasks;
using LanguageExt.Common;

namespace LanguageExt.ClassInstances
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Diagnostics.Contracts;
using static LanguageExt.Prelude;
using System.Threading.Tasks;
using LanguageExt.Common;

namespace LanguageExt.ClassInstances
{
Expand Down
2 changes: 1 addition & 1 deletion LanguageExt.Core/ClassInstances/Ord/OrdResult.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

using LanguageExt.Common;
using LanguageExt.TypeClasses;
using System.Reflection;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using LanguageExt.ClassInstances;
using System.Threading.Tasks;

namespace LanguageExt
namespace LanguageExt.Common
{
internal enum OptionalResultState : byte
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using LanguageExt.ClassInstances;
using System.Threading.Tasks;

namespace LanguageExt
namespace LanguageExt.Common
{
public enum ResultState : byte
{
Expand Down
1 change: 1 addition & 0 deletions LanguageExt.Core/DataTypes/RWS/RWS.Extensions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using LanguageExt;
using LanguageExt.Common;
using static LanguageExt.Prelude;
using LanguageExt.ClassInstances;
using LanguageExt.TypeClasses;
Expand Down
7 changes: 1 addition & 6 deletions LanguageExt.Core/DataTypes/Reader/Reader.Extensions.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
using System;
using System.Linq;
using LanguageExt;
using LanguageExt.TypeClasses;
using LanguageExt.Common;
using static LanguageExt.Prelude;
using static LanguageExt.TypeClass;
using System.Diagnostics.Contracts;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.ComponentModel;
using LanguageExt.ClassInstances;

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion LanguageExt.Core/DataTypes/State/State.Extensions.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System;
using System.Linq;
using LanguageExt;
using static LanguageExt.Prelude;
using System.Diagnostics.Contracts;
using System.Collections.Generic;
using LanguageExt.ClassInstances;
using LanguageExt.Common;

/// <summary>
/// Extension methods for State
Expand Down
2 changes: 1 addition & 1 deletion LanguageExt.Core/DataTypes/Try/Task.Try.Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Diagnostics.Contracts;
using System.Threading.Tasks;
using LanguageExt.TypeClasses;
using System.Collections.Generic;
using LanguageExt.Common;

public static class TaskTryExtensions
{
Expand Down
5 changes: 1 addition & 4 deletions LanguageExt.Core/DataTypes/Try/Try.Extensions.Async.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
using System;
using System.Linq;
using System.ComponentModel;
using LanguageExt;
using static LanguageExt.Prelude;
using static LanguageExt.TypeClass;
using System.Diagnostics.Contracts;
using System.Threading.Tasks;
using LanguageExt.TypeClasses;
using System.Collections.Generic;
using LanguageExt.ClassInstances;
using LanguageExt.Common;

/// <summary>
/// Extension methods for the Try monad
Expand Down
1 change: 1 addition & 0 deletions LanguageExt.Core/DataTypes/Try/Try.Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using LanguageExt.TypeClasses;
using static LanguageExt.Prelude;
using static LanguageExt.TypeClass;
using LanguageExt.Common;

/// <summary>
/// Extension methods for the Try monad
Expand Down
3 changes: 1 addition & 2 deletions LanguageExt.Core/DataTypes/Try/Try.Prelude.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using LanguageExt.ClassInstances;
using LanguageExt.TypeClasses;
using static LanguageExt.TypeClass;
using LanguageExt.Common;
using System;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Collections.Generic;

namespace LanguageExt
Expand Down
4 changes: 3 additions & 1 deletion LanguageExt.Core/DataTypes/Try/Try.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace LanguageExt
using LanguageExt.Common;

namespace LanguageExt
{
/// <summary>
/// The Try monad captures exceptions and uses them to cancel the
Expand Down
1 change: 1 addition & 0 deletions LanguageExt.Core/DataTypes/TryAsync/TryAsync.Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using LanguageExt.TypeClasses;
using System.Collections.Generic;
using LanguageExt.ClassInstances;
using LanguageExt.Common;

/// <summary>
/// Extension methods for the TryAsync monad
Expand Down
3 changes: 1 addition & 2 deletions LanguageExt.Core/DataTypes/TryAsync/TryAsync.Prelude.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using LanguageExt.ClassInstances;
using LanguageExt.TypeClasses;
using static LanguageExt.TypeClass;
using LanguageExt.Common;
using System;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Threading.Tasks;

namespace LanguageExt
Expand Down
1 change: 1 addition & 0 deletions LanguageExt.Core/DataTypes/TryAsync/TryAsync.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Threading.Tasks;
using LanguageExt.Common;

namespace LanguageExt
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
using System;
using System.Linq;
using LanguageExt;
using static LanguageExt.Prelude;
using static LanguageExt.TypeClass;
using System.Diagnostics.Contracts;
using System.Threading.Tasks;
using LanguageExt.TypeClasses;
using LanguageExt.ClassInstances;
using System.ComponentModel;
using System.Collections.Generic;
using LanguageExt.Common;

public static class TaskTryOptionExtensions
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
using System;
using System.Linq;
using LanguageExt;
using static LanguageExt.Prelude;
using static LanguageExt.TypeClass;
using System.Diagnostics.Contracts;
using System.Threading.Tasks;
using LanguageExt.TypeClasses;
using LanguageExt.ClassInstances;
using System.ComponentModel;
using System.Collections.Generic;
using LanguageExt.Common;

/// <summary>
/// Extension methods for the Try monad
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using LanguageExt.ClassInstances;
using System.ComponentModel;
using System.Collections.Generic;
using LanguageExt.Common;

/// <summary>
/// Extension methods for the Try monad
Expand Down
3 changes: 1 addition & 2 deletions LanguageExt.Core/DataTypes/TryOption/TryOption.Prelude.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using LanguageExt.ClassInstances;
using LanguageExt.TypeClasses;
using static LanguageExt.TypeClass;
using LanguageExt.Common;
using System;
using System.Diagnostics.Contracts;
using System.Linq;

namespace LanguageExt
{
Expand Down
3 changes: 2 additions & 1 deletion LanguageExt.Core/DataTypes/TryOption/TryOption.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

using LanguageExt.Common;

namespace LanguageExt
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Collections.Generic;
using LanguageExt.ClassInstances;
using LanguageExt.DataTypes.Serialisation;
using LanguageExt.Common;

/// <summary>
/// Extension methods for the TryOptionAsync monad
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using LanguageExt.ClassInstances;
using LanguageExt.TypeClasses;
using static LanguageExt.TypeClass;
using LanguageExt.Common;
using System;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Threading.Tasks;

namespace LanguageExt
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Threading.Tasks;
using LanguageExt.Common;

namespace LanguageExt
{
Expand Down
3 changes: 1 addition & 2 deletions LanguageExt.Core/DataTypes/Writer/Writer.Extensions.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using System;
using System.Linq;
using LanguageExt;
using static LanguageExt.Prelude;
using System.Diagnostics.Contracts;
using System.Collections.Generic;
using LanguageExt.ClassInstances;
using LanguageExt.TypeClasses;
using LanguageExt.Common;

/// <summary>
/// Extension methods for Writer
Expand Down
2 changes: 1 addition & 1 deletion LanguageExt.Core/LanguageExt.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup Label="Configuration" Condition="'$(Configuration)'=='Debug'">
<DefineConstants>TRACE;DEBUG</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Diagnostics.Contracts;
using System.Threading.Tasks;
using static LanguageExt.Prelude;
using LanguageExt.Common;

namespace LanguageExt
{
Expand Down Expand Up @@ -126,4 +127,4 @@ public static class ExceptionAsyncExtensions
public static LanguageExt.ExceptionMatchAsync<R> Match<R>(this Task<Result<R>> self) =>
new LanguageExt.ExceptionMatchAsync<R>(self);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Diagnostics.Contracts;
using System.Threading.Tasks;
using static LanguageExt.Prelude;
using LanguageExt.Common;

namespace LanguageExt
{
Expand Down
3 changes: 2 additions & 1 deletion LanguageExt.Tests/ResultTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using LanguageExt.Common;

using Xunit;

Expand Down Expand Up @@ -291,4 +292,4 @@ public void TestMapWithFaultWithNullException()
private readonly Result<int> faultResult = new Result<int>(new InvalidOperationException());
private readonly Result<int> faultWithNullException = new Result<int>((Exception) null);
}
}
}
1 change: 1 addition & 0 deletions Samples/Records/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using LanguageExt.Common;

namespace Records
{
Expand Down
1 change: 1 addition & 0 deletions Samples/TestBed/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Linq;
using System.Reflection;
using LanguageExt;
using LanguageExt.Common;
using Newtonsoft.Json;
using System.Runtime.Serialization;
using static LanguageExt.Prelude;
Expand Down

0 comments on commit 55f36a3

Please sign in to comment.