Friadne 1.0.3

dotnet add package Friadne --version 1.0.3
                    
NuGet\Install-Package Friadne -Version 1.0.3
                    
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="Friadne" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Friadne" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="Friadne" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Friadne --version 1.0.3
                    
#r "nuget: Friadne, 1.0.3"
                    
#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.
#:package Friadne@1.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Friadne&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=Friadne&version=1.0.3
                    
Install as a Cake Tool

Friadne: A Compiler Diagnostic Library for F#

screenshot

How to Use

  1. Define a Location: Specify the file and the primary range for the diagnostic.
  2. Create a Diagnostic: Use Diagnostics.createError, Diagnostics.createWarning, etc.
  3. Add Annotations: Use Diagnostics.withAnnotation to highlight specific code segments within the diagnostic's range and provide messages for them. Annotations can have their own severity level, influencing their color.
  4. Add Notes and Help: Use Diagnostics.withNote and Diagnostics.withHelp for additional information.
  5. Render or Print: Use Diagnostics.render to get the string representation or Diagnostics.print to output directly to the console.

Example:

Here's how you might define an error diagnostic with multiple annotations on a single line and a note:

open Friadne

// Assuming 'demo.fsx' is the file being analyzed
let location =
    { FileName = "demo.fsx"
      Range =
        { Start = { Line = 7; Column = 20 } // Primary range for the error
          End = { Line = 7; Column = 30 } } }

let diagnostic =
    Diagnostics.createError "FS" 0001 "Type error" location
    |> Diagnostics.withAnnotation
        { Start = { Line = 7; Column = 20 } // First annotation
          End = { Line = 7; Column = 29 } }
        "This expression was expected to have type 'a array"
        DiagnosticLevel.Info // Annotations can have their own level for styling
    |> Diagnostics.withAnnotation
        { Start = { Line = 7; Column = 30 } // Second annotation
          End = { Line = 7; Column = 30 } }
        "but here has type 'a list"
        DiagnosticLevel.Info
    |> Diagnostics.withNote "Incompatible types"

// To print to console:
// Diagnostics.print diagnostic

// To get as a string:
// let outputString = Diagnostics.render diagnostic

Running the Demo Project

To see Friadne in action with more examples, you can run the test project:

dotnet run --project Friadne.Test -- demo.fsx

LICENSE

Copyright (c) 2025 Somhairle H. Marisol

All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright notice,
      this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
    * Neither the name of Fringer nor the names of its contributors
      may be used to endorse or promote products derived from this software
      without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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.3 189 8/22/2025