About the repository¶
There is only one solution in the csharp-functional repository:
Structure of the solution¶
|The Maybe monad||Source||MaybeMonad NuGet||MaybeMonad|
|The Result monad||Source||ResultMonad NuGet||ResultMonad|
|The HttpResult monad||Source||HttpResultMonad NuGet||HttpResultMonad|
|The Result monad extensions||Source||ResultMonad.Extensions NuGet||ResultMonad.Extensions|
|The HttpResult monad extensions||Source||HttpResultMonad.Extensions NuGet||HttpResultMonad.Extensions|
|The Result monad extensions that transforms them into HttpResult monad||Source||ResultMonad.Extensions.HttpResultMonad NuGet||ResultMonad.Extensions.HttpResultMonad|
|The Maybe monad extensions that transforms them into Result monad||Source||MaybeMonad.Extensions.ResultMonad NuGet||MaybeMonad.Extensions.ResultMonad|
|Simple application of HttpResult monad on a class by using it with System.Net.Http.HttpClient||Source||HttpResultMonad.HttpResultOnHttpClient NuGet||HttpResultMonad.HttpResultOnHttpClient|
|Tests for the Maybe monad||Test||N/A||MaybeMonad.Tests|
|Tests for the Result monad||Test||N/A||ResultMonad.Tests|
|Tests for the HttpResult monad||Test||N/A||HttpResultMonad.Tests|
|Tests for the Result monad extensions||Test||N/A||ResultMonad.Extensions.Tests|
|Tests for the HttpResult monad extensions||Test||N/A||HttpResultMonad.Extensions.Tests|
|Tests for the Result monad extensions that transforms them into HttpResult monad||Test||N/A||ResultMonad.Extensions.HttpResultMonad.Tests|
|Tests for the Maybe monad extensions that transforms them into Result monad||Test||N/A||MaybeMonad.Extensions.ResultMonad.Tests|
|Tests for the simple example of applying HttpResult monad on a class by using it with System.Net.Http.HttpClient||Test||N/A||HttpResultMonad.HttpResultOnHttpClient.Tests|
|Shared code between test projects||Test Library||N/A||Tests.Shared|
The documentation for the repository can be found at the Docs folder.
Read this to understand how the documentation was created and how you can build it.
Building the docs¶
To build the docs you need:
- Sphinx read the docs theme.
- Pylint (not required but recommended)
choco install python
Sphinx is a tool that makes it easy to create beautiful documentation. Assuming you have Python already, install Sphinx by executing the following on PowerShell:
pip install sphinx sphinx-autobuild
The read the docs theme is configured in the conf.py file. To get this theme execute the following on PowerShell:
pip install sphinx_rtd_theme
For more information about the read the docs theme see its repo.
To install Pylint execute the following from PowerShell:
pip install pylint
Once you have setup your environment you can build the docs by running the make.bat file. You can also build the docs from Visual Studio Code as explained in the next section.
These build instructions are focused for Windows users. If you are using a different OS then the instructions can’t be taken word by word but the same requirements apply. Furthermore there is a makefile available for non Windows users.
Editing the docs with Visual Studio Code¶
After installing Visual Studio Code I recommend installing the following extensions:
These will greatly increase your productivity while editing the documentation. For instance:
- The Code Spell Checker will highlight words it does not recognize and then you can use Ctrl+. on those words to correct them.
- The reStructuredText extension will
- Visual Studio Code contains numerous features that will improve your productivity. Something as simple as providing auto-complete suggestions from the words already available on your documentation speeds up your typing a lot.
In the .vscode folder you have 4 configuration files:
cSpell.json: contains configuration for the Code Spell Checker extension. You can add words to this file by using the Ctrl+. shortcut on words that the spell checker does not recognize and chose “Add to project dictionary”.
settings.json: contains the configuration for the reStructuredText extensions.
tasks.json: contains 3 tasks for Visual Studio Code:
- build-docs: The default build task. In Visual Studio Code go to “Tasks->Run Task” and select the build-docs task or “Tasks->Run Build Task”. If you’re using Visual Studio Code from a non Windows OS then you should change the command to execute the makefile instead of the make.bat.
- open-docs: A task to open the docs. In Visual Studio Code go to “Tasks->Run Task” and select the open-docs task. That should open the index.html using your default browser. The documents must have been built first.
- build-open-docs: A task to build and then open the docs. In Visual Studio Code go to “Tasks->Run Task” and select the build-open-docs task. That should build the docs and then open the index.html using your default browser.
keybindings.json: contains some bindings that help you build and open the docs. If you want to use them you have to go to “File->Preferences->Keyboard Shortcuts” then on the top left you will see a message saying “For advanced customizations open and edit the keybindings.json”. Select the link under keybindings.json and edit the file to add the contents from the this file. This will add 4 keybindings:
- shift+f5 : opens the run task menu;
- f6 : runs the build task;
- f5 : runs the build-open-docs task;
- f10 : runs the open-docs task.
Once you have installed Visual Studio code and the recommended extensions you can edit and build the docs by going to “File->Open Folder” and choosing the “/Docs/source” directory. If you do not open the source folder the build task will fail to run.