Agda-2.6.4: A dependently typed functional programming language and proof assistant
Safe HaskellSafe-Inferred
LanguageHaskell2010

Agda.Interaction.Library.Base

Description

Basic data types for library management.

Synopsis

Documentation

type LibName = String Source #

A symbolic library name.

data LibrariesFile Source #

Constructors

LibrariesFile 

Fields

  • lfPath :: FilePath

    E.g. ~.agdalibraries.

  • lfExists :: Bool

    The libraries file might not exist, but we may print its assumed location in error messages.

Instances

Instances details
Show LibrariesFile Source # 
Instance details

Defined in Agda.Interaction.Library.Base

Methods

showsPrec :: Int -> LibrariesFile -> ShowS

show :: LibrariesFile -> String

showList :: [LibrariesFile] -> ShowS

type ExeName = Text Source #

A symbolic executable name.

data ExecutablesFile Source #

Constructors

ExecutablesFile 

Fields

  • efPath :: FilePath

    E.g. ~.agdaexecutables.

  • efExists :: Bool

    The executables file might not exist, but we may print its assumed location in error messages.

Instances

Instances details
EmbPrj ExecutablesFile Source # 
Instance details

Defined in Agda.TypeChecking.Serialise.Instances.Errors

Generic ExecutablesFile Source # 
Instance details

Defined in Agda.Interaction.Library.Base

Associated Types

type Rep ExecutablesFile :: Type -> Type

Show ExecutablesFile Source # 
Instance details

Defined in Agda.Interaction.Library.Base

Methods

showsPrec :: Int -> ExecutablesFile -> ShowS

show :: ExecutablesFile -> String

showList :: [ExecutablesFile] -> ShowS

NFData ExecutablesFile Source # 
Instance details

Defined in Agda.Interaction.Library.Base

Methods

rnf :: ExecutablesFile -> ()

type Rep ExecutablesFile Source # 
Instance details

Defined in Agda.Interaction.Library.Base

type Rep ExecutablesFile = D1 ('MetaData "ExecutablesFile" "Agda.Interaction.Library.Base" "Agda-2.6.4-inplace" 'False) (C1 ('MetaCons "ExecutablesFile" 'PrefixI 'True) (S1 ('MetaSel ('Just "efPath") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath) :*: S1 ('MetaSel ('Just "efExists") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))

libNameForCurrentDir :: LibName Source #

The special name "." is used to indicated that the current directory should count as a project root.

data ProjectConfig Source #

A file can either belong to a project located at a given root containing one or more .agda-lib files, or be part of the default project.

Constructors

ProjectConfig 

Fields

DefaultProjectConfig 

Instances

Instances details
Generic ProjectConfig Source # 
Instance details

Defined in Agda.Interaction.Library.Base

Associated Types

type Rep ProjectConfig :: Type -> Type

NFData ProjectConfig Source # 
Instance details

Defined in Agda.Interaction.Library.Base

Methods

rnf :: ProjectConfig -> ()

type Rep ProjectConfig Source # 
Instance details

Defined in Agda.Interaction.Library.Base

type Rep ProjectConfig = D1 ('MetaData "ProjectConfig" "Agda.Interaction.Library.Base" "Agda-2.6.4-inplace" 'False) (C1 ('MetaCons "ProjectConfig" 'PrefixI 'True) (S1 ('MetaSel ('Just "configRoot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath) :*: (S1 ('MetaSel ('Just "configAgdaLibFiles") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [FilePath]) :*: S1 ('MetaSel ('Just "configAbove") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int))) :+: C1 ('MetaCons "DefaultProjectConfig" 'PrefixI 'False) (U1 :: Type -> Type))

data OptionsPragma Source #

The options from an OPTIONS pragma (or a .agda-lib file).

In the future it might be nice to switch to a more structured representation. Note that, currently, there is not a one-to-one correspondence between list elements and options.

Constructors

OptionsPragma 

Fields

Instances

Instances details
EmbPrj OptionsPragma Source # 
Instance details

Defined in Agda.TypeChecking.Serialise.Instances.Common

Methods

icode :: OptionsPragma -> S Int32 Source #

icod_ :: OptionsPragma -> S Int32 Source #

value :: Int32 -> R OptionsPragma Source #

Monoid OptionsPragma Source # 
Instance details

Defined in Agda.Interaction.Library.Base

Semigroup OptionsPragma Source # 
Instance details

Defined in Agda.Interaction.Library.Base

Show OptionsPragma Source # 
Instance details

Defined in Agda.Interaction.Library.Base

Methods

showsPrec :: Int -> OptionsPragma -> ShowS

show :: OptionsPragma -> String

showList :: [OptionsPragma] -> ShowS

NFData OptionsPragma Source #

Ranges are not forced.

Instance details

Defined in Agda.Interaction.Library.Base

Methods

rnf :: OptionsPragma -> ()

data AgdaLibFile Source #

Content of a .agda-lib file.

Constructors

AgdaLibFile 

Fields

Instances

Instances details
Generic AgdaLibFile Source # 
Instance details

Defined in Agda.Interaction.Library.Base

Associated Types

type Rep AgdaLibFile :: Type -> Type

Methods

from :: AgdaLibFile -> Rep AgdaLibFile x

to :: Rep AgdaLibFile x -> AgdaLibFile

Show AgdaLibFile Source # 
Instance details

Defined in Agda.Interaction.Library.Base

Methods

showsPrec :: Int -> AgdaLibFile -> ShowS

show :: AgdaLibFile -> String

showList :: [AgdaLibFile] -> ShowS

NFData AgdaLibFile Source # 
Instance details

Defined in Agda.Interaction.Library.Base

Methods

rnf :: AgdaLibFile -> ()

type Rep AgdaLibFile Source # 
Instance details

Defined in Agda.Interaction.Library.Base

type Rep AgdaLibFile = D1 ('MetaData "AgdaLibFile" "Agda.Interaction.Library.Base" "Agda-2.6.4-inplace" 'False) (C1 ('MetaCons "AgdaLibFile" 'PrefixI 'True) ((S1 ('MetaSel ('Just "_libName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LibName) :*: (S1 ('MetaSel ('Just "_libFile") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath) :*: S1 ('MetaSel ('Just "_libAbove") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int))) :*: (S1 ('MetaSel ('Just "_libIncludes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [FilePath]) :*: (S1 ('MetaSel ('Just "_libDepends") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [LibName]) :*: S1 ('MetaSel ('Just "_libPragmas") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 OptionsPragma)))))

libName :: Lens' AgdaLibFile LibName Source #

Lenses for AgdaLibFile

Library warnings and errors

Position information

type LineNumber = Int Source #

data LibPositionInfo Source #

Information about which .agda-lib file we are reading and from where in the libraries file it came from.

Constructors

LibPositionInfo 

Fields

Instances

Instances details
EmbPrj LibPositionInfo Source # 
Instance details

Defined in Agda.TypeChecking.Serialise.Instances.Errors

Generic LibPositionInfo Source # 
Instance details

Defined in Agda.Interaction.Library.Base

Associated Types

type Rep LibPositionInfo :: Type -> Type

Show LibPositionInfo Source # 
Instance details

Defined in Agda.Interaction.Library.Base

Methods

showsPrec :: Int -> LibPositionInfo -> ShowS

show :: LibPositionInfo -> String

showList :: [LibPositionInfo] -> ShowS

NFData LibPositionInfo Source # 
Instance details

Defined in Agda.Interaction.Library.Base

Methods

rnf :: LibPositionInfo -> ()

type Rep LibPositionInfo Source # 
Instance details

Defined in Agda.Interaction.Library.Base

type Rep LibPositionInfo = D1 ('MetaData "LibPositionInfo" "Agda.Interaction.Library.Base" "Agda-2.6.4-inplace" 'False) (C1 ('MetaCons "LibPositionInfo" 'PrefixI 'True) (S1 ('MetaSel ('Just "libFilePos") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe FilePath)) :*: (S1 ('MetaSel ('Just "lineNumPos") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LineNumber) :*: S1 ('MetaSel ('Just "filePos") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath))))

Warnings

data LibWarning Source #

Constructors

LibWarning (Maybe LibPositionInfo) LibWarning' 

Instances

Instances details
Pretty LibWarning Source # 
Instance details

Defined in Agda.Interaction.Library.Base

EmbPrj LibWarning Source # 
Instance details

Defined in Agda.TypeChecking.Serialise.Instances.Errors

Methods

icode :: LibWarning -> S Int32 Source #

icod_ :: LibWarning -> S Int32 Source #

value :: Int32 -> R LibWarning Source #

Generic LibWarning Source # 
Instance details

Defined in Agda.Interaction.Library.Base

Associated Types

type Rep LibWarning :: Type -> Type

Methods

from :: LibWarning -> Rep LibWarning x

to :: Rep LibWarning x -> LibWarning

Show LibWarning Source # 
Instance details

Defined in Agda.Interaction.Library.Base

Methods

showsPrec :: Int -> LibWarning -> ShowS

show :: LibWarning -> String

showList :: [LibWarning] -> ShowS

NFData LibWarning Source # 
Instance details

Defined in Agda.Interaction.Library.Base

Methods

rnf :: LibWarning -> ()

type Rep LibWarning Source # 
Instance details

Defined in Agda.Interaction.Library.Base

type Rep LibWarning = D1 ('MetaData "LibWarning" "Agda.Interaction.Library.Base" "Agda-2.6.4-inplace" 'False) (C1 ('MetaCons "LibWarning" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe LibPositionInfo)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LibWarning')))

data LibWarning' Source #

Library Warnings.

Constructors

UnknownField String 

Instances

Instances details
Pretty LibWarning' Source # 
Instance details

Defined in Agda.Interaction.Library.Base

EmbPrj LibWarning' Source # 
Instance details

Defined in Agda.TypeChecking.Serialise.Instances.Errors

Methods

icode :: LibWarning' -> S Int32 Source #

icod_ :: LibWarning' -> S Int32 Source #

value :: Int32 -> R LibWarning' Source #

Generic LibWarning' Source # 
Instance details

Defined in Agda.Interaction.Library.Base

Associated Types

type Rep LibWarning' :: Type -> Type

Methods

from :: LibWarning' -> Rep LibWarning' x

to :: Rep LibWarning' x -> LibWarning'

Show LibWarning' Source # 
Instance details

Defined in Agda.Interaction.Library.Base

Methods

showsPrec :: Int -> LibWarning' -> ShowS

show :: LibWarning' -> String

showList :: [LibWarning'] -> ShowS

NFData LibWarning' Source # 
Instance details

Defined in Agda.Interaction.Library.Base

Methods

rnf :: LibWarning' -> ()

type Rep LibWarning' Source # 
Instance details

Defined in Agda.Interaction.Library.Base

type Rep LibWarning' = D1 ('MetaData "LibWarning'" "Agda.Interaction.Library.Base" "Agda-2.6.4-inplace" 'False) (C1 ('MetaCons "UnknownField" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))

Errors

data LibError' Source #

Collected errors while processing library files.

Constructors

LibrariesFileNotFound FilePath

The user specified replacement for the default libraries file does not exist.

LibNotFound LibrariesFile LibName

Raised when a library name could not successfully be resolved to an .agda-lib file.

AmbiguousLib LibName [AgdaLibFile]

Raised when a library name is defined in several .agda-lib files.

LibParseError LibParseError

The .agda-lib file could not be parsed.

ReadError

An I/O Error occurred when reading a file.

Fields

  • IOException

    The caught exception

  • String

    Explanation when this error occurred.

DuplicateExecutable

The executables file contains duplicate entries.

Fields

  • FilePath

    Name of the executables file.

  • Text

    Name of the executable that is defined twice.

  • (List2 (LineNumber, FilePath))

    The resolutions of the executable. deriving (Show)

Instances

Instances details
Pretty LibError' Source #

Pretty-print library management error without position info.

Instance details

Defined in Agda.Interaction.Library.Base

data LibParseError Source #

Exceptions thrown by the .agda-lib parser.

Constructors

BadLibraryName String

An invalid library name, e.g., containing spaces.

ReadFailure FilePath IOException

I/O error while reading file.

MissingFields (List1 String)

Missing these mandatory fields.

DuplicateFields (List1 String)

These fields occur each more than once.

MissingFieldName LineNumber

At the given line number, a field name is missing before the :.

BadFieldName LineNumber String

At the given line number, an invalid field name is encountered before the :. (E.g., containing spaces.)

MissingColonForField LineNumber String

At the given line number, the given field is not followed by :.

ContentWithoutField LineNumber

At the given line number, indented text (content) is not preceded by a field.

Instances

Instances details
Pretty LibParseError Source #

Print library file parse error without position info.

Instance details

Defined in Agda.Interaction.Library.Base

Raising warnings and errors

type LibErrWarns = [Either LibError LibWarning] Source #

Collection of LibErrors and LibWarnings.

warnings :: MonadWriter LibErrWarns m => List1 LibWarning -> m () Source #

warnings' :: MonadWriter LibErrWarns m => List1 LibWarning' -> m () Source #

raiseErrors' :: MonadWriter LibErrWarns m => List1 LibError' -> m () Source #

raiseErrors :: MonadWriter LibErrWarns m => List1 LibError -> m () Source #

Library Monad

type LibErrorIO = WriterT LibErrWarns (StateT LibState IO) Source #

Collects LibErrors and LibWarnings.

type LibM = ExceptT Doc (WriterT [LibWarning] (StateT LibState IO)) Source #

Throws Doc exceptions, still collects LibWarnings.

type LibState = (Map FilePath ProjectConfig, Map FilePath AgdaLibFile) Source #

Cache locations of project configurations and parsed .agda-lib files.

getCachedProjectConfig :: (MonadState LibState m, MonadIO m) => FilePath -> m (Maybe ProjectConfig) Source #

storeCachedProjectConfig :: (MonadState LibState m, MonadIO m) => FilePath -> ProjectConfig -> m () Source #

getCachedAgdaLibFile :: (MonadState LibState m, MonadIO m) => FilePath -> m (Maybe AgdaLibFile) Source #

storeCachedAgdaLibFile :: (MonadState LibState m, MonadIO m) => FilePath -> AgdaLibFile -> m () Source #

Prettyprinting errors and warnings

hasLineNumber :: LibParseError -> Maybe LineNumber Source #

Does a parse error contain a line number?

formatLibPositionInfo :: LibPositionInfo -> LibParseError -> Doc Source #

Compute a position position prefix.

Depending on the error to be printed, it will

  • either give the name of the libraries file and a line inside it,
  • or give the name of the .agda-lib file.