cabal-plan-0.1.1.0: Library and utiltity for processing cabal's plan.json file

Safe HaskellNone
LanguageHaskell2010

Cabal.Plan

Contents

Description

Utilities for reading cabal's plan.json file

plan.json are generated when using cabal Nix-style Local Builds.

Synopsis

Documentation

data PlanJson Source #

Represents the information contained in cabal's plan.json file.

This comprises basic information describing the environment as well as the install/build plan computed by cabal.

Constructors

PlanJson 

Fields

data Unit Source #

Represents a build-plan unit uniquely identified by its UnitId

Constructors

Unit 

Fields

data CompInfo Source #

Describes component-specific information inside a Unit

Constructors

CompInfo 

Fields

data UnitType Source #

Describes kind of build unit and its provenance

Constructors

UnitTypeBuiltin

Lives in global (non-nix-style) package db

UnitTypeGlobal

Lives in Nix-store cache

UnitTypeLocal

Local package

UnitTypeInplace

Local in-place package

Basic types

newtype Ver Source #

Equivalent to Cabal's Distribution.Package.Version

Constructors

Ver [Int] 

Instances

Eq Ver Source # 

Methods

(==) :: Ver -> Ver -> Bool #

(/=) :: Ver -> Ver -> Bool #

Ord Ver Source # 

Methods

compare :: Ver -> Ver -> Ordering #

(<) :: Ver -> Ver -> Bool #

(<=) :: Ver -> Ver -> Bool #

(>) :: Ver -> Ver -> Bool #

(>=) :: Ver -> Ver -> Bool #

max :: Ver -> Ver -> Ver #

min :: Ver -> Ver -> Ver #

Show Ver Source # 

Methods

showsPrec :: Int -> Ver -> ShowS #

show :: Ver -> String #

showList :: [Ver] -> ShowS #

ToJSON Ver Source # 
FromJSON Ver Source # 

dispVer :: Ver -> Text Source #

Pretty print Ver

dispPkgId :: PkgId -> Text Source #

Pretty print PkgId

newtype Sha256 Source #

SHA-256 hash

As an invariant, the wrapped ByteString is exactly 32 bytes long.

Constructors

Sha256 ByteString 

dispSha256 :: Sha256 -> Text Source #

Pretty print Sha256 as base-16

Utilities

planJsonIdGraph :: PlanJson -> Map UnitId (Set UnitId) Source #

Extract directed UnitId dependency graph edges from pjUnits

This graph contains both, library and executable dependencies edges

planJsonIdRoots :: PlanJson -> Set UnitId Source #

Extract UnitId root nodes from dependency graph computed by planJsonIdGraph

Convenience functions

findAndDecodePlanJson :: IO (PlanJson, FilePath) Source #

Locates and decodes plan.json for cabal project being in scope for current working directory

The folder assumed to be the project-root is returned as well.

Throws IO exceptions on errors.

decodePlanJson :: FilePath -> IO PlanJson Source #

Decodes plan.json file location provided as FilePath

This is a trivial convenience function so that the caller doesn't have to depend on aeson directly

Throws IO exceptions on errors.