Skip to content

Commit

Permalink
Merge pull request #26 from MonacsLib/develop
Browse files Browse the repository at this point in the history
Release version 0.3
  • Loading branch information
bartsokol authored May 22, 2018
2 parents f02e262 + d613857 commit 614600c
Show file tree
Hide file tree
Showing 17 changed files with 591 additions and 119 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,5 @@ paket-files/
# JetBrains Rider
.idea/
*.sln.iml

*.orig
14 changes: 10 additions & 4 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,26 @@
"version": "2.0.0",
"tasks": [
{
"taskName": "build",
"label": "build",
"command": "dotnet build",
"type": "shell",
"group": "build",
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "silent"
},
"problemMatcher": "$msCompile"
},
{
"taskName": "test",
"label": "test",
"command": "dotnet test ./Monacs.UnitTests/Monacs.UnitTests.fsproj",
"type": "shell",
"group": "build",
"group": {
"kind": "test",
"isDefault": true
},
"presentation": {
"reveal": "always"
},
Expand Down
4 changes: 2 additions & 2 deletions Monacs.Core/ErrorDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ namespace Monacs.Core
/// Represents the details of the error in case of failed operation.
/// To create the instances use the factory methods from the <see cref="Errors"/> class.
/// </summary>
public struct ErrorDetails
public readonly struct ErrorDetails
{
internal ErrorDetails(ErrorLevel level, Option<string> message, Option<string> key, Option<Exception> exception, Option<object> metadata)
internal ErrorDetails(in ErrorLevel level, in Option<string> message, in Option<string> key, in Option<Exception> exception, in Option<object> metadata)
{
Level = level;
Message = message;
Expand Down
15 changes: 11 additions & 4 deletions Monacs.Core/Monacs.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard1.3;netstandard2.0;net461</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard1.3;net461</TargetFrameworks>
<NuspecFile>$(MSBuildThisFileDirectory)$(MSBuildProjectName).nuspec</NuspecFile>
<LangVersion>latest</LangVersion>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>

</Project>
<ItemGroup Condition = "'$(TargetFramework)' == 'netstandard1.3'">
<PackageReference Include="System.ValueTuple" Version="4.4.0" />
</ItemGroup>
<ItemGroup Condition = "'$(TargetFramework)' == 'net461' AND '$(OS)' == 'Windows_NT'">
<PackageReference Include="System.ValueTuple" Version="4.4.0" />
</ItemGroup>
</Project>
15 changes: 10 additions & 5 deletions Monacs.Core/Monacs.Core.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Monacs.Core</id>
<version>0.2.1</version>
<version>0.3.0</version>
<authors>Bartosz Sokół</authors>
<owners>Bartosz Sokół</owners>
<licenseUrl>https://github.com/bartsokol/Monacs/blob/master/LICENSE</licenseUrl>
Expand All @@ -11,15 +11,20 @@
<description>Collection of basic monads and functional extensions for C#</description>
<tags>csharp functional functional-programming monads railway-oriented-programming rop</tags>
<dependencies>
<group targetFramework=".NETFramework4.6.1" />
<group targetFramework=".NETFramework4.6.1">
<dependency id="System.ValueTuple" version="4.4.0" />
</group>
<group targetFramework=".NETStandard1.3">
<dependency id="NETStandard.Library" version="1.6.1" exclude="Build,Analyzers" />
<dependency id="System.ValueTuple" version="4.4.0" />
</group>
<group targetFramework=".NETStandard2.0">
</group>
</dependencies>
</metadata>
<files>
<file src="bin\Release\netstandard1.3\*.*" target="lib\netstandard1.3\" />
<file src="bin\Release\netstandard2.0\*.*" target="lib\netstandard2.0\" />
<file src="bin\Release\net461\*.*" target="lib\net461\" />
<file src="bin\Release\netstandard1.3\Monacs.*.*" target="lib\netstandard1.3\" />
<file src="bin\Release\netstandard2.0\Monacs.*.*" target="lib\netstandard2.0\" />
<file src="bin\Release\net461\Monacs.*.*" target="lib\net461\" />
</files>
</package>
16 changes: 8 additions & 8 deletions Monacs.Core/Option.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Monacs.Core
/// <para />If no value is encapsulated it's called None.
/// </summary>
/// <typeparam name="T">Type of encapsulated value.</typeparam>
public struct Option<T> : IEquatable<Option<T>>, IEquatable<T>
public readonly struct Option<T> : IEquatable<Option<T>>, IEquatable<T>
{
internal Option(T value)
{
Expand Down Expand Up @@ -86,18 +86,18 @@ public override int GetHashCode()
}
}

public static bool operator ==(Option<T> a, Option<T> b) => a.Equals(b);
public static bool operator ==(in Option<T> a, in Option<T> b) => a.Equals(b);

public static bool operator !=(Option<T> a, Option<T> b) => !a.Equals(b);
public static bool operator !=(in Option<T> a, in Option<T> b) => !a.Equals(b);

public static bool operator ==(Option<T> a, T b) => a.Equals(b);
public static bool operator ==(in Option<T> a, in T b) => a.Equals(b);

public static bool operator !=(Option<T> a, T b) => !a.Equals(b);
public static bool operator !=(in Option<T> a, in T b) => !a.Equals(b);

public static bool operator ==(T a, Option<T> b) => b.Equals(a);
public static bool operator ==(in T a, in Option<T> b) => b.Equals(a);

public static bool operator !=(T a, Option<T> b) => !b.Equals(a);
public static bool operator !=(in T a, in Option<T> b) => !b.Equals(a);

public static implicit operator T(Option<T> option) => option.IsSome ? option.Value : default;
public static implicit operator T(in Option<T> option) => option.IsSome ? option.Value : default;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
using System.Threading.Tasks;
using static Monacs.Core.Result;

namespace Monacs.Core.Async
namespace Monacs.Core
{
///<summary>
/// Contains the set of async extensions to work with the <see cref="Result{T}" /> type.
///</summary>
public static class Result
public static class AsyncResult
{
/* BindAsync */

Expand Down Expand Up @@ -193,8 +193,8 @@ public static async Task<TOut> MatchAsync<TIn, TOut>(this Task<Result<TIn>> resu
///</summary>
/// <typeparam name="T">Type of the encapsulated value.</typeparam>
/// <param name="result">The result of which the value should be ignored.</param>
public static async Task<Result<Monacs.Core.Unit.Unit>> IgnoreAsync<T>(this Task<Result<T>> result) =>
(await result).Map(_ => Monacs.Core.Unit.Unit.Default);
public static async Task<Result<Unit.Unit>> IgnoreAsync<T>(this Task<Result<T>> result) =>
(await result).Map(_ => Unit.Unit.Default);

/* Side Effects */

Expand Down
Loading

0 comments on commit 614600c

Please sign in to comment.