Skip to content

Commit

Permalink
Add Playground project
Browse files Browse the repository at this point in the history
  • Loading branch information
thinker227 committed Jan 4, 2024
1 parent 104f3ce commit 2b2465a
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Rascal.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rascal", "src\Rascal\Rascal
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rascal.Tests", "src\Rascal.Tests\Rascal.Tests.csproj", "{291FDB2E-8AC8-4B7A-B6E6-6DF5DCBCEB58}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rascal.Playground", "src\Rascal.Playground\Rascal.Playground.csproj", "{F5A7C08C-51B5-4043-9666-C8DCD4F9C1E4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -26,9 +28,14 @@ Global
{291FDB2E-8AC8-4B7A-B6E6-6DF5DCBCEB58}.Debug|Any CPU.Build.0 = Debug|Any CPU
{291FDB2E-8AC8-4B7A-B6E6-6DF5DCBCEB58}.Release|Any CPU.ActiveCfg = Release|Any CPU
{291FDB2E-8AC8-4B7A-B6E6-6DF5DCBCEB58}.Release|Any CPU.Build.0 = Release|Any CPU
{F5A7C08C-51B5-4043-9666-C8DCD4F9C1E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F5A7C08C-51B5-4043-9666-C8DCD4F9C1E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F5A7C08C-51B5-4043-9666-C8DCD4F9C1E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F5A7C08C-51B5-4043-9666-C8DCD4F9C1E4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{04DE173D-4E74-4104-94FA-2B1807FCD34D} = {D92004B4-8D01-4BC3-B76B-A80D657FEC30}
{291FDB2E-8AC8-4B7A-B6E6-6DF5DCBCEB58} = {D92004B4-8D01-4BC3-B76B-A80D657FEC30}
{F5A7C08C-51B5-4043-9666-C8DCD4F9C1E4} = {D92004B4-8D01-4BC3-B76B-A80D657FEC30}
EndGlobalSection
EndGlobal
1 change: 1 addition & 0 deletions src/Rascal.Playground/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Program.cs
12 changes: 12 additions & 0 deletions src/Rascal.Playground/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Rascal;
using static Rascal.Prelude;

var num = Console.ReadLine()
.NotNull("Failed to read from stdin.")
.Then(s => ParseR<int>(s, null, $"{s} is not a number!"))
.Validate(x => x >= 0, _ => "Number cannot be negative!");

num.Switch(
x => Console.WriteLine($"You entered {x}!"),
e => Console.WriteLine(e.Message)
);
5 changes: 5 additions & 0 deletions src/Rascal.Playground/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Rascal.Playground

This project is meant as a development playground for the things like core API, analyzers, etc. outside of tests.

Changes to this project should be ignored.
15 changes: 15 additions & 0 deletions src/Rascal.Playground/Rascal.Playground.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<WarningsAsErrors>nullable</WarningsAsErrors>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Rascal\Rascal.csproj" />
</ItemGroup>

</Project>

0 comments on commit 2b2465a

Please sign in to comment.