Skip to main content

An F# library that provides an easy way to write code that writes code

Total Downloads
1.6K
1,577
Published
Nov 15, 2024
2y ago

Get Started

dotnet add package StringBuffer --version 1.0.2
ProductVersions
.NET
net6.0

README

StringBuffer

An F# computation expression for writing code with code


Builds

GitHub Actions
GitHub Actions
Build History

NuGet

Package Stable Prerelease
StringBuffer NuGet Badge NuGet Badge

Using

Install the latest version from https://www.nuget.org/packages/StringBuffer/

Then use stringBuffer and indent to write your code that writes code.

stringBuffer {
    "let square x ="
    indent {
        "x * x"
    }
}

stringBuffer and indent can both be nested in each other and will correctly produce output indented as expected.

let namespaces = seq {
    "System"
    "System.IO"
}

let formattedCode = stringBuffer {
    namespaces |> Seq.map (fun ns -> "open " + ns)

    ""
    "module MyModule"
    indent {
        "let LifeUniverseAndEverything () ="
        indent {
            "42"
        }
    }
}
open System
open System.IO

module MyModule
    let LifeUniverseAndEverything () =
        42

Developing

Make sure the following requirements are installed on your system:

or

Downloads by Version

Similar & Alternative Packages

Hand-picked matching NuGet libraries based on tags & ecosystem

Depended On By

Find packages that declare this package as a dependency. NuGet does not provide a reverse-dependency endpoint, so candidates are checked on demand.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

No SPDX license expression is published. Review the license text and your organisation's policy before redistribution.Compatibility metadata lists 1 target framework; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.