Simplee.IO 1.0.7

There is a newer version of this package available.
See the version list below for details.
dotnet add package Simplee.IO --version 1.0.7
NuGet\Install-Package Simplee.IO -Version 1.0.7
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Simplee.IO" Version="1.0.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Simplee.IO --version 1.0.7
#r "nuget: Simplee.IO, 1.0.7"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Simplee.IO as a Cake Addin
#addin nuget:?package=Simplee.IO&version=1.0.7

// Install Simplee.IO as a Cake Tool
#tool nuget:?package=Simplee.IO&version=1.0.7

Koio |> Simple.IO

Library Simplee.IO v1.0.7 implements common IO functionality used by all other Simple projects. The namespace of the library is Simplee.IO.

Here is the main functionality exposed:

  1. io monad
  2. stdio operations

1. IO Monad

The library exposes a monad for IO. The main functions you can use are iorun which executes an IO flow, iobind which binds an IO monad to a given function. The library exposes a computation buildel, io, which can be used for imperative programing style.

    let flow =  io {
        let! _ = putStrLn "Introduce line 1:"
        let! cs1 = getLine

        let! _ = putStrLn "Introduce line 2:"
        let! cs2 = getLine

        let! _ = putStrLn "You typed:"
        return! putStrLn cs1
        return! putStrLn cs2
        }

    flow |> iorun

2. stdio Operations

As you could see in the above example, the library exposes several convenience methods that allows you to interact with the stdio. All these functions are build on top of the IO monad.

For writing to the stdio, you can use: putChar, putStr, putStrLn. To get the input from stdio, you can use: getChar, getLine, getContent (this last function reads the stdio till the end).

    let lines (s:string) = s.Split([|stdout.NewLine|], StringSplitOptions.None) |> Seq.ofArray
    let length xs = Seq.length xs

    let flow1 =  io {
        let! _ = putStrLn "Introduce line 1:"
        let! cs1 = getLine

        let! _ = putStrLn "Introduce line 2:"
        let! cs2 = getLine

        let! _ = putStrLn "You typed:"
        return! putStrLn cs1
        return! putStrLn cs2
        }

    let flow2 = io {
        let! _ = putStrLn "Test contents:"
        let! cs = getContents
        return! putStr cs
        }

    let flow3 = io {
        let! cs = getContents
        return! cs |> lines |> length |> print
        }

A. Installation

You can install the Simplee.IO nuget package by using one of the following commands:

PM> Install-Package Simplee.IO -Version 1.0.7
> dotnet add package Simplee.IO --version 1.0.7
> paket add Simplee.IO --version 1.0.7
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 is compatible.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.50 1,144 5/30/2018
1.0.8 952 3/14/2018
1.0.7 938 3/2/2018
1.0.6 983 3/2/2018
1.0.5 955 3/2/2018
1.0.4 932 3/2/2018
1.0.3 932 3/1/2018
1.0.2 946 2/27/2018
1.0.1 948 2/27/2018
1.0.0 950 2/26/2018

Added the IO monad and stdin and stdout operations.