vabal-lib-2.0.0: Core algorithms and datatypes used by vabal

GhcDatabase

Description

This module contains the GhcDatabase, which is a Map-like type associating to each ghc version its GhcMetadata informations, and utility functions to to manipulate and query it.

Synopsis

# Documentation

Metadata associated to a GHC version

Constructors

 GhcMetadata FieldsbaseVersion :: Versionbase version supported by this GHCminCabalVersion :: Versionminimum version of Cabal that supports this GHC

Map associating to each GHC version its GhcMetadata

# Conversion from/to List

O(n*log n). Create a GhcDatabase from a list key-value pairs.

The key is the ghc version, the value is the GhcMetadata for that version

O(n). Convert the GhcDatabase to a list of key-value pairs

O(n). Get all ghc versions contained in the database

# Queries

O(1). Check whether the GhcDatabase is empty

O(log n). Get GhcMetadata for a GHC version, if it's in the database

O(log n). Get base version for a GHC version, if it's in the database

O(log n). Get Supported Cabal version range for a GHC version, if it's in the databasr

O(log n). Check whether the database contains a GHC version

O(log n). Get newest GHC (and its metadata) found in the database

# Parse from CSV file

Parse a GhcDatabase from a csv string. The format of the csv string must be the following:

The first line is the header, it is expected to contain these three columns: ghcVersion, baseVersion, minCabalVersion Each line must at least contain values for those three columns.

A simple example:

ghcVersion,baseVersion,minCabalVersion
8.6.3,4.12.0.0,2.4

# Filter database entries

O(m*log(nm + 1)), m <= n/. Get a restricted database with only a set of GHC versions

O(m*log(nm + 1)), m <= n/. Exclude all ghc versions in the set from the database

O(n). Filter database entries with base version in the given VersionRange

O(n). Filter database entries with supported Cabal version range in the given VersionRange