Simplee.IO
1.0.1
See the version list below for details.
dotnet add package Simplee.IO --version 1.0.1
NuGet\Install-Package Simplee.IO -Version 1.0.1
<PackageReference Include="Simplee.IO" Version="1.0.1" />
paket add Simplee.IO --version 1.0.1
#r "nuget: Simplee.IO, 1.0.1"
// Install Simplee.IO as a Cake Addin #addin nuget:?package=Simplee.IO&version=1.0.1 // Install Simplee.IO as a Cake Tool #tool nuget:?package=Simplee.IO&version=1.0.1
Koio |> Simple.IO
Library Simplee.IO v1.0.1 implements common IO functionality used by all other Simple projects. The namespace of the library is Simplee.IO.
open Simplee.IO
Here is the main functionality exposed:
- Stack free monad
1. Stack free monad and computation expression
The library exposes a free monad ofr stack operations which can be interpreted by writing the push, pop, peek, and pur functions. You can use the stk computation expression in order to generate flows which operate on the stack.
let flow = stk {
let! _ = stkpush 10
let! r = stkpop ()
let! _ = stkpeek ()
return r
}
The library exposes a lister for stk flows:
flow
|> stklst (fun () -> 10)
|> List.iter (lstrln2str >> printfn "%s")
The library also provides an in-memory stack implementation which can execute flows:
flow
|> stkimrun (stkimEU ()) // start with an empty stack, without upper limit
|> fst
|> printfn "Stack: %O"
There are several convenience function which can create an in-memory stack: stkimEU, stkimE, stkimA where you can set the upper limit of the stack and/or the initial values in the stack.
Here is an example of the implementation for the push, pop, peek, and pur functions:
let private push (SLister (ln, _, _) as s) v =
(ln, "psh", v |> sprintf "%A")
|> SLstrLn
|> lstappnd s,
() |> Ok
let private pop getv (SLister (ln, _, _) as s) =
(ln, "pop", "")
|> SLstrLn
|> lstappnd s,
() |> getv |> Ok
let private peek getv (SLister (ln, _, _) as s) =
(ln, "pek", "")
|> SLstrLn
|> lstappnd s,
() |> getv |> Ok
let private pur (SLister (ln, _, _) as s) v =
(ln, "pur", v |> sprintf "%A")
|> SLstrLn
|> lstappnd s,
v |> Ok
2. Installation
You can install the Simplee.IO nuget package by using one of the following commands:
PM> Install-Package Simplee.IO -Version 1.0.0
> dotnet add package Simplee.IO --version 1.0.0
> paket add Simplee.IO --version 1.0.0
Product | Versions 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. |
-
.NETCoreApp 2.0
- FSharp.Core (>= 4.3.4)
- Simplee.Common (>= 1.0.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Added an in-memory stack and started using the SError from Simplee.Common package