packages feed

Agda 2.6.2 → 2.6.2.1

raw patch · 140 files changed

+5089/−5041 lines, 140 filesdep ~aesondep ~basedep ~bytestringPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: aeson, base, bytestring, directory, equivalence, hashable, hashtables, mtl, template-haskell, text, time, transformers

API changes (from Hackage documentation)

- Agda.Auto.CaseSplit: type family UnifiesTo t;
- Agda.Auto.NarrowingSearch: type family Block a;
- Agda.Compiler.JS.Compiler: cubicalPrimitives :: Set String
- Agda.Compiler.JS.Compiler: type JSModuleEnv = Maybe CoinductionKit
- Agda.Compiler.MAlonzo.Compiler: GHCCompileEnv :: GHCOptions -> GHCCompileEnv
- Agda.Compiler.MAlonzo.Compiler: GHCModuleEnv :: GHCCompileEnv -> HsModuleEnv -> GHCModuleEnv
- Agda.Compiler.MAlonzo.Compiler: GHCOptions :: Bool -> FilePath -> [String] -> FilePath -> GHCOptions
- Agda.Compiler.MAlonzo.Compiler: [ghcCompileEnvOpts] :: GHCCompileEnv -> GHCOptions
- Agda.Compiler.MAlonzo.Compiler: [ghcModCompileEnv] :: GHCModuleEnv -> GHCCompileEnv
- Agda.Compiler.MAlonzo.Compiler: [ghcModEnv] :: GHCModule -> GHCModuleEnv
- Agda.Compiler.MAlonzo.Compiler: [ghcModHsModuleEnv] :: GHCModuleEnv -> HsModuleEnv
- Agda.Compiler.MAlonzo.Compiler: [optGhcBin] :: GHCOptions -> FilePath
- Agda.Compiler.MAlonzo.Compiler: [optGhcCallGhc] :: GHCOptions -> Bool
- Agda.Compiler.MAlonzo.Compiler: [optGhcCompileDir] :: GHCOptions -> FilePath
- Agda.Compiler.MAlonzo.Compiler: [optGhcFlags] :: GHCOptions -> [String]
- Agda.Compiler.MAlonzo.Compiler: data GHCCompileEnv
- Agda.Compiler.MAlonzo.Compiler: data GHCModuleEnv
- Agda.Compiler.MAlonzo.Compiler: data GHCOptions
- Agda.Compiler.MAlonzo.Compiler: instance GHC.Base.Monad m => Agda.Compiler.MAlonzo.Compiler.ReadGHCOpts (Control.Monad.Trans.Reader.ReaderT Agda.Compiler.MAlonzo.Compiler.GHCCompileEnv m)
- Agda.Compiler.MAlonzo.Compiler: instance GHC.Base.Monad m => Agda.Compiler.MAlonzo.Compiler.ReadGHCOpts (Control.Monad.Trans.Reader.ReaderT Agda.Compiler.MAlonzo.Compiler.GHCModuleEnv m)
- Agda.Compiler.MAlonzo.Compiler: instance GHC.Base.Monad m => Agda.Compiler.MAlonzo.Compiler.ReadGHCOpts (Control.Monad.Trans.Reader.ReaderT Agda.Compiler.MAlonzo.Compiler.GHCOptions m)
- Agda.Compiler.MAlonzo.Compiler: instance GHC.Base.Monad m => Agda.Compiler.MAlonzo.Misc.ReadHsModuleEnv (Control.Monad.Trans.Reader.ReaderT Agda.Compiler.MAlonzo.Compiler.GHCModule m)
- Agda.Compiler.MAlonzo.Compiler: instance GHC.Base.Monad m => Agda.Compiler.MAlonzo.Misc.ReadHsModuleEnv (Control.Monad.Trans.Reader.ReaderT Agda.Compiler.MAlonzo.Compiler.GHCModuleEnv m)
- Agda.Compiler.MAlonzo.Misc: class Monad m => ReadHsModuleEnv m
- Agda.Compiler.MAlonzo.Misc: instance Agda.Compiler.MAlonzo.Misc.ReadHsModuleEnv m => Agda.Compiler.MAlonzo.Misc.ReadHsModuleEnv (Control.Monad.Trans.Except.ExceptT e m)
- Agda.Compiler.MAlonzo.Misc: instance Agda.Compiler.MAlonzo.Misc.ReadHsModuleEnv m => Agda.Compiler.MAlonzo.Misc.ReadHsModuleEnv (Control.Monad.Trans.Identity.IdentityT m)
- Agda.Compiler.MAlonzo.Misc: instance Agda.Compiler.MAlonzo.Misc.ReadHsModuleEnv m => Agda.Compiler.MAlonzo.Misc.ReadHsModuleEnv (Control.Monad.Trans.Maybe.MaybeT m)
- Agda.Compiler.MAlonzo.Misc: instance Agda.Compiler.MAlonzo.Misc.ReadHsModuleEnv m => Agda.Compiler.MAlonzo.Misc.ReadHsModuleEnv (Control.Monad.Trans.State.Lazy.StateT s m)
- Agda.Compiler.MAlonzo.Misc: instance GHC.Base.Monad m => Agda.Compiler.MAlonzo.Misc.ReadHsModuleEnv (Control.Monad.Trans.Reader.ReaderT Agda.Compiler.MAlonzo.Misc.HsModuleEnv m)
- Agda.Compiler.MAlonzo.Misc: mazIncompleteMatch :: Exp
- Agda.Compiler.MAlonzo.Misc: rtmIncompleteMatch :: QName -> Exp
- Agda.Syntax.Abstract: Tactic :: ExprInfo -> Expr -> [NamedArg Expr] -> Expr
- Agda.Syntax.Abstract.Pattern: type family ADotT p;
- Agda.Syntax.Common: type family NameOf a;
- Agda.Syntax.Concrete.Definitions.Types: [infixDataCons] :: InterleavedDecl -> Maybe (Int, [[NiceConstructor]])
- Agda.Syntax.Concrete.Definitions.Types: [infixDataSig] :: InterleavedDecl -> (Int, NiceDeclaration)
- Agda.Syntax.Concrete.Definitions.Types: [infixFunClauses] :: InterleavedDecl -> Maybe (Int, [([Declaration], [Clause])])
- Agda.Syntax.Concrete.Definitions.Types: [infixFunSig] :: InterleavedDecl -> (Int, NiceDeclaration)
- Agda.Syntax.Internal: type family PatternVarOut a;
- Agda.Syntax.Internal.Generic: instance Agda.Syntax.Internal.Generic.TermLike GHC.Integer.Type.Integer
- Agda.Syntax.Internal.Pattern: type family PatVar p;
- Agda.Syntax.Position: instance Agda.Syntax.Position.KillRange GHC.Integer.Type.Integer
- Agda.Syntax.Translation.AbstractToConcrete: type family ConOfAbs a;
- Agda.Syntax.Translation.ConcreteToAbstract: type family AbsOfCon c;
- Agda.Syntax.Translation.InternalToAbstract: type family ReifiesTo i;
- Agda.Syntax.Translation.ReflectedToAbstract: type family AbsOfRef r;
- Agda.Termination.Semiring: instance Agda.Termination.Semiring.HasZero GHC.Integer.Type.Integer
- Agda.TypeChecking.Monad.Benchmark: type family BenchPhase m
- Agda.TypeChecking.Primitive: instance Agda.TypeChecking.Primitive.FromTerm GHC.Integer.Type.Integer
- Agda.TypeChecking.Primitive: instance Agda.TypeChecking.Primitive.PrimTerm GHC.Integer.Type.Integer
- Agda.TypeChecking.Primitive: instance Agda.TypeChecking.Primitive.PrimType GHC.Integer.Type.Integer
- Agda.TypeChecking.Primitive: instance Agda.TypeChecking.Primitive.ToTerm GHC.Integer.Type.Integer
- Agda.TypeChecking.Serialise.Instances.Common: instance Agda.TypeChecking.Serialise.Base.EmbPrj GHC.Integer.Type.Integer
- Agda.TypeChecking.SizedTypes.Syntax: type family FlexOf a;
- Agda.TypeChecking.Substitute.Class: type family SubstArg a;
- Agda.TypeChecking.Unquote: instance Agda.TypeChecking.Unquote.Unquote GHC.Integer.Type.Integer
- Agda.Utils.Benchmark: type family BenchPhase m;
- Agda.Utils.BiMap: type family Tag a;
- Agda.Utils.List1: prepend :: [a] -> List1 a -> List1 a
- Agda.Utils.Map: mapMaybeKeys :: (Ord k1, Ord k2) => (k1 -> Maybe k2) -> Map k1 a -> Map k2 a
- Agda.Utils.PartialOrd: instance Agda.Utils.PartialOrd.PartialOrd GHC.Integer.Type.Integer
- Agda.Utils.Pretty: instance Agda.Utils.Pretty.Pretty GHC.Integer.Type.Integer
- Agda.Utils.Zipper: type family Element z;
+ Agda.Auto.CaseSplit: type ReplaceWith t u;
+ Agda.Auto.CaseSplit: type UnifiesTo t;
+ Agda.Auto.NarrowingSearch: type Block a;
+ Agda.Compiler.Backend: [defLanguage] :: Definition -> !Language
+ Agda.Compiler.Backend: addConstant' :: QName -> ArgInfo -> QName -> Type -> Defn -> TCM ()
+ Agda.Compiler.Backend: getLanguage :: HasOptions m => m Language
+ Agda.Compiler.Backend: getOriginalConstInfo :: (ReadTCState m, HasConstInfo m) => QName -> m Definition
+ Agda.Compiler.JS.Compiler: JSModuleEnv :: Maybe CoinductionKit -> Bool -> JSModuleEnv
+ Agda.Compiler.JS.Compiler: [jsCoinductionKit] :: JSModuleEnv -> Maybe CoinductionKit
+ Agda.Compiler.JS.Compiler: [jsCompile] :: JSModuleEnv -> Bool
+ Agda.Compiler.JS.Compiler: data JSModuleEnv
+ Agda.Compiler.MAlonzo.Compiler: [flagGhcStrictData] :: GHCFlags -> Bool
+ Agda.Compiler.MAlonzo.Compiler: [flagGhcStrict] :: GHCFlags -> Bool
+ Agda.Compiler.MAlonzo.Compiler: [ghcModModuleEnv] :: GHCModule -> GHCModuleEnv
+ Agda.Compiler.MAlonzo.Compiler: instance GHC.Base.Monad m => Agda.Compiler.MAlonzo.Compiler.ReadGHCOpts (Control.Monad.Trans.Reader.ReaderT Agda.Compiler.MAlonzo.Misc.GHCEnv m)
+ Agda.Compiler.MAlonzo.Compiler: instance GHC.Base.Monad m => Agda.Compiler.MAlonzo.Compiler.ReadGHCOpts (Control.Monad.Trans.Reader.ReaderT Agda.Compiler.MAlonzo.Misc.GHCModuleEnv m)
+ Agda.Compiler.MAlonzo.Compiler: instance GHC.Base.Monad m => Agda.Compiler.MAlonzo.Compiler.ReadGHCOpts (Control.Monad.Trans.Reader.ReaderT Agda.Compiler.MAlonzo.Misc.GHCOptions m)
+ Agda.Compiler.MAlonzo.Compiler: instance GHC.Base.Monad m => Agda.Compiler.MAlonzo.Misc.ReadGHCModuleEnv (Control.Monad.Trans.Reader.ReaderT Agda.Compiler.MAlonzo.Compiler.GHCModule m)
+ Agda.Compiler.MAlonzo.Misc: A :: VariableKind
+ Agda.Compiler.MAlonzo.Misc: CheckK :: NameKind
+ Agda.Compiler.MAlonzo.Misc: ConK :: NameKind
+ Agda.Compiler.MAlonzo.Misc: CoverK :: NameKind
+ Agda.Compiler.MAlonzo.Misc: FunK :: FunctionKind -> NameKind
+ Agda.Compiler.MAlonzo.Misc: GHCEnv :: GHCOptions -> Maybe QName -> (QName -> Bool) -> GHCEnv
+ Agda.Compiler.MAlonzo.Misc: GHCModuleEnv :: GHCEnv -> HsModuleEnv -> GHCModuleEnv
+ Agda.Compiler.MAlonzo.Misc: GHCOptions :: Bool -> FilePath -> [String] -> FilePath -> Bool -> Bool -> GHCOptions
+ Agda.Compiler.MAlonzo.Misc: NoUnused :: FunctionKind
+ Agda.Compiler.MAlonzo.Misc: PossiblyUnused :: FunctionKind
+ Agda.Compiler.MAlonzo.Misc: TypeK :: NameKind
+ Agda.Compiler.MAlonzo.Misc: V :: VariableKind
+ Agda.Compiler.MAlonzo.Misc: VarK :: VariableKind -> NameKind
+ Agda.Compiler.MAlonzo.Misc: X :: VariableKind
+ Agda.Compiler.MAlonzo.Misc: [ghcEnvBool, ghcEnvTrue, ghcEnvFalse, ghcEnvMaybe, ghcEnvNothing, ghcEnvJust, ghcEnvList, ghcEnvNil, ghcEnvCons, ghcEnvNat, ghcEnvInteger, ghcEnvWord64, ghcEnvInf, ghcEnvSharp, ghcEnvFlat, ghcEnvInterval, ghcEnvIZero, ghcEnvIOne, ghcEnvIsOne, ghcEnvItIsOne, ghcEnvIsOne1, ghcEnvIsOne2, ghcEnvIsOneEmpty, ghcEnvPathP, ghcEnvSub, ghcEnvSubIn, ghcEnvId, ghcEnvConId] :: GHCEnv -> Maybe QName
+ Agda.Compiler.MAlonzo.Misc: [ghcEnvIsTCBuiltin] :: GHCEnv -> QName -> Bool
+ Agda.Compiler.MAlonzo.Misc: [ghcEnvOpts] :: GHCEnv -> GHCOptions
+ Agda.Compiler.MAlonzo.Misc: [ghcModEnv] :: GHCModuleEnv -> GHCEnv
+ Agda.Compiler.MAlonzo.Misc: [ghcModHsModuleEnv] :: GHCModuleEnv -> HsModuleEnv
+ Agda.Compiler.MAlonzo.Misc: [optGhcBin] :: GHCOptions -> FilePath
+ Agda.Compiler.MAlonzo.Misc: [optGhcCallGhc] :: GHCOptions -> Bool
+ Agda.Compiler.MAlonzo.Misc: [optGhcCompileDir] :: GHCOptions -> FilePath
+ Agda.Compiler.MAlonzo.Misc: [optGhcFlags] :: GHCOptions -> [String]
+ Agda.Compiler.MAlonzo.Misc: [optGhcStrictData] :: GHCOptions -> Bool
+ Agda.Compiler.MAlonzo.Misc: [optGhcStrict] :: GHCOptions -> Bool
+ Agda.Compiler.MAlonzo.Misc: askGHCEnv :: ReadGHCModuleEnv m => m GHCEnv
+ Agda.Compiler.MAlonzo.Misc: askGHCModuleEnv :: (ReadGHCModuleEnv m, MonadTrans t, Monad n, m ~ t n, ReadGHCModuleEnv n) => m GHCModuleEnv
+ Agda.Compiler.MAlonzo.Misc: class Monad m => ReadGHCModuleEnv m
+ Agda.Compiler.MAlonzo.Misc: data FunctionKind
+ Agda.Compiler.MAlonzo.Misc: data GHCEnv
+ Agda.Compiler.MAlonzo.Misc: data GHCModuleEnv
+ Agda.Compiler.MAlonzo.Misc: data GHCOptions
+ Agda.Compiler.MAlonzo.Misc: data NameKind
+ Agda.Compiler.MAlonzo.Misc: data VariableKind
+ Agda.Compiler.MAlonzo.Misc: encodeString :: NameKind -> String -> String
+ Agda.Compiler.MAlonzo.Misc: instance Agda.Compiler.MAlonzo.Misc.ReadGHCModuleEnv m => Agda.Compiler.MAlonzo.Misc.ReadGHCModuleEnv (Control.Monad.Trans.Except.ExceptT e m)
+ Agda.Compiler.MAlonzo.Misc: instance Agda.Compiler.MAlonzo.Misc.ReadGHCModuleEnv m => Agda.Compiler.MAlonzo.Misc.ReadGHCModuleEnv (Control.Monad.Trans.Identity.IdentityT m)
+ Agda.Compiler.MAlonzo.Misc: instance Agda.Compiler.MAlonzo.Misc.ReadGHCModuleEnv m => Agda.Compiler.MAlonzo.Misc.ReadGHCModuleEnv (Control.Monad.Trans.Maybe.MaybeT m)
+ Agda.Compiler.MAlonzo.Misc: instance Agda.Compiler.MAlonzo.Misc.ReadGHCModuleEnv m => Agda.Compiler.MAlonzo.Misc.ReadGHCModuleEnv (Control.Monad.Trans.State.Lazy.StateT s m)
+ Agda.Compiler.MAlonzo.Misc: instance GHC.Base.Monad m => Agda.Compiler.MAlonzo.Misc.ReadGHCModuleEnv (Control.Monad.Trans.Reader.ReaderT Agda.Compiler.MAlonzo.Misc.GHCModuleEnv m)
+ Agda.Compiler.MAlonzo.Strict: class MakeStrict a
+ Agda.Compiler.MAlonzo.Strict: instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.Alt
+ Agda.Compiler.MAlonzo.Strict: instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.Binds
+ Agda.Compiler.MAlonzo.Strict: instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.Decl
+ Agda.Compiler.MAlonzo.Strict: instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.Exp
+ Agda.Compiler.MAlonzo.Strict: instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.GuardedRhs
+ Agda.Compiler.MAlonzo.Strict: instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.Match
+ Agda.Compiler.MAlonzo.Strict: instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.Module
+ Agda.Compiler.MAlonzo.Strict: instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.Pat
+ Agda.Compiler.MAlonzo.Strict: instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.Rhs
+ Agda.Compiler.MAlonzo.Strict: instance Agda.Compiler.MAlonzo.Strict.MakeStrict Agda.Utils.Haskell.Syntax.Stmt
+ Agda.Compiler.MAlonzo.Strict: instance Agda.Compiler.MAlonzo.Strict.MakeStrict a => Agda.Compiler.MAlonzo.Strict.MakeStrict (GHC.Maybe.Maybe a)
+ Agda.Compiler.MAlonzo.Strict: instance Agda.Compiler.MAlonzo.Strict.MakeStrict a => Agda.Compiler.MAlonzo.Strict.MakeStrict [a]
+ Agda.Compiler.MAlonzo.Strict: makeStrict :: MakeStrict a => a -> a
+ Agda.Interaction.Base: instance Agda.Utils.Pretty.Pretty Agda.Interaction.Base.CompilerBackend
+ Agda.Interaction.FindFile: instance Agda.Utils.Pretty.Pretty Agda.Interaction.FindFile.InterfaceFile
+ Agda.Interaction.FindFile: instance Agda.Utils.Pretty.Pretty Agda.Interaction.FindFile.SourceFile
+ Agda.Interaction.JSON: (.!=) :: Parser (Maybe a) -> a -> Parser a
+ Agda.Interaction.JSON: (.:!) :: FromJSON a => Object -> Key -> Parser (Maybe a)
+ Agda.Interaction.JSON: (.:) :: FromJSON a => Object -> Key -> Parser a
+ Agda.Interaction.JSON: (.:?) :: FromJSON a => Object -> Key -> Parser (Maybe a)
+ Agda.Interaction.JSON: (.=) :: ToJSON a => Text -> a -> Pair
+ Agda.Interaction.JSON: (<?>) :: Parser a -> JSONPathElement -> Parser a
+ Agda.Interaction.JSON: Array :: !Array -> Value
+ Agda.Interaction.JSON: Bool :: !Bool -> Value
+ Agda.Interaction.JSON: DotNetTime :: UTCTime -> DotNetTime
+ Agda.Interaction.JSON: Null :: Value
+ Agda.Interaction.JSON: Number :: !Scientific -> Value
+ Agda.Interaction.JSON: Object :: !Object -> Value
+ Agda.Interaction.JSON: ObjectWithSingleField :: SumEncoding
+ Agda.Interaction.JSON: String :: !Text -> Value
+ Agda.Interaction.JSON: TaggedObject :: String -> String -> SumEncoding
+ Agda.Interaction.JSON: ToJSONKeyText :: !a -> Key -> !a -> Encoding' Key -> ToJSONKeyFunction a
+ Agda.Interaction.JSON: ToJSONKeyValue :: !a -> Value -> !a -> Encoding -> ToJSONKeyFunction a
+ Agda.Interaction.JSON: TwoElemArray :: SumEncoding
+ Agda.Interaction.JSON: UntaggedValue :: SumEncoding
+ Agda.Interaction.JSON: [FromJSONKeyCoerce] :: forall a. Coercible Text a => FromJSONKeyFunction a
+ Agda.Interaction.JSON: [FromJSONKeyTextParser] :: forall a. !Text -> Parser a -> FromJSONKeyFunction a
+ Agda.Interaction.JSON: [FromJSONKeyText] :: forall a. !Text -> a -> FromJSONKeyFunction a
+ Agda.Interaction.JSON: [FromJSONKeyValue] :: forall a. !Value -> Parser a -> FromJSONKeyFunction a
+ Agda.Interaction.JSON: [contentsFieldName] :: SumEncoding -> String
+ Agda.Interaction.JSON: [fromDotNetTime] :: DotNetTime -> UTCTime
+ Agda.Interaction.JSON: [tagFieldName] :: SumEncoding -> String
+ Agda.Interaction.JSON: camelTo2 :: Char -> String -> String
+ Agda.Interaction.JSON: class FromJSON a
+ Agda.Interaction.JSON: class FromJSON1 (f :: Type -> Type)
+ Agda.Interaction.JSON: class FromJSON2 (f :: Type -> Type -> Type)
+ Agda.Interaction.JSON: class FromJSONKey a
+ Agda.Interaction.JSON: class GFromJSON arity (f :: Type -> Type)
+ Agda.Interaction.JSON: class (ConstructorNames f, SumFromString f) => GFromJSONKey (f :: Type -> Type)
+ Agda.Interaction.JSON: class GToJSON' enc arity (f :: TYPE LiftedRep -> Type)
+ Agda.Interaction.JSON: class GetConName f => GToJSONKey (f :: k -> Type)
+ Agda.Interaction.JSON: class KeyValue kv
+ Agda.Interaction.JSON: class ToJSON a
+ Agda.Interaction.JSON: class ToJSON1 (f :: TYPE LiftedRep -> TYPE LiftedRep)
+ Agda.Interaction.JSON: class ToJSON2 (f :: TYPE LiftedRep -> TYPE LiftedRep -> TYPE LiftedRep)
+ Agda.Interaction.JSON: class ToJSONKey a
+ Agda.Interaction.JSON: data FromArgs arity a
+ Agda.Interaction.JSON: data FromJSONKeyFunction a
+ Agda.Interaction.JSON: data JSONKeyOptions
+ Agda.Interaction.JSON: data Key
+ Agda.Interaction.JSON: data One
+ Agda.Interaction.JSON: data Options
+ Agda.Interaction.JSON: data Series
+ Agda.Interaction.JSON: data SumEncoding
+ Agda.Interaction.JSON: data ToArgs res arity a
+ Agda.Interaction.JSON: data ToJSONKeyFunction a
+ Agda.Interaction.JSON: data Value
+ Agda.Interaction.JSON: data Zero
+ Agda.Interaction.JSON: decode :: FromJSON a => ByteString -> Maybe a
+ Agda.Interaction.JSON: decode' :: FromJSON a => ByteString -> Maybe a
+ Agda.Interaction.JSON: decodeFileStrict :: FromJSON a => FilePath -> IO (Maybe a)
+ Agda.Interaction.JSON: decodeFileStrict' :: FromJSON a => FilePath -> IO (Maybe a)
+ Agda.Interaction.JSON: decodeStrict :: FromJSON a => ByteString -> Maybe a
+ Agda.Interaction.JSON: decodeStrict' :: FromJSON a => ByteString -> Maybe a
+ Agda.Interaction.JSON: defaultJSONKeyOptions :: JSONKeyOptions
+ Agda.Interaction.JSON: defaultOptions :: Options
+ Agda.Interaction.JSON: defaultTaggedObject :: SumEncoding
+ Agda.Interaction.JSON: eitherDecode :: FromJSON a => ByteString -> Either String a
+ Agda.Interaction.JSON: eitherDecode' :: FromJSON a => ByteString -> Either String a
+ Agda.Interaction.JSON: eitherDecodeFileStrict :: FromJSON a => FilePath -> IO (Either String a)
+ Agda.Interaction.JSON: eitherDecodeFileStrict' :: FromJSON a => FilePath -> IO (Either String a)
+ Agda.Interaction.JSON: eitherDecodeStrict :: FromJSON a => ByteString -> Either String a
+ Agda.Interaction.JSON: eitherDecodeStrict' :: FromJSON a => ByteString -> Either String a
+ Agda.Interaction.JSON: encode :: ToJSON a => a -> ByteString
+ Agda.Interaction.JSON: encodeFile :: ToJSON a => FilePath -> a -> IO ()
+ Agda.Interaction.JSON: foldable :: (Foldable t, ToJSON a) => t a -> Encoding
+ Agda.Interaction.JSON: fromEncoding :: Encoding' tag -> Builder
+ Agda.Interaction.JSON: fromJSON :: FromJSON a => Value -> Result a
+ Agda.Interaction.JSON: fromJSONKey :: FromJSONKey a => FromJSONKeyFunction a
+ Agda.Interaction.JSON: fromJSONKeyList :: FromJSONKey a => FromJSONKeyFunction [a]
+ Agda.Interaction.JSON: genericFromJSONKey :: (Generic a, GFromJSONKey (Rep a)) => JSONKeyOptions -> FromJSONKeyFunction a
+ Agda.Interaction.JSON: genericLiftParseJSON :: (Generic1 f, GFromJSON One (Rep1 f)) => Options -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (f a)
+ Agda.Interaction.JSON: genericLiftToEncoding :: (Generic1 f, GToJSON' Encoding One (Rep1 f)) => Options -> (a -> Encoding) -> ([a] -> Encoding) -> f a -> Encoding
+ Agda.Interaction.JSON: genericLiftToJSON :: (Generic1 f, GToJSON' Value One (Rep1 f)) => Options -> (a -> Value) -> ([a] -> Value) -> f a -> Value
+ Agda.Interaction.JSON: genericParseJSON :: (Generic a, GFromJSON Zero (Rep a)) => Options -> Value -> Parser a
+ Agda.Interaction.JSON: genericToEncoding :: (Generic a, GToJSON' Encoding Zero (Rep a)) => Options -> a -> Encoding
+ Agda.Interaction.JSON: genericToJSON :: (Generic a, GToJSON' Value Zero (Rep a)) => Options -> a -> Value
+ Agda.Interaction.JSON: genericToJSONKey :: (Generic a, GToJSONKey (Rep a)) => JSONKeyOptions -> ToJSONKeyFunction a
+ Agda.Interaction.JSON: json :: Parser Value
+ Agda.Interaction.JSON: json' :: Parser Value
+ Agda.Interaction.JSON: liftParseJSON :: FromJSON1 f => (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (f a)
+ Agda.Interaction.JSON: liftParseJSON2 :: FromJSON2 f => (Value -> Parser a) -> (Value -> Parser [a]) -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser (f a b)
+ Agda.Interaction.JSON: liftParseJSONList :: FromJSON1 f => (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [f a]
+ Agda.Interaction.JSON: liftParseJSONList2 :: FromJSON2 f => (Value -> Parser a) -> (Value -> Parser [a]) -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser [f a b]
+ Agda.Interaction.JSON: liftToEncoding :: ToJSON1 f => (a -> Encoding) -> ([a] -> Encoding) -> f a -> Encoding
+ Agda.Interaction.JSON: liftToEncoding2 :: ToJSON2 f => (a -> Encoding) -> ([a] -> Encoding) -> (b -> Encoding) -> ([b] -> Encoding) -> f a b -> Encoding
+ Agda.Interaction.JSON: liftToEncodingList :: ToJSON1 f => (a -> Encoding) -> ([a] -> Encoding) -> [f a] -> Encoding
+ Agda.Interaction.JSON: liftToEncodingList2 :: ToJSON2 f => (a -> Encoding) -> ([a] -> Encoding) -> (b -> Encoding) -> ([b] -> Encoding) -> [f a b] -> Encoding
+ Agda.Interaction.JSON: liftToJSON :: ToJSON1 f => (a -> Value) -> ([a] -> Value) -> f a -> Value
+ Agda.Interaction.JSON: liftToJSON2 :: ToJSON2 f => (a -> Value) -> ([a] -> Value) -> (b -> Value) -> ([b] -> Value) -> f a b -> Value
+ Agda.Interaction.JSON: liftToJSONList :: ToJSON1 f => (a -> Value) -> ([a] -> Value) -> [f a] -> Value
+ Agda.Interaction.JSON: liftToJSONList2 :: ToJSON2 f => (a -> Value) -> ([a] -> Value) -> (b -> Value) -> ([b] -> Value) -> [f a b] -> Value
+ Agda.Interaction.JSON: newtype DotNetTime
+ Agda.Interaction.JSON: object :: [Pair] -> Value
+ Agda.Interaction.JSON: pairs :: Series -> Encoding
+ Agda.Interaction.JSON: parseIndexedJSON :: (Value -> Parser a) -> Int -> Value -> Parser a
+ Agda.Interaction.JSON: parseJSON :: FromJSON a => Value -> Parser a
+ Agda.Interaction.JSON: parseJSON1 :: (FromJSON1 f, FromJSON a) => Value -> Parser (f a)
+ Agda.Interaction.JSON: parseJSON2 :: (FromJSON2 f, FromJSON a, FromJSON b) => Value -> Parser (f a b)
+ Agda.Interaction.JSON: parseJSONList :: FromJSON a => Value -> Parser [a]
+ Agda.Interaction.JSON: toEncoding :: ToJSON a => a -> Encoding
+ Agda.Interaction.JSON: toEncoding1 :: (ToJSON1 f, ToJSON a) => f a -> Encoding
+ Agda.Interaction.JSON: toEncoding2 :: (ToJSON2 f, ToJSON a, ToJSON b) => f a b -> Encoding
+ Agda.Interaction.JSON: toEncodingList :: ToJSON a => [a] -> Encoding
+ Agda.Interaction.JSON: toJSON :: ToJSON a => a -> Value
+ Agda.Interaction.JSON: toJSON1 :: (ToJSON1 f, ToJSON a) => f a -> Value
+ Agda.Interaction.JSON: toJSON2 :: (ToJSON2 f, ToJSON a, ToJSON b) => f a b -> Value
+ Agda.Interaction.JSON: toJSONKey :: ToJSONKey a => ToJSONKeyFunction a
+ Agda.Interaction.JSON: toJSONKeyList :: ToJSONKey a => ToJSONKeyFunction [a]
+ Agda.Interaction.JSON: toJSONList :: ToJSON a => [a] -> Value
+ Agda.Interaction.JSON: type Array = Vector Value
+ Agda.Interaction.JSON: type Encoding = Encoding' Value
+ Agda.Interaction.JSON: type GToEncoding = GToJSON' Encoding
+ Agda.Interaction.JSON: type GToJSON = GToJSON' Value
+ Agda.Interaction.JSON: type JSONPath = [JSONPathElement]
+ Agda.Interaction.JSON: type Object = KeyMap Value
+ Agda.Interaction.JSON: withArray :: String -> (Array -> Parser a) -> Value -> Parser a
+ Agda.Interaction.JSON: withBool :: String -> (Bool -> Parser a) -> Value -> Parser a
+ Agda.Interaction.JSON: withEmbeddedJSON :: String -> (Value -> Parser a) -> Value -> Parser a
+ Agda.Interaction.JSON: withObject :: String -> (Object -> Parser a) -> Value -> Parser a
+ Agda.Interaction.JSON: withScientific :: String -> (Scientific -> Parser a) -> Value -> Parser a
+ Agda.Interaction.JSON: withText :: String -> (Text -> Parser a) -> Value -> Parser a
+ Agda.Interaction.Options.Warnings: MissingDeclarations_ :: WarningName
+ Agda.Syntax.Abstract.Pattern: type ADotT p;
+ Agda.Syntax.Common: CErased :: Cubical
+ Agda.Syntax.Common: CFull :: Cubical
+ Agda.Syntax.Common: Cubical :: Cubical -> Language
+ Agda.Syntax.Common: WithK :: Language
+ Agda.Syntax.Common: WithoutK :: Language
+ Agda.Syntax.Common: data Cubical
+ Agda.Syntax.Common: data Language
+ Agda.Syntax.Common: erasedFromQuantity :: Quantity -> Maybe Erased
+ Agda.Syntax.Common: instance Agda.Syntax.Position.KillRange Agda.Syntax.Common.Language
+ Agda.Syntax.Common: instance Control.DeepSeq.NFData Agda.Syntax.Common.Cubical
+ Agda.Syntax.Common: instance Control.DeepSeq.NFData Agda.Syntax.Common.Language
+ Agda.Syntax.Common: instance GHC.Base.Monoid Agda.Syntax.Common.ExpandedEllipsis
+ Agda.Syntax.Common: instance GHC.Base.Semigroup Agda.Syntax.Common.ExpandedEllipsis
+ Agda.Syntax.Common: instance GHC.Classes.Eq Agda.Syntax.Common.Cubical
+ Agda.Syntax.Common: instance GHC.Classes.Eq Agda.Syntax.Common.Language
+ Agda.Syntax.Common: instance GHC.Generics.Generic Agda.Syntax.Common.Cubical
+ Agda.Syntax.Common: instance GHC.Generics.Generic Agda.Syntax.Common.Language
+ Agda.Syntax.Common: instance GHC.Show.Show Agda.Syntax.Common.Cubical
+ Agda.Syntax.Common: instance GHC.Show.Show Agda.Syntax.Common.Language
+ Agda.Syntax.Common: type NameOf a;
+ Agda.Syntax.Concrete.Definitions: MissingDeclarations :: [(Name, Range)] -> DeclarationWarning'
+ Agda.Syntax.Concrete.Definitions.Errors: MissingDeclarations :: [(Name, Range)] -> DeclarationWarning'
+ Agda.Syntax.Concrete.Definitions.Types: [interleavedDataCons] :: InterleavedDecl -> Maybe (DeclNum, List1 [NiceConstructor])
+ Agda.Syntax.Concrete.Definitions.Types: [interleavedDeclNum] :: InterleavedDecl -> DeclNum
+ Agda.Syntax.Concrete.Definitions.Types: [interleavedDeclSig] :: InterleavedDecl -> NiceDeclaration
+ Agda.Syntax.Concrete.Definitions.Types: [interleavedFunClauses] :: InterleavedDecl -> Maybe (DeclNum, List1 ([Declaration], [Clause]))
+ Agda.Syntax.Concrete.Definitions.Types: type DeclNum = Int
+ Agda.Syntax.Internal: type PatternVarOut a;
+ Agda.Syntax.Internal.Generic: instance Agda.Syntax.Internal.Generic.TermLike GHC.Num.Integer.Integer
+ Agda.Syntax.Internal.Pattern: type PatVar p;
+ Agda.Syntax.Internal.Pattern: type PatVarLabel b;
+ Agda.Syntax.Position: instance Agda.Syntax.Position.KillRange GHC.Num.Integer.Integer
+ Agda.Syntax.Translation.AbstractToConcrete: type ConOfAbs a;
+ Agda.Syntax.Translation.ConcreteToAbstract: type AbsOfCon c;
+ Agda.Syntax.Translation.InternalToAbstract: type ReifiesTo i;
+ Agda.Syntax.Translation.ReflectedToAbstract: type AbsOfRef r;
+ Agda.Termination.Semiring: instance Agda.Termination.Semiring.HasZero GHC.Num.Integer.Integer
+ Agda.TypeChecking.Free: flexibleVars :: VarMap -> IntMap MetaSet
+ Agda.TypeChecking.MetaVars.Occurs: conArgs :: Elims -> OccursM a -> OccursM a
+ Agda.TypeChecking.Monad.Base: [defLanguage] :: Definition -> !Language
+ Agda.TypeChecking.Monad.Benchmark: type BenchPhase m
+ Agda.TypeChecking.Monad.Options: getLanguage :: HasOptions m => m Language
+ Agda.TypeChecking.Monad.Signature: addConstant' :: QName -> ArgInfo -> QName -> Type -> Defn -> TCM ()
+ Agda.TypeChecking.Monad.Signature: getOriginalConstInfo :: (ReadTCState m, HasConstInfo m) => QName -> m Definition
+ Agda.TypeChecking.Primitive: instance Agda.TypeChecking.Primitive.FromTerm GHC.Num.Integer.Integer
+ Agda.TypeChecking.Primitive: instance Agda.TypeChecking.Primitive.PrimTerm GHC.Num.Integer.Integer
+ Agda.TypeChecking.Primitive: instance Agda.TypeChecking.Primitive.PrimType GHC.Num.Integer.Integer
+ Agda.TypeChecking.Primitive: instance Agda.TypeChecking.Primitive.ToTerm GHC.Num.Integer.Integer
+ Agda.TypeChecking.Serialise.Instances.Common: instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Cubical
+ Agda.TypeChecking.Serialise.Instances.Common: instance Agda.TypeChecking.Serialise.Base.EmbPrj Agda.Syntax.Common.Language
+ Agda.TypeChecking.Serialise.Instances.Common: instance Agda.TypeChecking.Serialise.Base.EmbPrj GHC.Num.Integer.Integer
+ Agda.TypeChecking.SizedTypes.Syntax: type FlexOf a;
+ Agda.TypeChecking.SizedTypes.Syntax: type RigidOf a;
+ Agda.TypeChecking.Substitute.Class: type SubstArg a;
+ Agda.TypeChecking.Unquote: instance Agda.TypeChecking.Unquote.Unquote GHC.Num.Integer.Integer
+ Agda.Utils.Benchmark: type BenchPhase m;
+ Agda.Utils.BiMap: type Tag a;
+ Agda.Utils.Graph.AdjacencyMap.Unidirectional: WithUniqueInt :: !Int -> !n -> WithUniqueInt n
+ Agda.Utils.Graph.AdjacencyMap.Unidirectional: [otherValue] :: WithUniqueInt n -> !n
+ Agda.Utils.Graph.AdjacencyMap.Unidirectional: [uniqueInt] :: WithUniqueInt n -> !Int
+ Agda.Utils.Graph.AdjacencyMap.Unidirectional: addUniqueInts :: forall n e. Ord n => Graph n e -> Graph (WithUniqueInt n) e
+ Agda.Utils.Graph.AdjacencyMap.Unidirectional: data WithUniqueInt n
+ Agda.Utils.Graph.AdjacencyMap.Unidirectional: filterNodes :: Ord n => (n -> Bool) -> Graph n e -> Graph n e
+ Agda.Utils.Graph.AdjacencyMap.Unidirectional: filterNodesKeepingEdges :: forall n e. (Ord n, SemiRing e) => (n -> Bool) -> Graph n e -> Graph n e
+ Agda.Utils.Graph.AdjacencyMap.Unidirectional: instance Agda.Utils.Pretty.Pretty n => Agda.Utils.Pretty.Pretty (Agda.Utils.Graph.AdjacencyMap.Unidirectional.WithUniqueInt n)
+ Agda.Utils.Graph.AdjacencyMap.Unidirectional: instance GHC.Base.Functor Agda.Utils.Graph.AdjacencyMap.Unidirectional.WithUniqueInt
+ Agda.Utils.Graph.AdjacencyMap.Unidirectional: instance GHC.Classes.Eq (Agda.Utils.Graph.AdjacencyMap.Unidirectional.WithUniqueInt n)
+ Agda.Utils.Graph.AdjacencyMap.Unidirectional: instance GHC.Classes.Ord (Agda.Utils.Graph.AdjacencyMap.Unidirectional.WithUniqueInt n)
+ Agda.Utils.Graph.AdjacencyMap.Unidirectional: instance GHC.Show.Show n => GHC.Show.Show (Agda.Utils.Graph.AdjacencyMap.Unidirectional.WithUniqueInt n)
+ Agda.Utils.Graph.AdjacencyMap.Unidirectional: longestPaths :: forall n e. Ord n => Graph n e -> Graph n (Int, [[Edge n e]])
+ Agda.Utils.Graph.AdjacencyMap.Unidirectional: renameNodes :: Ord n2 => (n1 -> n2) -> Graph n1 e -> Graph n2 e
+ Agda.Utils.Graph.AdjacencyMap.Unidirectional: renameNodesMonotonic :: (Ord n1, Ord n2) => (n1 -> n2) -> Graph n1 e -> Graph n2 e
+ Agda.Utils.Graph.AdjacencyMap.Unidirectional: transitiveReduction :: Ord n => Graph n e -> Graph n ()
+ Agda.Utils.Haskell.Syntax: Comment :: String -> Decl
+ Agda.Utils.Haskell.Syntax: LocalBind :: Strictness -> Name -> Rhs -> Decl
+ Agda.Utils.List: breakAfter :: (a -> Bool) -> [a] -> ([a], [a])
+ Agda.Utils.List: breakAfter1 :: (a -> Bool) -> a -> [a] -> (List1 a, [a])
+ Agda.Utils.List: findOverlap :: forall a. Eq a => [a] -> [a] -> (Int, Int)
+ Agda.Utils.List1: appendList :: NonEmpty a -> [a] -> NonEmpty a
+ Agda.Utils.List1: breakAfter :: (a -> Bool) -> List1 a -> (List1 a, [a])
+ Agda.Utils.List1: prependList :: [a] -> NonEmpty a -> NonEmpty a
+ Agda.Utils.Null: instance Agda.Utils.Null.Null Data.Text.Internal.Text
+ Agda.Utils.PartialOrd: instance Agda.Utils.PartialOrd.PartialOrd GHC.Num.Integer.Integer
+ Agda.Utils.Pretty: instance Agda.Utils.Pretty.Pretty GHC.Num.Integer.Integer
+ Agda.Utils.Zipper: type Carrier z;
+ Agda.Utils.Zipper: type Element z;
- Agda.Compiler.Backend: Defn :: ArgInfo -> QName -> Type -> [Polarity] -> [Occurrence] -> NumGeneralizableArgs -> [Maybe Name] -> [LocalDisplayForm] -> MutualId -> CompiledRepresentation -> Maybe QName -> Bool -> Set QName -> Bool -> Bool -> Bool -> Blocked_ -> Defn -> Definition
+ Agda.Compiler.Backend: Defn :: ArgInfo -> QName -> Type -> [Polarity] -> [Occurrence] -> NumGeneralizableArgs -> [Maybe Name] -> [LocalDisplayForm] -> MutualId -> CompiledRepresentation -> Maybe QName -> Bool -> Set QName -> Bool -> Bool -> Bool -> Blocked_ -> !Language -> Defn -> Definition
- Agda.Compiler.Backend: defaultDefn :: ArgInfo -> QName -> Type -> Defn -> Definition
+ Agda.Compiler.Backend: defaultDefn :: ArgInfo -> QName -> Type -> Language -> Defn -> Definition
- Agda.Compiler.MAlonzo.Compiler: GHCFlags :: Bool -> Bool -> Maybe FilePath -> [String] -> GHCFlags
+ Agda.Compiler.MAlonzo.Compiler: GHCFlags :: Bool -> Bool -> Maybe FilePath -> [String] -> Bool -> Bool -> GHCFlags
- Agda.Compiler.MAlonzo.Compiler: compiledcondecl :: QName -> HsCompileM Decl
+ Agda.Compiler.MAlonzo.Compiler: compiledcondecl :: Maybe Nat -> QName -> HsCompileM Decl
- Agda.Compiler.MAlonzo.Compiler: curOutFile :: (MonadGHCIO m, ReadHsModuleEnv m) => m FilePath
+ Agda.Compiler.MAlonzo.Compiler: curOutFile :: (MonadGHCIO m, ReadGHCModuleEnv m) => m FilePath
- Agda.Compiler.MAlonzo.Compiler: curOutFileAndDir :: (MonadGHCIO m, ReadHsModuleEnv m) => m (FilePath, FilePath)
+ Agda.Compiler.MAlonzo.Compiler: curOutFileAndDir :: (MonadGHCIO m, ReadGHCModuleEnv m) => m (FilePath, FilePath)
- Agda.Compiler.MAlonzo.Compiler: ghcBackend' :: Backend' GHCFlags GHCCompileEnv GHCModuleEnv GHCModule GHCDefinition
+ Agda.Compiler.MAlonzo.Compiler: ghcBackend' :: Backend' GHCFlags GHCEnv GHCModuleEnv GHCModule GHCDefinition
- Agda.Compiler.MAlonzo.Compiler: ghcCompileDef :: GHCCompileEnv -> GHCModuleEnv -> IsMain -> Definition -> TCM GHCDefinition
+ Agda.Compiler.MAlonzo.Compiler: ghcCompileDef :: GHCEnv -> GHCModuleEnv -> IsMain -> Definition -> TCM GHCDefinition
- Agda.Compiler.MAlonzo.Compiler: ghcPostCompile :: GHCCompileEnv -> IsMain -> Map ModuleName GHCModule -> TCM ()
+ Agda.Compiler.MAlonzo.Compiler: ghcPostCompile :: GHCEnv -> IsMain -> Map ModuleName GHCModule -> TCM ()
- Agda.Compiler.MAlonzo.Compiler: ghcPostModule :: GHCCompileEnv -> GHCModuleEnv -> IsMain -> ModuleName -> [GHCDefinition] -> TCM GHCModule
+ Agda.Compiler.MAlonzo.Compiler: ghcPostModule :: GHCEnv -> GHCModuleEnv -> IsMain -> ModuleName -> [GHCDefinition] -> TCM GHCModule
- Agda.Compiler.MAlonzo.Compiler: ghcPreCompile :: GHCFlags -> TCM GHCCompileEnv
+ Agda.Compiler.MAlonzo.Compiler: ghcPreCompile :: GHCFlags -> TCM GHCEnv
- Agda.Compiler.MAlonzo.Compiler: ghcPreModule :: GHCCompileEnv -> IsMain -> ModuleName -> Maybe FilePath -> TCM (Recompile GHCModuleEnv GHCModule)
+ Agda.Compiler.MAlonzo.Compiler: ghcPreModule :: GHCEnv -> IsMain -> ModuleName -> Maybe FilePath -> TCM (Recompile GHCModuleEnv GHCModule)
- Agda.Compiler.MAlonzo.Misc: askHsModuleEnv :: (ReadHsModuleEnv m, MonadTrans t, Monad n, m ~ t n, ReadHsModuleEnv n) => m HsModuleEnv
+ Agda.Compiler.MAlonzo.Misc: askHsModuleEnv :: ReadGHCModuleEnv m => m HsModuleEnv
- Agda.Compiler.MAlonzo.Misc: curAgdaMod :: ReadHsModuleEnv m => m ModuleName
+ Agda.Compiler.MAlonzo.Misc: curAgdaMod :: ReadGHCModuleEnv m => m ModuleName
- Agda.Compiler.MAlonzo.Misc: curHsMod :: ReadHsModuleEnv m => m ModuleName
+ Agda.Compiler.MAlonzo.Misc: curHsMod :: ReadGHCModuleEnv m => m ModuleName
- Agda.Compiler.MAlonzo.Misc: curIsMainModule :: ReadHsModuleEnv m => m Bool
+ Agda.Compiler.MAlonzo.Misc: curIsMainModule :: ReadGHCModuleEnv m => m Bool
- Agda.Compiler.MAlonzo.Misc: ihname :: String -> Nat -> Name
+ Agda.Compiler.MAlonzo.Misc: ihname :: VariableKind -> Nat -> Name
- Agda.Compiler.MAlonzo.Misc: runHsCompileT :: HsCompileT m a -> HsModuleEnv -> m (a, HsCompileState)
+ Agda.Compiler.MAlonzo.Misc: runHsCompileT :: HsCompileT m a -> GHCModuleEnv -> m (a, HsCompileState)
- Agda.Compiler.MAlonzo.Misc: runHsCompileT' :: HsCompileT m a -> HsModuleEnv -> HsCompileState -> m (a, HsCompileState)
+ Agda.Compiler.MAlonzo.Misc: runHsCompileT' :: HsCompileT m a -> GHCModuleEnv -> HsCompileState -> m (a, HsCompileState)
- Agda.Compiler.MAlonzo.Misc: type HsCompileT m = ReaderT HsModuleEnv (StateT HsCompileState m)
+ Agda.Compiler.MAlonzo.Misc: type HsCompileT m = ReaderT GHCModuleEnv (StateT HsCompileState m)
- Agda.Compiler.MAlonzo.Misc: unqhname :: String -> QName -> Name
+ Agda.Compiler.MAlonzo.Misc: unqhname :: NameKind -> QName -> Name
- Agda.Compiler.MAlonzo.Misc: xhqn :: String -> QName -> HsCompileM QName
+ Agda.Compiler.MAlonzo.Misc: xhqn :: NameKind -> QName -> HsCompileM QName
- Agda.Compiler.MAlonzo.Pragmas: getHaskellConstructor :: QName -> TCM (Maybe HaskellCode)
+ Agda.Compiler.MAlonzo.Pragmas: getHaskellConstructor :: QName -> HsCompileM (Maybe HaskellCode)
- Agda.Compiler.MAlonzo.Primitives: xForPrim :: Map String [a] -> BuiltinThings PrimFun -> [Definition] -> [a]
+ Agda.Compiler.MAlonzo.Primitives: xForPrim :: Map String a -> BuiltinThings PrimFun -> [Definition] -> [a]
- Agda.Interaction.Options: PragmaOptions :: Bool -> Bool -> UnicodeOrAscii -> Verbosity -> Bool -> WithDefault 'False -> Bool -> Bool -> Bool -> Bool -> CutOff -> Bool -> Bool -> Bool -> WithDefault 'False -> Bool -> WithDefault 'False -> WithDefault 'False -> Bool -> Bool -> Bool -> Bool -> WithDefault 'False -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Int -> Bool -> Bool -> Int -> Bool -> Bool -> Bool -> WarningMode -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Maybe ConfluenceCheck -> Bool -> Bool -> Bool -> Bool -> PragmaOptions
+ Agda.Interaction.Options: PragmaOptions :: Bool -> Bool -> UnicodeOrAscii -> Verbosity -> Bool -> WithDefault 'False -> Bool -> Bool -> Bool -> Bool -> CutOff -> Bool -> Bool -> Bool -> WithDefault 'False -> Bool -> WithDefault 'False -> WithDefault 'False -> Bool -> Bool -> Bool -> Bool -> WithDefault 'False -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Maybe Cubical -> Bool -> Bool -> Bool -> Bool -> Int -> Bool -> Bool -> Int -> Bool -> Bool -> Bool -> WarningMode -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Maybe ConfluenceCheck -> Bool -> Bool -> Bool -> Bool -> PragmaOptions
- Agda.Interaction.Options: [optCubical] :: PragmaOptions -> Bool
+ Agda.Interaction.Options: [optCubical] :: PragmaOptions -> Maybe Cubical
- Agda.Interaction.Response: Info_CompilationOk :: WarningsAndNonFatalErrors -> DisplayInfo
+ Agda.Interaction.Response: Info_CompilationOk :: CompilerBackend -> WarningsAndNonFatalErrors -> DisplayInfo
- Agda.Syntax.Concrete.Definitions.Types: InterleavedData :: (Int, NiceDeclaration) -> Maybe (Int, [[NiceConstructor]]) -> InterleavedDecl
+ Agda.Syntax.Concrete.Definitions.Types: InterleavedData :: DeclNum -> NiceDeclaration -> Maybe (DeclNum, List1 [NiceConstructor]) -> InterleavedDecl
- Agda.Syntax.Concrete.Definitions.Types: InterleavedFun :: (Int, NiceDeclaration) -> Maybe (Int, [([Declaration], [Clause])]) -> InterleavedDecl
+ Agda.Syntax.Concrete.Definitions.Types: InterleavedFun :: DeclNum -> NiceDeclaration -> Maybe (DeclNum, List1 ([Declaration], [Clause])) -> InterleavedDecl
- Agda.Syntax.Concrete.Definitions.Types: interleavedDecl :: Name -> InterleavedDecl -> [(Int, NiceDeclaration)]
+ Agda.Syntax.Concrete.Definitions.Types: interleavedDecl :: Name -> InterleavedDecl -> [(DeclNum, NiceDeclaration)]
- Agda.TypeChecking.Errors: topLevelModuleDropper :: (MonadTCEnv m, ReadTCState m) => m (QName -> QName)
+ Agda.TypeChecking.Errors: topLevelModuleDropper :: (MonadDebug m, MonadTCEnv m, ReadTCState m) => m (QName -> QName)
- Agda.TypeChecking.MetaVars: expandProjectedVars :: (Show a, PrettyTCM a, NoProjectedVar a, ReduceAndEtaContract a, PrettyTCM b, TermSubst b) => a -> b -> (a -> b -> TCM c) -> TCM c
+ Agda.TypeChecking.MetaVars: expandProjectedVars :: (Pretty a, PrettyTCM a, NoProjectedVar a, ReduceAndEtaContract a, PrettyTCM b, TermSubst b) => a -> b -> (a -> b -> TCM c) -> TCM c
- Agda.TypeChecking.Monad.Base: Defn :: ArgInfo -> QName -> Type -> [Polarity] -> [Occurrence] -> NumGeneralizableArgs -> [Maybe Name] -> [LocalDisplayForm] -> MutualId -> CompiledRepresentation -> Maybe QName -> Bool -> Set QName -> Bool -> Bool -> Bool -> Blocked_ -> Defn -> Definition
+ Agda.TypeChecking.Monad.Base: Defn :: ArgInfo -> QName -> Type -> [Polarity] -> [Occurrence] -> NumGeneralizableArgs -> [Maybe Name] -> [LocalDisplayForm] -> MutualId -> CompiledRepresentation -> Maybe QName -> Bool -> Set QName -> Bool -> Bool -> Bool -> Blocked_ -> !Language -> Defn -> Definition
- Agda.TypeChecking.Monad.Base: defaultDefn :: ArgInfo -> QName -> Type -> Defn -> Definition
+ Agda.TypeChecking.Monad.Base: defaultDefn :: ArgInfo -> QName -> Type -> Language -> Defn -> Definition
- Agda.TypeChecking.Primitive.Cubical: requireCubical :: String -> TCM ()
+ Agda.TypeChecking.Primitive.Cubical: requireCubical :: Cubical -> String -> TCM ()
- Agda.Utils.List: chopWhen :: (a -> Bool) -> [a] -> [[a]]
+ Agda.Utils.List: chopWhen :: forall a. (a -> Bool) -> [a] -> [[a]]
- Agda.Utils.List1: append :: List1 a -> [a] -> List1 a
+ Agda.Utils.List1: append :: NonEmpty a -> NonEmpty a -> NonEmpty a
- Agda.Utils.List1: infixr 5 :|
+ Agda.Utils.List1: infixr 5 <|
- Agda.Utils.List1: singleton :: a -> List1 a
+ Agda.Utils.List1: singleton :: a -> NonEmpty a

Files

Agda.cabal view
@@ -1,12 +1,12 @@ name:            Agda-version:         2.6.2+version:         2.6.2.1 cabal-version:   >= 1.10 build-type:      Custom license:         OtherLicense license-file:    LICENSE copyright:       (c) 2005-2021 The Agda Team. author:          Ulf Norell and The Agda Team, see https://agda.readthedocs.io/en/latest/team.html-maintainer:      Ulf Norell <ulfn@chalmers.se>+maintainer:      The Agda Team homepage:        http://wiki.portal.chalmers.se/agda/ bug-reports:     https://github.com/agda/agda/issues category:        Dependent types@@ -39,11 +39,13 @@                     GHC == 8.4.4                     GHC == 8.6.5                     GHC == 8.8.4-                    GHC == 8.10.5+                    GHC == 8.10.7                     GHC == 9.0.1+                    GHC == 9.2.1  extra-source-files: CHANGELOG.md                     README.md+                    doc/release-notes/2.6.2.md                     doc/release-notes/2.6.1.3.md                     doc/release-notes/2.6.1.2.md                     doc/release-notes/2.6.1.1.md@@ -77,22 +79,24 @@                     doc/release-notes/2.2.2.md                     doc/release-notes/2.2.4.md                     doc/release-notes/2.2.0.md-                    doc/user-manual.pdf+-- Liang-Ting (2019-11-26): See Issues #4216+--                    doc/user-manual.pdf                     stack-8.0.2.yaml                     stack-8.2.2.yaml                     stack-8.4.4.yaml                     stack-8.6.5.yaml                     stack-8.8.4.yaml-                    stack-8.10.5.yaml+                    stack-8.10.7.yaml                     stack-9.0.1.yaml+                    stack-9.2.1.yaml  data-dir:           src/data-data-files:         Agda.css-                    agda.sty-                    emacs-mode/*.el+data-files:         emacs-mode/*.el+                    html/Agda.css+                    html/highlight-hover.js                     JS/agda-rts.js-                    JS/biginteger.js-                    JS/highlight-hover.js+                    latex/agda.sty+                    latex/postprocess-latex.pl                     lib/prim/Agda/Builtin/Bool.agda                     lib/prim/Agda/Builtin/Char.agda                     lib/prim/Agda/Builtin/Char/Properties.agda@@ -131,7 +135,6 @@                     lib/prim/Agda/Primitive/Cubical.agda                     MAlonzo/src/MAlonzo/*.hs                     MAlonzo/src/MAlonzo/RTE/*.hs-                    postprocess-latex.pl  source-repository head   type:     git@@ -140,7 +143,7 @@ source-repository this   type:     git   location: https://github.com/agda/agda.git-  tag:      v2.6.2+  tag:      v2.6.2.1  flag cpphs   default:     False@@ -165,9 +168,9 @@     Enable some expensive optimisations when compiling Agda.  custom-setup-  setup-depends:  base >= 4.9.0.0 && < 4.16-                , Cabal >= 1.24.0.0 && < 3.5-                , directory >= 1.2.6.1.2 && < 1.4+  setup-depends:  base >= 4.9.0.0 && < 4.17+                , Cabal >= 1.24.0.0 && < 3.7+                , directory >= 1.2.6.2 && < 1.4                 , filepath >= 1.4.1.0 && < 1.5                 , process >= 1.4.2.0 && < 1.7 @@ -201,10 +204,10 @@   if os(windows) && impl(ghc == 8.6.3)     buildable: False -  build-depends:  aeson >= 1.1.2.0 && < 1.6+  build-depends:  aeson >= 1.1.2.0 && < 2.1                 , array >= 0.5.1.1 && < 0.6                 , async >= 2.2 && < 2.3-                , base >= 4.9.0.0 && < 4.16+                , base >= 4.9.0.0 && < 4.17                 , binary >= 0.8.3.0 && < 0.9                 , blaze-html >= 0.8 && < 0.10                 , boxes >= 0.1.3 && < 0.2@@ -224,13 +227,13 @@                 -- hashable 1.2.0.10 makes library-test 10x                 -- slower. The issue was fixed in hashable 1.2.1.0.                 -- https://github.com/tibbe/hashable/issues/57.-                , hashable >= 1.2.1.0 && < 1.4+                , hashable >= 1.2.1.0 && < 1.5                 -- There is a "serious bug"                 -- (https://hackage.haskell.org/package/hashtables-1.2.0.2/changelog)                 -- in hashtables 1.2.0.0/1.2.0.1. This bug seems to                 -- have made Agda much slower (infinitely slower?) in                 -- some cases.-                , hashtables >= 1.2.0.2 && < 1.3+                , hashtables >= 1.2.0.2 && < 1.4                 , haskeline >= 0.7.2.3 && < 0.9                 -- monad-control-1.0.1.0 is the first to contain liftThrough                 , monad-control >= 1.0.1.0 && < 1.1@@ -247,10 +250,10 @@                 , split >= 0.2.0.0 && < 0.2.4                 , stm >= 2.4.4 && < 2.6                 , strict >= 0.3.2 && < 0.5-                , template-haskell >= 2.11.0.0 && < 2.18+                , template-haskell >= 2.11.0.0 && < 2.19                 , text >= 1.2.3.0 && < 1.3-                , time >= 1.6.0.1 && < 1.12-                , transformers == 0.5.*+                , time >= 1.6.0.1 && < 1.13+                , transformers >= 0.5 && < 0.7                 , unordered-containers >= 0.2.5.0 && < 0.3                 , uri-encode >= 1.5.0.4 && < 1.6                 , zlib == 0.6.*@@ -264,21 +267,6 @@   -- revisions on hackage, e.g. relaxing upper bounds.  This process   -- currently does not support revising conditionals. -  -- In hs-tags the mtl library must be compiled with the version of-  -- transformers shipped with GHC, so we use that version in Agda (see,-  -- for example, Issue #2983).-  if impl(ghc > 9.0.1)-    build-depends: transformers >= 0.5.6.2--  if impl(ghc >= 8.6.4) && impl(ghc <= 9.0.1)-    build-depends: transformers == 0.5.6.2--  if impl(ghc >= 8.4) && impl(ghc < 8.6.4)-    build-depends: transformers == 0.5.5.0--  if impl(ghc < 8.4)-    build-depends: transformers == 0.5.2.0-   -- ASR (2018-10-16).   -- text-1.2.3.0 required for supporting GHC 8.4.1, 8.4.2 and   -- 8.4.3. See Issue #3277.@@ -320,6 +308,7 @@                     Agda.Compiler.MAlonzo.Pragmas                     Agda.Compiler.MAlonzo.Pretty                     Agda.Compiler.MAlonzo.Primitives+                    Agda.Compiler.MAlonzo.Strict                     Agda.Compiler.ToTreeless                     Agda.Compiler.Treeless.AsPatterns                     Agda.Compiler.Treeless.Builtin@@ -659,6 +648,7 @@     ghc-options: -fprint-potential-instances                  -- Initially, we disable all the warnings.                  -w+                 -Wwarn                  -- This option must be the first one after disabling the                  -- warnings. See Issue #2094.                  -Wunrecognised-warning-flags@@ -691,34 +681,34 @@                  -Wwrong-do-bind   else     ghc-options: -fprint-potential-instances-                 -Werror=unrecognised-warning-flags-                 -Werror=deprecated-flags-                 -Werror=deriving-typeable-                 -Werror=dodgy-exports-                 -Werror=dodgy-foreign-imports-                 -Werror=dodgy-imports-                 -Werror=duplicate-exports-                 -Werror=empty-enumerations-                 -Werror=identities-                 -Werror=incomplete-patterns-                 -Werror=inline-rule-shadowing-                 -Werror=missing-fields-                 -Werror=missing-methods-                 -Werror=missing-pattern-synonym-signatures-                 -Werror=missing-signatures-                 -Werror=noncanonical-monad-instances-                 -Werror=noncanonical-monoid-instances-                 -Werror=overflowed-literals-                 -Werror=overlapping-patterns-                 -Werror=semigroup-                 -Werror=tabs-                 -Werror=typed-holes-                 -Werror=unrecognised-pragmas-                 -Werror=unticked-promoted-constructors-                 -Werror=unused-do-bind-                 -Werror=unused-foralls-                 -Werror=warnings-deprecations-                 -Werror=wrong-do-bind+                 -Wwarn=unrecognised-warning-flags+                 -Wwarn=deprecated-flags+                 -Wwarn=deriving-typeable+                 -Wwarn=dodgy-exports+                 -Wwarn=dodgy-foreign-imports+                 -Wwarn=dodgy-imports+                 -Wwarn=duplicate-exports+                 -Wwarn=empty-enumerations+                 -Wwarn=identities+                 -Wwarn=incomplete-patterns+                 -Wwarn=inline-rule-shadowing+                 -Wwarn=missing-fields+                 -Wwarn=missing-methods+                 -Wwarn=missing-pattern-synonym-signatures+                 -Wwarn=missing-signatures+                 -Wwarn=noncanonical-monad-instances+                 -Wwarn=noncanonical-monoid-instances+                 -Wwarn=overflowed-literals+                 -Wwarn=overlapping-patterns+                 -Wwarn=semigroup+                 -Wwarn=tabs+                 -Wwarn=typed-holes+                 -Wwarn=unrecognised-pragmas+                 -Wwarn=unticked-promoted-constructors+                 -Wwarn=unused-do-bind+                 -Wwarn=unused-foralls+                 -Wwarn=warnings-deprecations+                 -Wwarn=wrong-do-bind    -- NOTE: If adding or removing flags, also change `.ghci-8.2`   if impl(ghc >= 8.2)@@ -726,33 +716,33 @@                  -- ASR TODO (2017-07-23): `make haddock` fails when                  -- this flag is on.                  -- -Wmissing-home-modules-                 -Werror=simplifiable-class-constraints-                 -Werror=unbanged-strict-patterns+                 -Wwarn=simplifiable-class-constraints+                 -Wwarn=unbanged-strict-patterns    -- NOTE: If adding or removing flags, also change `.ghci-8.6`   if impl(ghc >= 8.6)-    ghc-options: -Werror=inaccessible-code-                 -Werror=star-binder-                 -Werror=star-is-type+    ghc-options: -Wwarn=inaccessible-code+                 -Wwarn=star-binder+                 -Wwarn=star-is-type    -- The following warning is an error in GHC >= 8.10.   if impl(ghc >= 8.6) && impl(ghc < 8.10)-    ghc-options: -Werror=implicit-kind-vars+    ghc-options: -Wwarn=implicit-kind-vars    -- NOTE: If adding or removing flags, also change `.ghci-8.8`   if impl(ghc >= 8.8)-    ghc-options: -Werror=missed-extra-shared-lib+    ghc-options: -Wwarn=missed-extra-shared-lib    -- NOTE: If adding or removing flags, also change `.ghci-8.10`   if impl(ghc >= 8.10)-    ghc-options: -Werror=deriving-defaults-                 -Werror=redundant-record-wildcards-                 -Werror=unused-packages-                 -Werror=unused-record-wildcards+    ghc-options: -Wwarn=deriving-defaults+                 -Wwarn=redundant-record-wildcards+                 -Wwarn=unused-packages+                 -Wwarn=unused-record-wildcards    -- NOTE: If adding or removing flags, also change `.ghci-9.0`   if impl(ghc >= 9.0)-    ghc-options: -Werror=invalid-haddock+    ghc-options: -Wwarn=invalid-haddock    default-language: Haskell2010 @@ -822,8 +812,8 @@   hs-source-dirs:   src/agda-mode   main-is:          Main.hs   other-modules:    Paths_Agda-  build-depends:    base >= 4.9.0.0 && < 4.16-                  , directory >= 1.2.6.1.2 && < 1.4+  build-depends:    base >= 4.9.0.0 && < 4.17+                  , directory >= 1.2.6.2 && < 1.4                   , filepath >= 1.4.1.0 && < 1.5                   , process >= 1.4.2.0 && < 1.7   default-language: Haskell2010
CHANGELOG.md view
@@ -1,1250 +1,149 @@-Release notes for Agda version 2.6.2-====================================--Highlights-------------* Several improvements and bug-fixes related to [Run-time-  Irrelevance](https://agda.readthedocs.io/en/v2.6.2/language/runtime-irrelevance.html).--* Several improvements and bug-fixes related to the [JavaScript-  Backend](https://agda.readthedocs.io/en/v2.6.2/tools/compilers.html#javascript-backend).--* Added experimental support for [Guarded Cubical-  Agda](https://agda.readthedocs.io/en/v2.6.2/language/guarded-cubical.html).--* The [Primitive-  Sorts](https://agda.readthedocs.io/en/v2.6.2/language/built-ins.html#sorts)-  of Agda (`Set` and `Prop`) are no longer keywords and can be renamed-  when importing `Agda.Primitive`.--* Added native support for the [Inspect-  Idiom](https://agda.readthedocs.io/en/v2.6.2/language/with-abstraction.html#with-abstraction-equality).--* Added support for making [System-  Calls](https://agda.readthedocs.io/en/v2.6.2/language/reflection.html#system-calls)-  from the reflection API.--Installation and infrastructure----------------------------------* Added support for GHC 8.10.5 and 9.0.1.--* Some expensive optimisations are now off by default-  (see [#4521](https://github.com/agda/agda/issues/4521)).--  These optimisations can in some cases make Agda substantially-  faster, but they can also make the compilation of the Agda program-  take more time and space.--  The optimisations can be turned on manually (Cabal:-  `-foptimise-heavily`, Stack: `--flag Agda:optimise-heavily`). They-  are turned on (by default) when Agda is installed using `make-  install`.--  If the optimisations are turned on it might make sense to limit-  GHC's memory usage (using something like `--ghc-options="+RTS -M6G-  -RTS"`).--Pragmas and options----------------------* New option `--auto-inline` turns on automatic compile-time inlining-  of simple functions. This was previously enabled by default.--  Note that the absence of automatic inlining can make typechecking-  substantially slower.--  The new default has repercussions on termination checking, for instance-  (see [#4702](https://github.com/agda/agda/issues/4702)).-  The following formulation of `plus` termination checks with `--auto-inline`-  but not without:-  ```agda-  open import Agda.Builtin.Nat--  case_of_ : {A B : Set} → A → (A → B) → B-  case x of f = f x--  plus : Nat → Nat → Nat-  plus m n = case m of λ-     { zero    → n-     ; (suc m) → suc (plus m n)-     }-  ```-  In this particular case, we can work around the limitation of the-  termination checker with pragma `{-# INLINE case_of_ #-}`.--* New options `--qualified-instances` (default) and-  `--no-qualified-instances`. When `--no-qualified-instances` is-  enabled, Agda will only consider candidates for instance search that-  are in scope under an unqualified name (see-  [#4522](https://github.com/agda/agda/pull/4522)).--* New option `--call-by-name` turns off call-by-need evaluation at type-  checking time.--* New option `--highlight-occurrences` (off by default) enables the HTML-  backend to include a JavaScript file that highlights all occurrences of-  the mouse-hovered symbol (see-  [#4535](https://github.com/agda/agda/pull/4535)).--* New option `--no-import-sorts` disables the implicit `open-  import Agda.Primitive using (Set; Prop)` at the top of each file-  (see below).--* New option `--local-confluence-check` to restore the old behaviour-  of the `--confluence-check` flag (see below for the new behaviour).--* New primitive `primStringFromListInjective` internalising the fact that-  `primStringFromList` is an injective function. It is bound in-  `Agda.Builtin.String.Properties`.--* New option `--allow-exec` enables the use of system calls during-  type checking using the `AGDATCMEXECTC` builtin.--* New option `--show-identity-substitutions` shows all arguments of-  metavariables when pretty-printing a term, even if they amount to-  just applying all the variables in the context.--* The option `--rewriting` is now considered infective: if a module has-  `--rewriting` enabled, then all modules importing it must also have-  `--rewriting` enabled.--* New option `--no-double-check` (default), opposite of the existing-  `--double-check`.--* Due to several known soundness issues with sized types (see-  [#1201](https://github.com/agda/agda/issues/1201),-  [#1946](https://github.com/agda/agda/issues/1946),-  [#2820](https://github.com/agda/agda/issues/2820),-  [#3026](https://github.com/agda/agda/issues/3026)), the-  `--sized-types` flag can no longer be used while `--safe` is active.--* New option `--guarded` turns on the Guarded Cubical extension of Agda.--  See [Guarded Cubical](https://agda.readthedocs.io/en/v2.6.2/language/guarded-cubical.html)-  in the documentation for more.--* The flags `--guardedness` and `--sized-types` are no longer enabled-  by default.--Command-line interaction---------------------------* In the previous release, Agda exited with either status 0 when the-  program type checks successfully, or status 1 when encountering any-  kind of error.  Now Agda exits with status 42 for type errors, 71-  for errors in the commandline arguments, and 154 for impossible-  errors. Exit status 1 may be returned under other circumstances; for-  instance, an incomplete pattern matching, or an error generated by-  the Haskell runtime.  See PR-  [#4540](https://github.com/agda/agda/pull/4540).--Lexical syntax-----------------* Layout handling has been improved so that block starters can be-  stacked on the same line-  [#1145](https://github.com/agda/agda/issues/1145).--  If several layout blocks are started by layout keywords without line-  break in between (where line breaks inside block comments do not-  count), then those blocks indented *more* than the last block go-  passive, meaning they cannot be further extended by new statements.-  ```agda-    private module M where postulate-              A : Set                 -- module-block goes passive-              B : Set                 -- postulate-block can still be extended-            module N where            -- private-block can still be extended-  ```-  Previously, this was a parse error.--Language-----------* Inductive records without η-equality no longer support both matching-  on the record constructor and construction of record elements by-  copattern matching.  It has been discovered that the combination of-  both leads to loss of subject reduction, i.e., reduction does not-  preserve typing.  See issue-  [#4560](https://github.com/agda/agda/issues/4560).--  η-equality for a record can be turned off manually with directive-  `no-eta-equality` or command-line option `--no-eta-equality`, but it-  is also automatically turned off for some recursive records.  For-  records without η, matching on the record constructor is now off by-  default and construction by copattern matching is on.  If you want-  the converse, you can add the new record directive `pattern`.--  Example with record pattern:-  ```agda-  record N : Set where-    inductive-    no-eta-equality-    pattern-    field out : Maybe N--  pred : N → Maybe N-  pred record{ out = m } = m-  ```-  Example with record constructor and use of `;` instead of newline:-  ```agda-  record N : Set where-    inductive; no-eta-equality-    pattern; constructor inn-    field out : Maybe N--  pred : N → Maybe N-  pred (inn m) = m-  ```--* `Set` and `Prop` are no longer keywords but are now primitives-  defined in the module `Agda.Primitive`. They can be renamed when-  importing this module, for example:--  ```agda-  open import Agda.Primitive renaming (Set to Type)--  test : Type₁-  test = Type-  ```--  To preserve backwards compatibility, each top-level Agda module now-  starts with an implicit statement:--  ```agda-  open import Agda.Primitive using (Set; Prop)-  ```--  This implicit import can be disabled with the-  `--no-import-sorts` flag.--* Agda now has support for sorts `Setωᵢ` (alternative syntax: `Setωi`)-  for natural numbers `i`, where `Setω₀ = Setω`. These sorts form a-  second hierarchy `Setωᵢ : Setωᵢ₊₁` similar to the standard hierarchy-  of `Setᵢ`, but do not support universe polymorphism. It should not-  be necessary to refer to these sorts during normal usage of Agda,-  but they might be useful for defining reflection-based macros (see-  [#2119](https://github.com/agda/agda/issues/2119) and-  [#4585](https://github.com/agda/agda/issues/4585)).--* Changed the internal representation of literal strings: instead of using a-  linked list of characters (`String`), we are now using `Data.Text`. This-  should be a transparent change from the user's point of view: the backend-  was already packing these strings as text.--  Used this opportunity to introduce a `primStringUncons` primitive in-  `Agda.Builtin.String` (and to correspondingly add the-  `Agda.Builtin.Maybe` it needs).--* The option `--confluence-check` for rewrite rules has been given a-  new implementation that checks global confluence instead of local-  confluence. Concretely, it does so by enforcing two properties:--  1. For any two left-hand sides of the rewrite rules that overlap-     (either at the root position or at a subterm), the most general-     unifier of the two left-hand sides is again a left-hand side of a-     rewrite rule. For example, if there are two rules `suc m + n =-     suc (m + n)` and `m + suc n = suc (m + n)`, then there should-     also be a rule `suc m + suc n = suc (suc (m + n))`.--  2. Each rewrite rule should satisfy the *triangle property*: For any-     rewrite rule `u = w` and any single-step parallel unfolding `u =>-     v`, we should have another single-step parallel unfolding `v =>-     w`.--  The previous behaviour of the confluence checker that only ensures-  local confluence can be restored by using the-  `--local-confluence-check` flag.--* Binary integer literals with prefix `0b` (for instance,-  `0b11001001`) are now supported.--* Overloaded literals now require the conversion function (`fromNat`,-  `fromNeg`, or `fromString`) to be in scope *unqualified* to take-  effect.--  Previously, it was enough for the function to be in scope at all,-  which meant you couldn't import the corresponding builtin module-  without having overloaded literals turned on.--* Added `interleaved mutual` blocks where users can forward-declare-  function, record, and data types and interleave their-  definitions. These blocks are elaborated to more traditional mutual-  blocks by:--    - leaving the signatures where they are-    - grouping the clauses for a function together with the first of them-    - grouping the constructors for a datatype together with the first of them--  Example: two interleaved function definitions--  ```agda--  interleaved mutual--    -- Declarations:-    even : Nat → Bool-    odd  : Nat → Bool--    -- zero is even, not odd-    even zero = true-    odd  zero = false--    -- suc case: switch evenness on the predecessor-    even (suc n) = odd n-    odd  (suc n) = even n-  ```--  Other example: the definition of universe of types closed under the-  natural numbers and pairing:--  ```agda--  interleaved mutual--    -- Declaration of a product record, a universe of codes, and a decoding function-    record _×_ (A B : Set) : Set-    data U : Set-    El : U → Set--    -- We have a code for the type of natural numbers in our universe-    constructor `Nat : U-    El `Nat = Nat--    -- Btw we know how to pair values in a record-    record _×_ A B where-      constructor _,_-      inductive-      field fst : A; snd : B--    -- And we have a code for pairs in our universe-    constructor _`×_ : (A B : U) → U-    El (A `× B) = El A × El B-  ```--* Erased constructors (see-  [#4638](https://github.com/agda/agda/issues/4638)).--  Constructors can be marked as erased. Example:-  ```agda-    {-# OPTIONS --cubical --safe #-}--    open import Agda.Builtin.Cubical.Path-    open import Agda.Primitive--    private-      variable-        a   : Level-        A B : Set a--    Is-proposition : Set a → Set a-    Is-proposition A = (x y : A) → x ≡ y--    data ∥_∥ (A : Set a) : Set a where-      ∣_∣        : A → ∥ A ∥-      @0 trivial : Is-proposition ∥ A ∥--    rec : @0 Is-proposition B → (A → B) → ∥ A ∥ → B-    rec p f ∣ x ∣           = f x-    rec p f (trivial x y i) = p (rec p f x) (rec p f y) i-  ```-  In the code above the constructor `trivial` is only available at-  compile-time, whereas `∣_∣` is also available at run-time. Erased-  names can be used in bodies of clauses that match on `trivial`, if-  the match is done in a non-erased position, like in the final clause-  of `rec`. (Note that Cubical Agda programs still cannot be-  compiled.)--* Erased pattern-matching lambdas (see-  [#4525](https://github.com/agda/agda/issues/4525)).--  Regular pattern-matching lambdas are treated as non-erased-  function definitions. One can make a pattern-matching lambda erased-  by writing `@0` or `@erased` after the lambda:-  ```agda-  @0 _ : @0 Set → Set-  _ = λ @0 { A → A }--  @0 _ : @0 Set → Set-  _ = λ @erased where-    A → A-  ```--  The reflection machinery currently does not support erased-  pattern-matching lambdas (they are quoted as regular-  pattern-matching lambdas).--* New (?) rule for modalities of generalised variables-  (see [#5058](https://github.com/agda/agda/issues/5058)).--  The new rule is that generalisable variables get the modality that-  they are declared with, whereas other variables always get the-  default modality. (It is unclear what the old rule was, perhaps-  nothing was changed.)--* Private abstract type signatures can no longer see through abstract-  (see [#418](https://github.com/agda/agda/issues/418)).--  This means that abstract definitions no longer evaluate in *any*-  type signatures in the same module. Previously they evaluated in-  type signatures of definitions that were both private and abstract.--  It also means that metavariables in type signatures have to be-  solved locally, and cannot make use of information in the definition-  body, and that constructors of abstract datatypes are not in scope-  in type signatures.--* Type inference is disabled for abstract definitions (see-  [#418](https://github.com/agda/agda/issues/418)).--  This means that abstract definitions (inluding functions defined in-  `where` blocks of abstract definitions) need complete type-  signatures.--* One can now declare syntax with two name parts without any hole in-  between, and syntax without any holes.--  Examples:-  ```agda-  syntax Σ A (λ x → B) = [ x ∶ A ] × B-  syntax []            = [ ]-  ```--* Internalised the *inspect idiom* that allows users to abstract over-  an expression in a ``with`` clause while, at the same time,-  remembering the origin of the abstracted pattern via an equation.--  In the following example, abstracting over and then matching on the-  result of ``p x`` allows the first call to ``filter p (x ∷ xs)`` to-  reduce.--  In case the element ``x`` is kept, the second call to ``filter`` on-  the LHS then performs the same ``p x`` test. Because we have-  retained the proof that ``p x ≡ true`` in ``eq``, we are able to-  rewrite by this equality and get it to reduce too.--  This leads to just enough computation that we can finish the proof-  with an appeal to congruence and the induction hypothesis.--  ```agda-  filter-filter : ∀ p xs → filter p (filter p xs) ≡ filter p xs-  filter-filter p []       = refl-  filter-filter p (x ∷ xs) with p x in eq-  ... | false = filter-filter p xs -- easy-  ... | true -- second filter stuck on `p x`: rewrite by `eq`!-    rewrite eq = cong (x ∷_) (filter-filter p xs)-  ```--* As a consequence of the above extensions to `with`, lambdas and lets-  now need parentheses when appearing in a `with`. For instance,--  ```agda-  with-on-fun : Nat → Nat-  with-on-fun n with (λ m → m + n)  -- parentheses required!-  ... | f = f n-  ```--* It is now possible to add hiding and relevance annotations to `with`-  expressions. For example:--  ```agda-  module _ (A B : Set) (recompute : .B → .{{A}} → B) where--    _$_ : .(A → B) → .A → B-    f $ x with .{f} | .(f x) | .{{x}}-    ... | y = recompute y-  ```--Builtins------------ Primitive operations for floating-point numbers changed. The equalities now-  follow IEEE 754 equality, after unifying all NaNs. Primitive inequality was-  added:-  ```agda-  primFloatEquality   : Float -> Float -> Bool -- from primFloatNumericEquality-  primFloatLess       : Float -> Float -> Bool -- from primFloatNumericLess-  primFloatInequality : Float -> Float -> Bool -- new-  ```-  The “numeric” relations are now deprecated.--  There are several new predicates on floating-point numbers:-  ```agda-  primFloatIsInfinite     : Float -> Bool -- new-  primFloatIsNaN          : Float -> Bool -- new-  primFloatIsSafeInteger  : Float -> Bool -- new-  ```-  The `primFloatIsSafeInteger` function determines whether the value is a number-  that is a safe integer, i.e., is within the range where the arithmetic-  operations do not lose precision.--  The operations for conversion to integers (`primRound`, `primFloor`,-  and `primCeiling`) were renamed for consistency, and return a value-  of type `Maybe Int`, returning `nothing` for NaN and the infinities:-  ```agda-  primFloatRound   : Float → Maybe Int -- from primRound-  primFloatFloor   : Float → Maybe Int -- from primFloor-  primFloatCeiling : Float → Maybe Int -- from primCeiling-  ```--  There are several new conversions:-  ```agda-  primIntToFloat    : Int -> Float               -- new-  primFloatToRatio  : Float -> (Int × Nat)       -- new-  primRatioToFloat  : Int -> Nat -> Float        -- new-  primFloatDecode   : Float -> Maybe (Int × Int) -- new-  primFloatEncode   : Int -> Int -> Maybe Float  -- new-  ```-  The `primFloatDecode` function decodes a floating-point number f to a mantissa-  and exponent, such that `f = mantissa * 2 ^ exponent`, normalised such that-  the mantissa is the smallest possible number. The `primFloatEncode` function-  encodes a pair of a mantissa and exponent to a floating-point number.--  There are several new operations:-  ```agda-  primFloatPow        : Float -> Float -> Float -- new-  primFloatATan2      : Float -> Float -> Float -- from primATan2-  primFloatSinh       : Float -> Float          -- new-  primFloatCosh       : Float -> Float          -- new-  primFloatTanh       : Float -> Float          -- new-  primFloatASinh      : Float -> Float          -- new-  primFloatACosh      : Float -> Float          -- new-  primFloatATanh      : Float -> Float          -- new-  ```-  Furthermore, the following operations were renamed for consistency:-  ```agda-  primFloatExp        : Float -> Float          -- from primExp-  primFloatSin        : Float -> Float          -- from primSin-  primFloatLog        : Float -> Float          -- from primLog-  primFloatCos        : Float -> Float          -- from primCos-  primFloatTan        : Float -> Float          -- from primTan-  primFloatASin       : Float -> Float          -- from primASin-  primFloatACos       : Float -> Float          -- from primACos-  primFloatATan       : Float -> Float          -- from primATan-  ```--  All of these operations are implemented on the JavaScript backend.--- `primNatToChar` maps surrogate code points to the replacement character-  `'U+FFFD` and surrogate code points are disallowed in character literals--  [Surrogate code points](https://www.unicode.org/glossary/#surrogate_code_point)-  are characters in the range `U+D800` to `U+DFFF` and are reserved for use by-  UTF-16.--  The reason for this change is that strings are represented (at type-checking-  time and in the GHC backend) by Data.Text byte strings, which cannot-  represent surrogate code points and replaces them by `U+FFFD`. By doing the-  same for characters we can have `primStringFromList` be injective (witnessed-  by `Agda.Builtin.String.Properties.primStringFromListInjective`).---Reflection-------------- New operation in `TC` monad, similar to `quoteTC` but operating on-  types in `Setω`-  ```agda-  quoteωTC : ∀ {A : Setω} → A → TC Term-  ```-- `typeError` and `debugPrint` no longer inserts spaces around `termErr` and-  `nameErr` parts. They also do a better job of respecting line breaks in-  `strErr` parts.--- The reflection machinery now supports quantities in `Arg` (see-  [#5317](https://github.com/agda/agda/issues/5317)). The `ArgInfo`-  type has changed, and there are new types `Modality` and `Quantity`:-  ```agda-  data Quantity : Set where-    quantity-0 quantity-ω : Quantity--  {-# BUILTIN QUANTITY   Quantity   #-}-  {-# BUILTIN QUANTITY-0 quantity-0 #-}-  {-# BUILTIN QUANTITY-ω quantity-ω #-}--  data Modality : Set where-    modality : (r : Relevance) (q : Quantity) → Modality--  {-# BUILTIN MODALITY             Modality #-}-  {-# BUILTIN MODALITY-CONSTRUCTOR modality #-}--  data ArgInfo : Set where-    arg-info : (v : Visibility) (m : Modality) → ArgInfo-  ```--- The representation of reflected patterns and clauses has-  changed. Each clause now includes a telescope with the names and-  types of the pattern variables.--  ```agda-  data Clause where-    clause        : (tel : List (Σ String λ _ → Arg Type)) (ps : List (Arg Pattern)) (t : Term) → Clause-    absurd-clause : (tel : List (Σ String λ _ → Arg Type)) (ps : List (Arg Pattern)) → Clause-  ```--  These telescopes provide additional information on the types of-  pattern variables that was previously hard to reconstruct (see-  [#2151](https://github.com/agda/agda/issues/2151)). When unquoting a-  clause, the types in the clause telescope are currently ignored (but-  this is subject to change in the future).--  Three constructors of the `Pattern` datatype were also changed:--  * pattern variables now refer to a de Bruijn index (relative to the-    clause telescope) rather than a string,-  * absurd patterns take a de Bruijn index and are expected to be bound by the-    clause telescope,-  * dot patterns now include the actual dotted term.--  ```agda-  data Pattern where-    con    : (c : Name) (ps : List (Arg Pattern)) → Pattern-    dot    : (t : Term)    → Pattern   -- previously:   dot : Pattern-    var    : (x : Nat)     → Pattern   -- previously:   var : (x : String) → Pattern-    lit    : (l : Literal) → Pattern-    proj   : (f : Name)    → Pattern-    absurd : (x : Nat)     → Pattern-  ```--  It is likely that this change to the reflected syntax requires you-  to update reflection code written for previous versions of-  Agda. Here are some tips for updating your code:--  * When quoting a clause, you can recover the name of a pattern-    variable by looking up the given index in the clause-    telescope. The contents of dot patterns can safely be ignored-    (unless you have a use for them).--  * When creating a new clause for unquoting, you need to create a-    telescope for the types of the pattern variables. To get back the-    old behaviour of Agda, it is sufficient to set all the types of-    the pattern variables to `unknown`. So you can construct the-    telescope by listing the names of all pattern variables and absurd-    patterns together with their `ArgInfo`. Meanwhile, the pattern-    variables should be numbered in order to update them to the new-    representation. As for the telescope types, the contents of a-    `dot` pattern can safely be set to `unknown`.--- New operation in `TC` monad, `execTC`, which calls an external executable-  ```agda-  execTC : (exe : String) (args : List String) (stdIn : String)-         → TC (Σ Nat (λ _ → Σ String (λ _ → String)))-  ```-  The `execTC` builtin takes three arguments: the basename of the-  executable (e.g., `"echo"`), a list of arguments, and the contents-  of the standard input. It returns a triple, consisting of the exit-  code (as a natural number), the contents of the standard output, and-  the contents of the standard error.--  The builtin is only available when `--allow-exec` is passed. (Note-  that `--allow-exec` is incompatible with ``--safe``.) To make an-  executable available to Agda, add the absolute path on a new line in-  `~/.agda/executables`.--- Two new operations in the `TC` monad, `onlyReduceDefs` and-  `dontReduceDefs`:-  ```agda-  onlyReduceDefs : ∀ {a} {A : Set a} → List Name → TC A → TC A-  dontReduceDefs : ∀ {a} {A : Set a} → List Name → TC A → TC A-  ```-  These functions allow picking a specific set of functions that-  should (resp. should not) be reduced while executing the given `TC`-  computation.--  For example, the following macro unifies the current hole with the-  term `3 - 3`:-  ```agda-  macro₁ : Term -> TC ⊤-  macro₁ goal = do-    u   ← quoteTC ((1 + 2) - 3)-    u'  ← onlyReduceDefs (quote _+_ ∷ []) (normalise u)-    unify u' goal-  ```-- New operation in the `TC` monad, `withReconstructed`:-  ```agda-  withReconstructed : ∀ {a} {A : Set a} → TC A → TC A-  ```--  This function ensures reconstruction of hidden parameters-  after performing the `TC` computation.  For example, consider the-  following type and function:-  ```agda-  record RVec {a} (X : Set a) (n : Nat) : Set a where-    constructor vec-    field sel : Fin n → X--  test-rvec : Nat → RVec Nat 5-  test-rvec x = vec λ _ → x-  ```--  In the reflected syntax the body of the `test-rvec` would be represented-  as `con vec (unknown ∷ unknown ∷ unknown ∷ (lam _ x)`.  The use of-  `withReconstructed` replaces `unknown`s with the actual values:-  ```agda-  macro₂ : Name → Term → TC ⊤-  macro₂ n hole = do-    (function (clause tel ps t ∷ [])) ←-      withReconstructed (getDefinition n)-      where _ → quoteTC "ERROR" >>= unify hole-    quoteTC t >>= unify hole-  ```--- Three new constructors in the `Sort` datatype, `prop : Level →-  Sort`, `propLit : Nat → Sort`, and `inf : Nat → Sort`, representing-  the sorts `Prop ℓ`, `Propᵢ`, and `Setωᵢ`.--- Terms that belong to a type in `Prop` are no longer unquoted to-  `unknown` but to a proper `Term`. (See-  [#3553](https://github.com/agda/agda/issues/3553).)--Library management---------------------- `.agda-lib` files can now contain an extra field `flags:` with-  default flags for the library. Flags can be any flags that are-  accepted as part of an `{-# OPTIONS ... #-}` pragma. For example,-  file `my-library.agda-lib` with--  ```-  flags: --without-K-  ```--  will apply the `--without-K` flag to all Agda files in the current-  directory and (recursive) subdirectories that do not themselves-  contain an `.agda-lib` file.---Emacs mode-------------* New command prefix `C-u C-u C-u` for weak-head normalization. For instance,-  given--  ```agda-  downFrom : Nat → List Nat-  downFrom 0 = []-  downFrom (suc n) = n ∷ downFrom n-  ```--  `C-u C-u C-u C-c C-n downFrom 5` returns `4 ∷ downFrom 4`.--* New keyboard shortcut `C-c C-x C-i` for toggling display of-  irrelevant arguments.--* One can no longer use commands like `M-;` (`comment-dwim`) to-  uncomment block comments. In return one can use `M-;` to comment out-  pragmas. (See [#3329](https://github.com/agda/agda/issues/3329).)--JSON Interaction mode------------------------Changes have been made to the structure of error and warning-messages. The changes are summarized below. See-[#5052](https://github.com/agda/agda/issues/5052) for additional-details.--* The format of an error or warning was previously a bare string. Now, errors-  and warnings are represented by an object with a `"message"` key.--  This means that responses _previously_ structured like:--  ```json-  {"…": "…", "error": "Foo bar baz"}-  ```--  will now be structured:--  ```json-  {"…": "…", "error": {"message": "Foo bar baz"}}-  ```--  This applies directly to the `PostPonedCheckFunDef` response kind-  and `Error` info kind of the `DisplayInfo` response kind.--* The format of collections of errors or warnings, which previously were each-  represented by a single newline-joined string, has been updated to represent-  each warning or error individually in a list.--  That means that responses _previously_ structured like:--  ```json-  { "…": "…"-  , "errors": "Postulates overcooked\nAxioms too wiggly"-  , "warnings": "Something wrong\nSomething else\nwrong"-  }-  ```--  will now be structured:--  ```json-  { "…": "…"-  , "errors":-    [ { "message": "Postulates overcooked" }-    , { "message": "Axioms too wiggly" }-    ]-  , "warnings":-    [ { "message": "Something wrong" }-    , { "message": "Something else\nwrong" }-    ]-  }-  ```--  This applies to `CompilationOk`, `AllGoalsWarning`, and `Error` info-  kinds of the `DisplayInfo` response kind.--* The `Error` info kind of the `DisplayInfo` response kind has-  additionally been updated to distinguish warnings and errors.--  An example of the _previous_ format of a `DisplayInfo` response with-  an `Error` info kind was:-  ```json-  {-    "kind": "DisplayInfo",-    "info": {-      "kind": "Error",-      "message": "———— Error —————————————————————————————————————————————————\n/data/code/agda-test/Test.agda:2,1-9\nFailed to find source of module M in any of the following\nlocations:\n  /data/code/agda-test/M.agda\n  /data/code/agda-test/M.lagda\nwhen scope checking the declaration\n  import M\n\n———— Warning(s) ————————————————————————————————————————————\n/data/code/agda-test/Test.agda:3,1-10\nEmpty postulate block."-    }-  }-  ```--  The updated format is:-  ```json-  {-    "kind": "DisplayInfo",-    "info": {-      "kind": "Error",-      "error": {-        "message": "/data/code/agda-test/Test.agda:2,1-9\nFailed to find source of module M in any of the following\nlocations:\n  /data/code/agda-test/M.agda\n  /data/code/agda-test/M.lagda\nwhen scope checking the declaration\n  import M"-      },-      "warnings": [-        {-          "message": "/data/code/agda-test/Test.agda:3,1-10\nEmpty postulate block."-        }-      ]-    }-  }-  ```--Compiler backends -------------------- With option `--allow-unsolved-metas`, code with holes can be compiled.-  If a hole is reached at runtime, the compiled program crashes.-  See issue [#5103](https://github.com/agda/agda/issues/5103)--- Previously the GHC backend compiled at least one instance of Hinze's-  memoisation technique from ["Memo functions,-  polytypically!"](http://www.cs.ox.ac.uk/ralf.hinze/publications/index.html#P11)-  to reasonably efficient code. That is no longer the case (at least-  for that particular instance, see-  [#5153](https://github.com/agda/agda/issues/5153)).--LaTeX backend----------------- The spacing in comments is now preserved when generating LaTex files-  from literate Agda.  See-  [#5320](https://github.com/agda/agda/pull/5320) for more details.--HTML backend---------------- The named `id` attributes for local modules inside local modules are-  now different (see [#5335](https://github.com/agda/agda/pull/5320)).--  For instance, consider the following Agda file:-  ```agda-  module Top-level where--    module Inner where--      module Inside-inner where-  ```-  Previously one could link to the module `Inside-inner` using a URL-  that ended with `#Inside-inner`. Now one can use-  `#Inner.Inside-inner` instead.--JS backend-------------- Smaller local variable names in the generated JS code.--  Previously: `x0`, `x1`, `x2`, ...--  Now: `a`, `b`, `c`, ..., `z`, `a0`, `b0`, ..., `z0`, `a1`, `b1`, ...--- Improved indentation of generated JS code.--- More compact rendering of generated JS functions.--  Previously:-  ```js-  exports["N"]["suc"] = function (x0) {-      return function (x1) {-        return x1["suc"](x0);-      };-    };-  ```--  Now:-  ```js-  exports["N"]["suc"] = a => b => b["suc"](a);-  ```--- Irrelevant arguments are now erased in the generated JS code.--  Example Agda code:-  ```agda-  flip : {A B C : Set} -> (B -> A -> C) -> A -> B -> C-  flip f a b = f b a-  ```--  Previously generated JS code:-  ```js-  exports["flip"] = function (x0) {-      return function (x1) {-        return function (x2) {-          return function (x3) {-            return function (x4) {-              return function (x5) {-                return x3(x5)(x4);-              };-            };-          };-        };-      };-    };-  ```--  JS code generated now:-  ```js-  exports["flip"] = a => b => c => a(c)(b);-  ```--- Record fields are not stored separately (the fields are stored only-  in the constructor) in the generated JS code.--  Example Agda code:-  ```agda-  record Sigma (A : Set) (B : A -> Set) : Set where-    field-      fst : A-      snd : B fst-  ```--  Previously generated JS code (look at the `"fst"` and `"snd"` fields in the-  return value of `exports["Sigma"]["record"]`:-  ```js-  exports["Sigma"] = {};-  exports["Sigma"]["fst"] = function (x0) {-      return x0["record"]({-        "record": function (x1, x2) {-          return x1;-        }-      });-    };-  exports["Sigma"]["snd"] = function (x0) {-      return x0["record"]({-        "record": function (x1, x2) {-          return x2;-        }-      });-    };-  exports["Sigma"]["record"] = function (x0) {-      return function (x1) {-        return {-          "fst": x0,-          "record": function (x2) {-            return x2["record"](x0, x1);-          },-          "snd": x1-        };-      };-    };-  ```--  JS code generated now:-  ```js-  exports["Sigma"] = {};-  exports["Sigma"]["fst"] = a => a["record"]({"record": (b,c) => b});-  exports["Sigma"]["snd"] = a => a["record"]({"record": (b,c) => c});-  exports["Sigma"]["record"] = a => b => ({"record": c => c["record"](a,b)});-  ```--- `--js-optimize` flag has been added to the `agda` compiler.--  With `--js-optimize`, `agda` does not wrap records in JS objects.--  Example Agda code:-  ```agda-  record Sigma (A : Set) (B : A -> Set) : Set where-    field-      fst : A-      snd : B fst-  ```--  JS code generated without the `--js-optimize` flag:-  ```js-  exports["Sigma"] = {};-  exports["Sigma"]["fst"] = a => a["record"]({"record": (b,c) => b});-  exports["Sigma"]["snd"] = a => a["record"]({"record": (b,c) => c});-  exports["Sigma"]["record"] = a => b => ({"record": c => c["record"](a,b)});-  ```--  JS code generated with the `--js-optimize` flag:-  ```js-  exports["Sigma"] = {};-  exports["Sigma"]["fst"] = a => a((b,c) => b);-  exports["Sigma"]["snd"] = a => a((b,c) => c);-  exports["Sigma"]["record"] = a => b => c => c(a,b);-  ```--  With `--js-optimize`, `agda` uses JS arrays instead of JS objects.-  This is possible because constructor names are not relevant during the evaluation.--  Example Agda code:-  ```agda-  data Bool : Set where-    false : Bool-    true  : Bool--  not : Bool -> Bool-  not false = true-  not true  = false-  ```--  JS code generated without the `--js-optimize` flag:-  ```js-  exports["Bool"] = {};-  exports["Bool"]["false"] = a => a["false"]();-  exports["Bool"]["true"] = a => a["true"]();-  exports["not"] = a => a({-      "false": () => exports["Bool"]["true"],-      "true": () => exports["Bool"]["false"]-    });-  ```--  JS code generated with the `--js-optimize` flag:-  ```js-  exports["Bool"] = {};-  exports["Bool"]["false"] = a => a[0/* false */]();-  exports["Bool"]["true"] = a => a[1/* true */]();-  exports["not"] = a => a([-      /* false */() => exports["Bool"]["true"],-      /* true */() => exports["Bool"]["false"]-    ]);-  ```--  Note that comments are added to generated JS code to help human readers.--  Erased branches are replaced by `null` in the generated array.  If-  more than the half of branches are erased, the array is compressed-  to be a object like `{3: ..., 13: ...}`.--- `--js-minify` flag has been added to the `agda` compiler.--  With `--js-minify`, `agda` discards comments and whitespace in the-  generated JS code.---Agda as a library (API)--------------------------* The `SourceInfo` record has been renamed to `Source`, and the-  `sourceInfo` function to `parseSource`.--Other issues---------------For 2.6.2, the following issues were also closed (see [bug-tracker](https://github.com/agda/agda/issues)):--  -  [#418](https://github.com/agda/agda/issues/418): Unifier ignores presence of abstract keyword-  -  [#958](https://github.com/agda/agda/issues/958): Module application display forms in parameterised modules-  -  [#1145](https://github.com/agda/agda/issues/1145): Allow multiple layout keywords on the same line-  -  [#2151](https://github.com/agda/agda/issues/2151): Add TC primitive to check left-hand side-  -  [#2461](https://github.com/agda/agda/issues/2461): Support with in the presence of IApply patterns-  -  [#2858](https://github.com/agda/agda/issues/2858): Feature request: Interleaving mutually-defined functions & datatypes-  -  [#3000](https://github.com/agda/agda/issues/3000): Interaction: iterated give encounters internal error-  -  [#3118](https://github.com/agda/agda/issues/3118): Feature request: default flags in .agda-lib file-  -  [#3289](https://github.com/agda/agda/issues/3289): Postfix projections should not have hiding information-  -  [#3360](https://github.com/agda/agda/issues/3360): Make Emacs mode available as a normal package via MELPA-  -  [#3365](https://github.com/agda/agda/issues/3365): Update GitHub linguist syntax highlight file-  -  [#3398](https://github.com/agda/agda/issues/3398): With the option --allow-unsolved-metas, the unsolved metas are not shown, only yellow-  -  [#3422](https://github.com/agda/agda/issues/3422): Show names of instance candidates in error message-  -  [#3486](https://github.com/agda/agda/issues/3486): Elaborate-and-give shouldn't reduce solution-  -  [#3532](https://github.com/agda/agda/issues/3532): Refine does not work for functions with 10 arguments or more-  -  [#3538](https://github.com/agda/agda/issues/3538): Regression: Rewrite rule involving constructors rejected in parametrized module-  -  [#3588](https://github.com/agda/agda/issues/3588): Refine suggests overloaded constructor which is not in scope-  -  [#3627](https://github.com/agda/agda/issues/3627): Where-blocks of clauses with irrelevant projections can use irrelevant variables-  -  [#3644](https://github.com/agda/agda/issues/3644): Error message without position-  -  [#3672](https://github.com/agda/agda/issues/3672): Better error messages for generalize easter eggs-  -  [#3684](https://github.com/agda/agda/issues/3684): Make error about non-existent record field a warning?-  -  [#3734](https://github.com/agda/agda/issues/3734): WARNING_ON_USAGE is not raised for constructors-  -  [#3744](https://github.com/agda/agda/issues/3744): Internal error related to abstract-  -  [#3870](https://github.com/agda/agda/issues/3870): Internal error during instance search-  -  [#3926](https://github.com/agda/agda/issues/3926): Document the effect of `mutual` to the order of type checking-  -  [#3933](https://github.com/agda/agda/issues/3933): `import` can remove definitions from scope-  -  [#3961](https://github.com/agda/agda/issues/3961): Missing documentation for coverage checking-  -  [#4071](https://github.com/agda/agda/issues/4071): Ill-scoped code in error message-  -  [#4088](https://github.com/agda/agda/issues/4088): Strange scoping rules for irrefutable with, part 2-  -  [#4093](https://github.com/agda/agda/issues/4093): Make it possible to rename Set?-  -  [#4109](https://github.com/agda/agda/issues/4109): cannot declare data types in Setω-  -  [#4131](https://github.com/agda/agda/issues/4131): Record definition doesn't compile without a specific `let` binding-  -  [#4132](https://github.com/agda/agda/issues/4132): The regular expression for floats in the lexer is too liberal-  -  [#4135](https://github.com/agda/agda/issues/4135): Constructor disambiguation picks non-unique solution-  -  [#4157](https://github.com/agda/agda/issues/4157): Agda gets confused by multiple anonymous definitions in a single mutual block-  -  [#4160](https://github.com/agda/agda/issues/4160): Printing implicit lambdas with --show-implicit-  -  [#4161](https://github.com/agda/agda/issues/4161): An alternative solution for hGetContent error on Windows when non-English-  -  [#4166](https://github.com/agda/agda/issues/4166): Instances that are not in scope are candidates for instance resolution-  -  [#4208](https://github.com/agda/agda/issues/4208): Field named `_` in `genTel` record-  -  [#4252](https://github.com/agda/agda/issues/4252): Interaction ids get conflated after iterated give-  -  [#4265](https://github.com/agda/agda/issues/4265): Unsolved constraints when --no-syntactic-equality is used-  -  [#4280](https://github.com/agda/agda/issues/4280): Test case for #4169 fails in JS backend-  -  [#4291](https://github.com/agda/agda/issues/4291): Incorrect names can be generated for generalised variables-  -  [#4341](https://github.com/agda/agda/issues/4341): The documentation of inContext seems wrong.-  -  [#4350](https://github.com/agda/agda/issues/4350): Scoping bug with let open in telescope-  -  [#4365](https://github.com/agda/agda/issues/4365): Module fails to type check after parametrising it by postulates-  -  [#4400](https://github.com/agda/agda/issues/4400): TERMINATING pragma in where clause-  -  [#4425](https://github.com/agda/agda/issues/4425): [doc] What are .agdai files?-  -  [#4456](https://github.com/agda/agda/issues/4456): No error highlighting for error warnings?-  -  [#4458](https://github.com/agda/agda/issues/4458): The command agda2-measure-load-time is broken-  -  [#4481](https://github.com/agda/agda/issues/4481): Named implicit arguments do not behave the same in anonymous lambdas & definitions-  -  [#4482](https://github.com/agda/agda/issues/4482): "Unexpected implicit argument" should pinpoint exactly where the error starts-  -  [#4486](https://github.com/agda/agda/issues/4486): "did you mean" hint also for failing imports-  -  [#4491](https://github.com/agda/agda/issues/4491): Add a primitive for Data.Text's uncons-  -  [#4516](https://github.com/agda/agda/issues/4516): Internal error if files cannot be written to the directory for temporary files-  -  [#4518](https://github.com/agda/agda/issues/4518): Confusing error message if missing import-  -  [#4520](https://github.com/agda/agda/issues/4520): Better error for ambiguous BUILTIN [FROMNAT no longer working]-  -  [#4521](https://github.com/agda/agda/issues/4521): Massive increase in memory required to install Agda 2.6.1-  -  [#4526](https://github.com/agda/agda/issues/4526): Agda 2.6.1 bad performance: findProjectConfig slow in big directories-  -  [#4528](https://github.com/agda/agda/issues/4528): Internal error due to new forcing translation-  -  [#4530](https://github.com/agda/agda/issues/4530): Less normalization of goal types for instance search-  -  [#4534](https://github.com/agda/agda/issues/4534): [reflection] quote is not a defined name-  -  [#4536](https://github.com/agda/agda/issues/4536): co-pattern matching on empty record type removes body-  -  [#4538](https://github.com/agda/agda/issues/4538): changing the predefined precedence of an operator-  -  [#4543](https://github.com/agda/agda/issues/4543): Access violation on Windows on GHC 8.8.3, 8.8.4, 8.10.1 and 8.10.2-  -  [#4550](https://github.com/agda/agda/issues/4550): Documentation build: malformed code-block-  -  [#4556](https://github.com/agda/agda/issues/4556): [documentation] update hello world-  -  [#4557](https://github.com/agda/agda/issues/4557): activate github's discussions beta-  -  [#4560](https://github.com/agda/agda/issues/4560): Loss of canonicity with no-eta record and copatterns.-  -  [#4572](https://github.com/agda/agda/issues/4572): add PiSort and UnivSort to the documentation-  -  [#4576](https://github.com/agda/agda/issues/4576): quoteTC for Setω-  -  [#4580](https://github.com/agda/agda/issues/4580): No highlighting for pragmas FROMNAT, FROMNEG, FROMSTRING-  -  [#4583](https://github.com/agda/agda/issues/4583): QuickLaTeX backend does not highlight coinductive constructors as such-  -  [#4586](https://github.com/agda/agda/issues/4586): Better error message  for "Not a valid let declaration"-  -  [#4593](https://github.com/agda/agda/issues/4593): The blocking machinery seems to be broken-  -  [#4595](https://github.com/agda/agda/issues/4595): Should Setω be a type?-  -  [#4596](https://github.com/agda/agda/issues/4596): Improve pattern matching on records in telescopes-  -  [#4606](https://github.com/agda/agda/issues/4606): The combination of Cubical Agda with inductive families is logically inconsistent-  -  [#4610](https://github.com/agda/agda/issues/4610): Support Emacs 27.1-  -  [#4615](https://github.com/agda/agda/issues/4615): Enable --no-sort-comparison by default?-  -  [#4621](https://github.com/agda/agda/issues/4621): Make --rewriting infective-  -  [#4623](https://github.com/agda/agda/issues/4623): Empty where blocks should get dead code warnings-  -  [#4631](https://github.com/agda/agda/issues/4631): Non-linear patterns handled in a buggy way-  -  [#4637](https://github.com/agda/agda/issues/4637): recCon-NOT-PRINTED in termination error in connection to with-  -  [#4638](https://github.com/agda/agda/issues/4638): Erased constructors-  -  [#4649](https://github.com/agda/agda/issues/4649): Repair Agda's REPL (agda -I) to work with --safe flag-  -  [#4656](https://github.com/agda/agda/issues/4656): Function name not wrapped in `\AgdaFunction` in generated LaTeX-  -  [#4662](https://github.com/agda/agda/issues/4662): Current module contents-  -  [#4665](https://github.com/agda/agda/issues/4665): Documentation: add install instructions for stack-  -  [#4671](https://github.com/agda/agda/issues/4671): Weird error message on case-insensitive file systems-  -  [#4679](https://github.com/agda/agda/issues/4679): Cubical: giving seems to skip the boundary condition check for extended lambdas-  -  [#4681](https://github.com/agda/agda/issues/4681): Get rid of auto-inlining?-  -  [#4684](https://github.com/agda/agda/issues/4684): Type error due to --no-syntactic-equality-  -  [#4687](https://github.com/agda/agda/issues/4687): Instance search fails with two equal candidates-  -  [#4704](https://github.com/agda/agda/issues/4704): Case-split generates invalid code-  -  [#4707](https://github.com/agda/agda/issues/4707): Just warn when `using` directive has repetitions-  -  [#4721](https://github.com/agda/agda/issues/4721): de Bruijn index out of scope when using rewriting-  -  [#4727](https://github.com/agda/agda/issues/4727): Meta-variable solutions contain subterms with the wrong modality-  -  [#4735](https://github.com/agda/agda/issues/4735): primShowQName creates not-in-scope names-  -  [#4737](https://github.com/agda/agda/issues/4737): Turn error `Hiding ... has no effect` into a warning-  -  [#4750](https://github.com/agda/agda/issues/4750): Unification failure in 2.6.1 and the master branch-  -  [#4752](https://github.com/agda/agda/issues/4752): Panic on unbound variable with pattern synonym-  -  [#4768](https://github.com/agda/agda/issues/4768): De Bruijn index @0 in error "Not a finite domain"-  -  [#4769](https://github.com/agda/agda/issues/4769): mergeEqualPs ignores Name and ArgInfo of merged-in patterns-  -  [#4772](https://github.com/agda/agda/issues/4772): C-u C-u C-c C-? should show all goals normalized (Cmd_metas)-  -  [#4773](https://github.com/agda/agda/issues/4773): Missing does-not-export warning for `open` directive for parametrised module-  -  [#4775](https://github.com/agda/agda/issues/4775): Internal error when trying to use incorrect lambda syntax to pattern match-  -  [#4784](https://github.com/agda/agda/issues/4784): Make erasure compatible with univalence-  -  [#4795](https://github.com/agda/agda/issues/4795): Build "agda-tests" fails using dynamic linking-  -  [#4815](https://github.com/agda/agda/issues/4815): Current master fails compilation: binding for 'error' shadows the existing binding-  -  [#4828](https://github.com/agda/agda/issues/4828): Symlinks are incorrectly followed during compilation-  -  [#4833](https://github.com/agda/agda/issues/4833): Internal error: cannot type-check file-  -  [#4851](https://github.com/agda/agda/issues/4851): BUILTIN SIGMA and --type-in-type-  -  [#4852](https://github.com/agda/agda/issues/4852): First load the file-  -  [#4857](https://github.com/agda/agda/issues/4857): Instance argument is printed as explicit argument-  -  [#4869](https://github.com/agda/agda/issues/4869): Internal error at src/full/Agda/TypeChecking/Serialise/Instances/Internal.hs:147-  -  [#4880](https://github.com/agda/agda/issues/4880): Non-dependent, irrelevant, nameless arguments aren't accepted in arrows-  -  [#4882](https://github.com/agda/agda/issues/4882): Missing `reduce` in `literalStrategy`-  -  [#4888](https://github.com/agda/agda/issues/4888): "Illegal declaration(s) before top-level module" in Agda 2.6.1-  -  [#4909](https://github.com/agda/agda/issues/4909): Rewrite rule not accepted with --no-fast-reduce-  -  [#4924](https://github.com/agda/agda/issues/4924): Instance resolution loops infinitely even when an instance is available-  -  [#4925](https://github.com/agda/agda/issues/4925): Too aggressive literal overloading-  -  [#4928](https://github.com/agda/agda/issues/4928): Internal error checking cubical library-  -  [#4929](https://github.com/agda/agda/issues/4929): Regression in 2.6.1 connected to forcing translation (internal error)-  -  [#4944](https://github.com/agda/agda/issues/4944): Generalize: stuck on constraint ↑ i =< ↑ (↑ i) : Size-  -  [#4946](https://github.com/agda/agda/issues/4946): Size polarity brittle with generalization-  -  [#4949](https://github.com/agda/agda/issues/4949): Cubical: internal error in eta-expansion under constraints-  -  [#4950](https://github.com/agda/agda/issues/4950): Range too large in complaint about missing definitions-  -  [#4951](https://github.com/agda/agda/issues/4951): Data types in Setω are treated as non-fibrant-  -  [#4952](https://github.com/agda/agda/issues/4952): Incorrect HTML generated for renaming clause-  -  [#4962](https://github.com/agda/agda/issues/4962): JS backend: bugs involving "null"-  -  [#4967](https://github.com/agda/agda/issues/4967): Crazy bug when defining Ord instances for Int-  -  [#4970](https://github.com/agda/agda/issues/4970): `variable` use adds explicit argument-  -  [#4975](https://github.com/agda/agda/issues/4975): "no such meta variable" when calling `C-u C-c C-;`-  -  [#4982](https://github.com/agda/agda/issues/4982): Internal error related to Cubical Agda-  -  [#4986](https://github.com/agda/agda/issues/4986): Pattern matching allows you to turn `(x y : A) -> A` into `(@0 x y : A) -> A`-  -  [#4995](https://github.com/agda/agda/issues/4995): No Cycle should not look under lambdas.-  -  [#4998](https://github.com/agda/agda/issues/4998): Make case in clause with instance projection does not work-  -  [#4999](https://github.com/agda/agda/issues/4999): `primStringFromList` is not injective because of surrogate code points-  -  [#5002](https://github.com/agda/agda/issues/5002): Bad JavaScript generated-  -  [#5005](https://github.com/agda/agda/issues/5005): Add flag to print AGDA_DIR and exit-  -  [#5029](https://github.com/agda/agda/issues/5029): One can override --safe-  -  [#5033](https://github.com/agda/agda/issues/5033): Internal error related to @tick-  -  [#5048](https://github.com/agda/agda/issues/5048): Disturbing names in normalised reflected type-  -  [#5064](https://github.com/agda/agda/issues/5064): Give more information in error "Pattern matching on no-eta record types is by default not allowed"-  -  [#5065](https://github.com/agda/agda/issues/5065): The termination checker is too liberal-  -  [#5079](https://github.com/agda/agda/issues/5079): Deep pattern-matching is sometimes allowed for erased arguments-  -  [#5093](https://github.com/agda/agda/issues/5093): Weird instance propagation between parameterised modules-  -  [#5112](https://github.com/agda/agda/issues/5112): `make install-fix-whitespace` shouldn't use the `stack-X.Y.Z.yaml` files used for Agda-  -  [#5128](https://github.com/agda/agda/issues/5128): getDefinition sometimes loses patterns-  -  [#5133](https://github.com/agda/agda/issues/5133): Current master fails LaTeX-related tests-  -  [#5140](https://github.com/agda/agda/issues/5140): test/LaTeXAndHTML/succeed contains failing tests-  -  [#5146](https://github.com/agda/agda/issues/5146): v2.6.1.2 does not contain MAlonzo/RTE/Float.hs-  -  [#5161](https://github.com/agda/agda/issues/5161): No error location for error in imported module when .agdai file exists-  -  [#5167](https://github.com/agda/agda/issues/5167): Fix broken compatibility with agda-bench-  -  [#5168](https://github.com/agda/agda/issues/5168): User manual: Missing instructions for installing Agda from Hackage using stack-  -  [#5176](https://github.com/agda/agda/issues/5176): `mutual` is deprecated in doc-  -  [#5204](https://github.com/agda/agda/issues/5204): Investigate highlighting failures-  -  [#5205](https://github.com/agda/agda/issues/5205): acmart examples in (user-manual) fail to build with latest TeXLive-  -  [#5207](https://github.com/agda/agda/issues/5207): Agda generated code does not type-check with GHC 9.0-  -  [#5210](https://github.com/agda/agda/issues/5210): Internal error-  -  [#5230](https://github.com/agda/agda/issues/5230): When `stack.yaml` exists, `make` calls `stack`, even on `make debug`-  -  [#5231](https://github.com/agda/agda/issues/5231): Problems compiling hello-world.agda-  -  [#5237](https://github.com/agda/agda/issues/5237): `__IMPOSSIBLE__` from Agda.TypeChecking.Substitute-  -  [#5238](https://github.com/agda/agda/issues/5238): Rewrites are conjuring elements out of thin air-  -  [#5245](https://github.com/agda/agda/issues/5245): An infinite loop?-  -  [#5250](https://github.com/agda/agda/issues/5250): Change of warning options ignored-  -  [#5251](https://github.com/agda/agda/issues/5251): @0 annotation on lambda ignored-  -  [#5252](https://github.com/agda/agda/issues/5252): Internal error when case splitting pattern-lambda with higher rank type-  -  [#5286](https://github.com/agda/agda/issues/5286): Wrong error location with do notation and parse error in lhs-  -  [#5288](https://github.com/agda/agda/issues/5288): Very weird behaviour with compiled Data.Nat.Show.readMaybe-  -  [#5313](https://github.com/agda/agda/issues/5313): Documentation for internal level properties-  -  [#5314](https://github.com/agda/agda/issues/5314): Warn about abstract definitions without type signatures-  -  [#5317](https://github.com/agda/agda/issues/5317): The reflection machinery should support quantities-  -  [#5326](https://github.com/agda/agda/issues/5326): The highlighting code should be optimised-  -  [#5334](https://github.com/agda/agda/issues/5334): Meta-variable in constructor type busts interleaved mutual-  -  [#5335](https://github.com/agda/agda/issues/5335): Incorrect id attributes for local modules inside local modules-  -  [#5336](https://github.com/agda/agda/issues/5336): `data Foo constructor {cs : ts}` notation in `interleaved mutual`-  -  [#5339](https://github.com/agda/agda/issues/5339): `constructor` blocks do not tolerate overloading in same block-  -  [#5341](https://github.com/agda/agda/issues/5341): Do not make context variables non-erased-  -  [#5356](https://github.com/agda/agda/issues/5356): `interleaved mutual`: `data _ where` instead of `constructor`-  -  [#5358](https://github.com/agda/agda/issues/5358): tactic annotation on record field of function type drops domain in copattern definition-  -  [#5367](https://github.com/agda/agda/issues/5367): Parser regression involving `with` and `let`-  -  [#5370](https://github.com/agda/agda/issues/5370): Inconsistency in agda --help-  -  [#5375](https://github.com/agda/agda/issues/5375): Efficient conversion between interaction points and meta-variables-  -  [#5410](https://github.com/agda/agda/issues/5410): Module applications in where clauses of erased definitions yield non-erased code-  -  [#5419](https://github.com/agda/agda/issues/5419): Missing licences?-  -  [#5424](https://github.com/agda/agda/issues/5424): Internal error in v2.6.2 release candidate 1-  -  [#5434](https://github.com/agda/agda/issues/5434): The user manual's explanation of how erasure is checked for constructors does not match the implementation+Release notes for Agda version 2.6.2.1+======================================++Highlights+----------++* Agda 2.6.2.1 catches up to changes in the Haskell ecosystem+  (GHC 9.2.1, `aeson-2.0`, `hashable-1.4.`).++* Fixes some regressions introduced in 2.6.1:+  [#5283](https://github.com/agda/agda/issues/5283)+  [#5506](https://github.com/agda/agda/issues/5506)+  [#5610](https://github.com/agda/agda/issues/5610)++* Fixes some regressions introduced in 2.6.2:+  [#5508](https://github.com/agda/agda/issues/5508)+  [#5544](https://github.com/agda/agda/issues/5544)+  [#5565](https://github.com/agda/agda/issues/5565)+  [#5584](https://github.com/agda/agda/issues/5584)+  [#5620](https://github.com/agda/agda/issues/5620)+  [#5638](https://github.com/agda/agda/issues/5638)+  [#5657](https://github.com/agda/agda/issues/5657)++* Improvements to the compiler backends (see below).++* Feature preview: `--ghc-strict`.++Installation and infrastructure+-------------------------------++Agda 2.6.2.1 is expected to build with GHC versions 8.0 to 9.2.+It has been tested with the latest minor version releases of GHC for+each of these major versions:++  - 8.0.2+  - 8.2.2+  - 8.4.4+  - 8.6.5+  - 8.8.4+  - 8.10.7: Issue [#5539](https://github.com/agda/agda/issues/5539).+  - 9.0.1+  - 9.2.1:+    Issue [#5442](https://github.com/agda/agda/issues/5442),+    stackage issue [#6318](https://github.com/commercialhaskell/stackage/pull/6318).++Agda 2.6.2.1 has been adapted to recent changes in the Haskell ecosystem, including:++  - `Cabal-3.6.2`+  - `aeson-2.0`:+    Issue [#5593](https://github.com/agda/agda/issues/5593),+    stackage issue [#6217](https://github.com/commercialhaskell/stackage/issues/6217).+  - `hashable-1.4`:+    Stackage issue [#6268](https://github.com/commercialhaskell/stackage/issues/6268).+  - `transformers-0.6`++Compiler backends+-----------------++* Both the GHC and JS backends now refuse to compile code that uses+  `--cubical`.++* The new option `--ghc-strict-data`, which is inspired by the GHC+  language extension `StrictData`, makes the GHC backend compile+  inductive data and record constructors to constructors with strict+  arguments.++  This does not apply to certain builtin types—lists, the maybe type,+  and some types related to reflection—and might not apply to types+  with `COMPILE GHC … = data …` pragmas.++  This feature is experimental.++* The new option `--ghc-strict`, which is inspired by the GHC language+  extension `Strict`, makes the GHC backend generate mostly strict+  code.++  Functions might not be strict in unused arguments.++  Function definitions coming from `COMPILE GHC` pragmas are not+  affected.++  This flag implies `--ghc-strict-data`, and the exceptions of that+  flag applies to this flag as well.++  Note that this option requires the use of GHC 9 or later.++  This feature is experimental.++* JS backend now uses the native `BigInt` instead of the+  [biginteger.js](https://github.com/silentmatt/javascript-biginteger).+  Fixes [#4878](https://github.com/agda/agda/issues/4878).++LaTeX backend+-------------++* Files `agda.sty` and `postprocess-latex.pl` are now found in the `latex/`+  subdirectory of the Agda data directory (`agda --print-agda-dir`).++* `agda.sty` is now versioned (printed to the `.log` file by `latex`)+  (see [#5473](https://github.com/agda/agda/issues/5473)).++* Italics correction (inserted by `\textit` e.g. in `\AgdaBound`) now works,+  thanks to moving the `\textcolor` wrapping to the outside in `agda.sty`+  (see [#5471](https://github.com/agda/agda/issues/5471)).++List of closed issues+---------------------++For 2.6.2.1, the following issues were+[closed](https://github.com/agda/agda/issues?q=is%3Aissue+milestone%3A2.6.2.1+is%3Aclosed)+(see [bug tracker](https://github.com/agda/agda/issues)):++  - [#4878](https://github.com/agda/agda/issues/4878): Replace biginteger.js with native BigInt+  - [#5283](https://github.com/agda/agda/issues/5283): Tactic command runs forever+  - [#5291](https://github.com/agda/agda/issues/5291): `match` doesn't work for non-prefix-free cases+  - [#5302](https://github.com/agda/agda/issues/5302): building tests with cabal+  - [#5396](https://github.com/agda/agda/issues/5396): Internal error for rewriting without --confluence-check+  - [#5398](https://github.com/agda/agda/issues/5398): Problem with LaTeX code for multi-line comments with blank lines+  - [#5420](https://github.com/agda/agda/issues/5420): The JS backend generates incorrect code for Agda code that uses reflection+  - [#5421](https://github.com/agda/agda/issues/5421): The GHC backend generates incorrect code for Agda code that uses reflection+  - [#5431](https://github.com/agda/agda/issues/5431): --ghc-strict-data and --ghc-strict+  - [#5433](https://github.com/agda/agda/issues/5433): The JS backend "installs" highlight-hover.js+  - [#5440](https://github.com/agda/agda/issues/5440): (Re)Documenting `catchfilebetweentags` method of building latex files with Agda+  - [#5442](https://github.com/agda/agda/issues/5442): Support GHC 9.2+  - [#5463](https://github.com/agda/agda/issues/5463): Hole in the middle of a record is malformed+  - [#5465](https://github.com/agda/agda/issues/5465): Compilation of Parser.y depends on the locale on Debian too+  - [#5469](https://github.com/agda/agda/issues/5469): `onlyReduceDefs` should not prevent evaluation of macros+  - [#5470](https://github.com/agda/agda/issues/5470): Internal error when using `REWRITE` in `private` block+  - [#5471](https://github.com/agda/agda/issues/5471): LaTeX backend: italics correction+  - [#5473](https://github.com/agda/agda/issues/5473): agda.sty has no version+  - [#5478](https://github.com/agda/agda/issues/5478): Open goal inside record causes internal error (eta-contraction)+  - [#5481](https://github.com/agda/agda/issues/5481): Pattern-matching on records in Prop allows eliminating into Set+  - [#5489](https://github.com/agda/agda/issues/5489): C-c C-x C-a (abort) does not communicate well+  - [#5490](https://github.com/agda/agda/issues/5490): Why does abort (C-c C-x C-a) remove highlighting from the buffer?+  - [#5506](https://github.com/agda/agda/issues/5506): Agda panic: Pattern match failure+  - [#5508](https://github.com/agda/agda/issues/5508): Internal error typechecking non-terminating function on case-insensitive filesystem+  - [#5514](https://github.com/agda/agda/issues/5514): Support GHC 8.10.6+  - [#5531](https://github.com/agda/agda/issues/5531): Internal bug: TypeChecking/Sort+  - [#5532](https://github.com/agda/agda/issues/5532): "The module was successfully compiled" should mention with which backend+  - [#5539](https://github.com/agda/agda/issues/5539): Support GHC 8.10.7+  - [#5544](https://github.com/agda/agda/issues/5544): Internal error caused by addition of `Checkpoints` to `OpenThing`+  - [#5557](https://github.com/agda/agda/issues/5557): Allow Agda to output data files+  - [#5565](https://github.com/agda/agda/issues/5565): Internal error in Agda.TypeChecking.MetaVars+  - [#5593](https://github.com/agda/agda/issues/5593): Compilation failure with `aeson-2`+  - [#5602](https://github.com/agda/agda/issues/5602): The JS backend does not reduce constructor type signatures+  - [#5610](https://github.com/agda/agda/issues/5610): Panic when checking pragma BUILTIN SHARP+  - [#5620](https://github.com/agda/agda/issues/5620): Seemingly incorrect warning for abstract definition without type signature+  - [#5633](https://github.com/agda/agda/issues/5633): Case splitting inserts one with pattern too much (regression in 2.6.2)+  - [#5657](https://github.com/agda/agda/issues/5657): Internal error with postfix projection
LICENSE view
@@ -4,19 +4,21 @@ and from Agdalight by Ulf Norell and Andreas Abel.  Agda 2 is currently actively developed mainly by Andreas Abel,-Guillaume Allais, Jesper Cockx, Nils Anders Danielsson, Philipp-Hausmann, Fredrik Nordvall Forsberg, Ulf Norell, Víctor López Juan,-Andrés Sicard-Ramírez, and Andrea Vezzosi.+Guillaume Allais, Liang-Ting Chen, Jesper Cockx, Matthew Daggitt, Nils+Anders Danielsson, Ulf Norell, Andrés Sicard-Ramírez, and Andrea+Vezzosi.  Further, Agda 2 has received contributions by, amongst others, Stevan Andjelkovic, Marcin Benke, Jean-Philippe Bernardy, Guillaume Brunerie,-James Chapman, Dominique Devriese, Péter Diviánszky, Olle Fredriksson,-Adam Gundry, Daniel Gustafsson, Kuen-Bang Hou (favonia), Patrik-Jansson, Alan Jeffrey, Wolfram Kahl, Wen Kokke, Fredrik Lindblad,-Francesco Mazzoli, Stefan Monnier, Darin Morrison, Guilhem Moulin,-Nicolas Pouillard, Nobuo Yamashita, Christian Sattler, Makoto-Takeyama and Tesla Ice Zhang.  The full list of contributors is-available at https://github.com/agda/agda/graphs/contributors+James Chapman, Dominique Devriese, Péter Diviánszky, Robert Estelle,+Olle Fredriksson, Adam Gundry, Daniel Gustafsson, Philipp Hausmann,+Alan Jeffrey, Wolfram Kahl, Wen Kokke, John Leo, Fredrik Lindblad,+Víctor López Juan, Ting-Gan Lua, Francesco Mazzoli, Stefan Monnier,+Guilhem Moulin, Fredrik Nordvall Forsberg, Nicolas Pouillard, Jonathan+Prieto, Christian Sattler, Makoto Takeyama, Noam Zeilberger, and Tesla+Ice Zhang.  The full list of contributors is available at+https://github.com/agda/agda/graphs/contributors or from the git+repository via ``git shortlog -sne``.  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the@@ -71,7 +73,7 @@  ------------------------------------------------------------------------ -The file src/data/JS/highlight-hover.js (and the following licence+The file src/data/html/highlight-hover.js (and the following licence text?) seems to use the following licence:  Copyright 2002-2010, Simon Marlow.  All rights reserved.@@ -97,28 +99,3 @@ 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.----------------------------------------------------------------------------The file src/data/JS/biginteger.js (and the following licence text?)-seems to use the following licence:--Copyright (c) 2009 Matthew Crumley--Permission is hereby granted, free of charge, to any person obtaining a copy-of this software and associated documentation files (the "Software"), to deal-in the Software without restriction, including without limitation the rights-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell-copies of the Software, and to permit persons to whom the Software is-furnished to do so, subject to the following conditions:--The above copyright notice and this permission notice shall be included in-all copies or substantial portions of the Software.--THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN-THE SOFTWARE.
README.md view
@@ -3,7 +3,6 @@  [![Hackage version](https://img.shields.io/hackage/v/Agda.svg?label=Hackage)](http://hackage.haskell.org/package/Agda) [![Stackage version](https://www.stackage.org/package/Agda/badge/lts?label=Stackage)](https://www.stackage.org/package/Agda)-[![Travis Status](https://travis-ci.org/agda/agda.svg?branch=master)](https://travis-ci.org/agda/agda) [![Test](https://github.com/agda/agda/workflows/Build,%20Test,%20and%20Benchmark/badge.svg?branch=master)](https://github.com/agda/agda/actions?query=workflow%3A%22Build%2C+Test%2C+and+Benchmark%22) [![Stack Build Status via GH Actions](https://github.com/agda/agda/workflows/stack%20build/badge.svg)](https://github.com/agda/agda/actions?query=workflow%3A%22stack+build%22) [![Documentation Status](https://readthedocs.org/projects/agda/badge/?version=latest)](http://agda.readthedocs.io/en/latest/?badge=latest)
+ doc/release-notes/2.6.2.md view
@@ -0,0 +1,1250 @@+Release notes for Agda version 2.6.2+====================================++Highlights+----------++* Several improvements and bug-fixes related to [Run-time+  Irrelevance](https://agda.readthedocs.io/en/v2.6.2/language/runtime-irrelevance.html).++* Several improvements and bug-fixes related to the [JavaScript+  Backend](https://agda.readthedocs.io/en/v2.6.2/tools/compilers.html#javascript-backend).++* Added experimental support for [Guarded Cubical+  Agda](https://agda.readthedocs.io/en/v2.6.2/language/guarded-cubical.html).++* The [Primitive+  Sorts](https://agda.readthedocs.io/en/v2.6.2/language/built-ins.html#sorts)+  of Agda (`Set` and `Prop`) are no longer keywords and can be renamed+  when importing `Agda.Primitive`.++* Added native support for the [Inspect+  Idiom](https://agda.readthedocs.io/en/v2.6.2/language/with-abstraction.html#with-abstraction-equality).++* Added support for making [System+  Calls](https://agda.readthedocs.io/en/v2.6.2/language/reflection.html#system-calls)+  from the reflection API.++Installation and infrastructure+-------------------------------++* Added support for GHC 8.10.5 and 9.0.1.++* Some expensive optimisations are now off by default+  (see [#4521](https://github.com/agda/agda/issues/4521)).++  These optimisations can in some cases make Agda substantially+  faster, but they can also make the compilation of the Agda program+  take more time and space.++  The optimisations can be turned on manually (Cabal:+  `-foptimise-heavily`, Stack: `--flag Agda:optimise-heavily`). They+  are turned on (by default) when Agda is installed using `make+  install`.++  If the optimisations are turned on it might make sense to limit+  GHC's memory usage (using something like `--ghc-options="+RTS -M6G+  -RTS"`).++Pragmas and options+-------------------++* New option `--auto-inline` turns on automatic compile-time inlining+  of simple functions. This was previously enabled by default.++  Note that the absence of automatic inlining can make typechecking+  substantially slower.++  The new default has repercussions on termination checking, for instance+  (see [#4702](https://github.com/agda/agda/issues/4702)).+  The following formulation of `plus` termination checks with `--auto-inline`+  but not without:+  ```agda+  open import Agda.Builtin.Nat++  case_of_ : {A B : Set} → A → (A → B) → B+  case x of f = f x++  plus : Nat → Nat → Nat+  plus m n = case m of λ+     { zero    → n+     ; (suc m) → suc (plus m n)+     }+  ```+  In this particular case, we can work around the limitation of the+  termination checker with pragma `{-# INLINE case_of_ #-}`.++* New options `--qualified-instances` (default) and+  `--no-qualified-instances`. When `--no-qualified-instances` is+  enabled, Agda will only consider candidates for instance search that+  are in scope under an unqualified name (see+  [#4522](https://github.com/agda/agda/pull/4522)).++* New option `--call-by-name` turns off call-by-need evaluation at type+  checking time.++* New option `--highlight-occurrences` (off by default) enables the HTML+  backend to include a JavaScript file that highlights all occurrences of+  the mouse-hovered symbol (see+  [#4535](https://github.com/agda/agda/pull/4535)).++* New option `--no-import-sorts` disables the implicit `open+  import Agda.Primitive using (Set; Prop)` at the top of each file+  (see below).++* New option `--local-confluence-check` to restore the old behaviour+  of the `--confluence-check` flag (see below for the new behaviour).++* New primitive `primStringFromListInjective` internalising the fact that+  `primStringFromList` is an injective function. It is bound in+  `Agda.Builtin.String.Properties`.++* New option `--allow-exec` enables the use of system calls during+  type checking using the `AGDATCMEXECTC` builtin.++* New option `--show-identity-substitutions` shows all arguments of+  metavariables when pretty-printing a term, even if they amount to+  just applying all the variables in the context.++* The option `--rewriting` is now considered infective: if a module has+  `--rewriting` enabled, then all modules importing it must also have+  `--rewriting` enabled.++* New option `--no-double-check` (default), opposite of the existing+  `--double-check`.++* Due to several known soundness issues with sized types (see+  [#1201](https://github.com/agda/agda/issues/1201),+  [#1946](https://github.com/agda/agda/issues/1946),+  [#2820](https://github.com/agda/agda/issues/2820),+  [#3026](https://github.com/agda/agda/issues/3026)), the+  `--sized-types` flag can no longer be used while `--safe` is active.++* New option `--guarded` turns on the Guarded Cubical extension of Agda.++  See [Guarded Cubical](https://agda.readthedocs.io/en/v2.6.2/language/guarded-cubical.html)+  in the documentation for more.++* The flags `--guardedness` and `--sized-types` are no longer enabled+  by default.++Command-line interaction+------------------------++* In the previous release, Agda exited with either status 0 when the+  program type checks successfully, or status 1 when encountering any+  kind of error.  Now Agda exits with status 42 for type errors, 71+  for errors in the commandline arguments, and 154 for impossible+  errors. Exit status 1 may be returned under other circumstances; for+  instance, an incomplete pattern matching, or an error generated by+  the Haskell runtime.  See PR+  [#4540](https://github.com/agda/agda/pull/4540).++Lexical syntax+--------------++* Layout handling has been improved so that block starters can be+  stacked on the same line+  [#1145](https://github.com/agda/agda/issues/1145).++  If several layout blocks are started by layout keywords without line+  break in between (where line breaks inside block comments do not+  count), then those blocks indented *more* than the last block go+  passive, meaning they cannot be further extended by new statements.+  ```agda+    private module M where postulate+              A : Set                 -- module-block goes passive+              B : Set                 -- postulate-block can still be extended+            module N where            -- private-block can still be extended+  ```+  Previously, this was a parse error.++Language+--------++* Inductive records without η-equality no longer support both matching+  on the record constructor and construction of record elements by+  copattern matching.  It has been discovered that the combination of+  both leads to loss of subject reduction, i.e., reduction does not+  preserve typing.  See issue+  [#4560](https://github.com/agda/agda/issues/4560).++  η-equality for a record can be turned off manually with directive+  `no-eta-equality` or command-line option `--no-eta-equality`, but it+  is also automatically turned off for some recursive records.  For+  records without η, matching on the record constructor is now off by+  default and construction by copattern matching is on.  If you want+  the converse, you can add the new record directive `pattern`.++  Example with record pattern:+  ```agda+  record N : Set where+    inductive+    no-eta-equality+    pattern+    field out : Maybe N++  pred : N → Maybe N+  pred record{ out = m } = m+  ```+  Example with record constructor and use of `;` instead of newline:+  ```agda+  record N : Set where+    inductive; no-eta-equality+    pattern; constructor inn+    field out : Maybe N++  pred : N → Maybe N+  pred (inn m) = m+  ```++* `Set` and `Prop` are no longer keywords but are now primitives+  defined in the module `Agda.Primitive`. They can be renamed when+  importing this module, for example:++  ```agda+  open import Agda.Primitive renaming (Set to Type)++  test : Type₁+  test = Type+  ```++  To preserve backwards compatibility, each top-level Agda module now+  starts with an implicit statement:++  ```agda+  open import Agda.Primitive using (Set; Prop)+  ```++  This implicit import can be disabled with the+  `--no-import-sorts` flag.++* Agda now has support for sorts `Setωᵢ` (alternative syntax: `Setωi`)+  for natural numbers `i`, where `Setω₀ = Setω`. These sorts form a+  second hierarchy `Setωᵢ : Setωᵢ₊₁` similar to the standard hierarchy+  of `Setᵢ`, but do not support universe polymorphism. It should not+  be necessary to refer to these sorts during normal usage of Agda,+  but they might be useful for defining reflection-based macros (see+  [#2119](https://github.com/agda/agda/issues/2119) and+  [#4585](https://github.com/agda/agda/issues/4585)).++* Changed the internal representation of literal strings: instead of using a+  linked list of characters (`String`), we are now using `Data.Text`. This+  should be a transparent change from the user's point of view: the backend+  was already packing these strings as text.++  Used this opportunity to introduce a `primStringUncons` primitive in+  `Agda.Builtin.String` (and to correspondingly add the+  `Agda.Builtin.Maybe` it needs).++* The option `--confluence-check` for rewrite rules has been given a+  new implementation that checks global confluence instead of local+  confluence. Concretely, it does so by enforcing two properties:++  1. For any two left-hand sides of the rewrite rules that overlap+     (either at the root position or at a subterm), the most general+     unifier of the two left-hand sides is again a left-hand side of a+     rewrite rule. For example, if there are two rules `suc m + n =+     suc (m + n)` and `m + suc n = suc (m + n)`, then there should+     also be a rule `suc m + suc n = suc (suc (m + n))`.++  2. Each rewrite rule should satisfy the *triangle property*: For any+     rewrite rule `u = w` and any single-step parallel unfolding `u =>+     v`, we should have another single-step parallel unfolding `v =>+     w`.++  The previous behaviour of the confluence checker that only ensures+  local confluence can be restored by using the+  `--local-confluence-check` flag.++* Binary integer literals with prefix `0b` (for instance,+  `0b11001001`) are now supported.++* Overloaded literals now require the conversion function (`fromNat`,+  `fromNeg`, or `fromString`) to be in scope *unqualified* to take+  effect.++  Previously, it was enough for the function to be in scope at all,+  which meant you couldn't import the corresponding builtin module+  without having overloaded literals turned on.++* Added `interleaved mutual` blocks where users can forward-declare+  function, record, and data types and interleave their+  definitions. These blocks are elaborated to more traditional mutual+  blocks by:++    - leaving the signatures where they are+    - grouping the clauses for a function together with the first of them+    - grouping the constructors for a datatype together with the first of them++  Example: two interleaved function definitions++  ```agda++  interleaved mutual++    -- Declarations:+    even : Nat → Bool+    odd  : Nat → Bool++    -- zero is even, not odd+    even zero = true+    odd  zero = false++    -- suc case: switch evenness on the predecessor+    even (suc n) = odd n+    odd  (suc n) = even n+  ```++  Other example: the definition of universe of types closed under the+  natural numbers and pairing:++  ```agda++  interleaved mutual++    -- Declaration of a product record, a universe of codes, and a decoding function+    record _×_ (A B : Set) : Set+    data U : Set+    El : U → Set++    -- We have a code for the type of natural numbers in our universe+    constructor `Nat : U+    El `Nat = Nat++    -- Btw we know how to pair values in a record+    record _×_ A B where+      constructor _,_+      inductive+      field fst : A; snd : B++    -- And we have a code for pairs in our universe+    constructor _`×_ : (A B : U) → U+    El (A `× B) = El A × El B+  ```++* Erased constructors (see+  [#4638](https://github.com/agda/agda/issues/4638)).++  Constructors can be marked as erased. Example:+  ```agda+    {-# OPTIONS --cubical --safe #-}++    open import Agda.Builtin.Cubical.Path+    open import Agda.Primitive++    private+      variable+        a   : Level+        A B : Set a++    Is-proposition : Set a → Set a+    Is-proposition A = (x y : A) → x ≡ y++    data ∥_∥ (A : Set a) : Set a where+      ∣_∣        : A → ∥ A ∥+      @0 trivial : Is-proposition ∥ A ∥++    rec : @0 Is-proposition B → (A → B) → ∥ A ∥ → B+    rec p f ∣ x ∣           = f x+    rec p f (trivial x y i) = p (rec p f x) (rec p f y) i+  ```+  In the code above the constructor `trivial` is only available at+  compile-time, whereas `∣_∣` is also available at run-time. Erased+  names can be used in bodies of clauses that match on `trivial`, if+  the match is done in a non-erased position, like in the final clause+  of `rec`. (Note that Cubical Agda programs still cannot be+  compiled.)++* Erased pattern-matching lambdas (see+  [#4525](https://github.com/agda/agda/issues/4525)).++  Regular pattern-matching lambdas are treated as non-erased+  function definitions. One can make a pattern-matching lambda erased+  by writing `@0` or `@erased` after the lambda:+  ```agda+  @0 _ : @0 Set → Set+  _ = λ @0 { A → A }++  @0 _ : @0 Set → Set+  _ = λ @erased where+    A → A+  ```++  The reflection machinery currently does not support erased+  pattern-matching lambdas (they are quoted as regular+  pattern-matching lambdas).++* New (?) rule for modalities of generalised variables+  (see [#5058](https://github.com/agda/agda/issues/5058)).++  The new rule is that generalisable variables get the modality that+  they are declared with, whereas other variables always get the+  default modality. (It is unclear what the old rule was, perhaps+  nothing was changed.)++* Private abstract type signatures can no longer see through abstract+  (see [#418](https://github.com/agda/agda/issues/418)).++  This means that abstract definitions no longer evaluate in *any*+  type signatures in the same module. Previously they evaluated in+  type signatures of definitions that were both private and abstract.++  It also means that metavariables in type signatures have to be+  solved locally, and cannot make use of information in the definition+  body, and that constructors of abstract datatypes are not in scope+  in type signatures.++* Type inference is disabled for abstract definitions (see+  [#418](https://github.com/agda/agda/issues/418)).++  This means that abstract definitions (inluding functions defined in+  `where` blocks of abstract definitions) need complete type+  signatures.++* One can now declare syntax with two name parts without any hole in+  between, and syntax without any holes.++  Examples:+  ```agda+  syntax Σ A (λ x → B) = [ x ∶ A ] × B+  syntax []            = [ ]+  ```++* Internalised the *inspect idiom* that allows users to abstract over+  an expression in a ``with`` clause while, at the same time,+  remembering the origin of the abstracted pattern via an equation.++  In the following example, abstracting over and then matching on the+  result of ``p x`` allows the first call to ``filter p (x ∷ xs)`` to+  reduce.++  In case the element ``x`` is kept, the second call to ``filter`` on+  the LHS then performs the same ``p x`` test. Because we have+  retained the proof that ``p x ≡ true`` in ``eq``, we are able to+  rewrite by this equality and get it to reduce too.++  This leads to just enough computation that we can finish the proof+  with an appeal to congruence and the induction hypothesis.++  ```agda+  filter-filter : ∀ p xs → filter p (filter p xs) ≡ filter p xs+  filter-filter p []       = refl+  filter-filter p (x ∷ xs) with p x in eq+  ... | false = filter-filter p xs -- easy+  ... | true -- second filter stuck on `p x`: rewrite by `eq`!+    rewrite eq = cong (x ∷_) (filter-filter p xs)+  ```++* As a consequence of the above extensions to `with`, lambdas and lets+  now need parentheses when appearing in a `with`. For instance,++  ```agda+  with-on-fun : Nat → Nat+  with-on-fun n with (λ m → m + n)  -- parentheses required!+  ... | f = f n+  ```++* It is now possible to add hiding and relevance annotations to `with`+  expressions. For example:++  ```agda+  module _ (A B : Set) (recompute : .B → .{{A}} → B) where++    _$_ : .(A → B) → .A → B+    f $ x with .{f} | .(f x) | .{{x}}+    ... | y = recompute y+  ```++Builtins+--------++- Primitive operations for floating-point numbers changed. The equalities now+  follow IEEE 754 equality, after unifying all NaNs. Primitive inequality was+  added:+  ```agda+  primFloatEquality   : Float -> Float -> Bool -- from primFloatNumericEquality+  primFloatLess       : Float -> Float -> Bool -- from primFloatNumericLess+  primFloatInequality : Float -> Float -> Bool -- new+  ```+  The “numeric” relations are now deprecated.++  There are several new predicates on floating-point numbers:+  ```agda+  primFloatIsInfinite     : Float -> Bool -- new+  primFloatIsNaN          : Float -> Bool -- new+  primFloatIsSafeInteger  : Float -> Bool -- new+  ```+  The `primFloatIsSafeInteger` function determines whether the value is a number+  that is a safe integer, i.e., is within the range where the arithmetic+  operations do not lose precision.++  The operations for conversion to integers (`primRound`, `primFloor`,+  and `primCeiling`) were renamed for consistency, and return a value+  of type `Maybe Int`, returning `nothing` for NaN and the infinities:+  ```agda+  primFloatRound   : Float → Maybe Int -- from primRound+  primFloatFloor   : Float → Maybe Int -- from primFloor+  primFloatCeiling : Float → Maybe Int -- from primCeiling+  ```++  There are several new conversions:+  ```agda+  primIntToFloat    : Int -> Float               -- new+  primFloatToRatio  : Float -> (Int × Nat)       -- new+  primRatioToFloat  : Int -> Nat -> Float        -- new+  primFloatDecode   : Float -> Maybe (Int × Int) -- new+  primFloatEncode   : Int -> Int -> Maybe Float  -- new+  ```+  The `primFloatDecode` function decodes a floating-point number f to a mantissa+  and exponent, such that `f = mantissa * 2 ^ exponent`, normalised such that+  the mantissa is the smallest possible number. The `primFloatEncode` function+  encodes a pair of a mantissa and exponent to a floating-point number.++  There are several new operations:+  ```agda+  primFloatPow        : Float -> Float -> Float -- new+  primFloatATan2      : Float -> Float -> Float -- from primATan2+  primFloatSinh       : Float -> Float          -- new+  primFloatCosh       : Float -> Float          -- new+  primFloatTanh       : Float -> Float          -- new+  primFloatASinh      : Float -> Float          -- new+  primFloatACosh      : Float -> Float          -- new+  primFloatATanh      : Float -> Float          -- new+  ```+  Furthermore, the following operations were renamed for consistency:+  ```agda+  primFloatExp        : Float -> Float          -- from primExp+  primFloatSin        : Float -> Float          -- from primSin+  primFloatLog        : Float -> Float          -- from primLog+  primFloatCos        : Float -> Float          -- from primCos+  primFloatTan        : Float -> Float          -- from primTan+  primFloatASin       : Float -> Float          -- from primASin+  primFloatACos       : Float -> Float          -- from primACos+  primFloatATan       : Float -> Float          -- from primATan+  ```++  All of these operations are implemented on the JavaScript backend.++- `primNatToChar` maps surrogate code points to the replacement character+  `'U+FFFD` and surrogate code points are disallowed in character literals++  [Surrogate code points](https://www.unicode.org/glossary/#surrogate_code_point)+  are characters in the range `U+D800` to `U+DFFF` and are reserved for use by+  UTF-16.++  The reason for this change is that strings are represented (at type-checking+  time and in the GHC backend) by Data.Text byte strings, which cannot+  represent surrogate code points and replaces them by `U+FFFD`. By doing the+  same for characters we can have `primStringFromList` be injective (witnessed+  by `Agda.Builtin.String.Properties.primStringFromListInjective`).+++Reflection+----------++- New operation in `TC` monad, similar to `quoteTC` but operating on+  types in `Setω`+  ```agda+  quoteωTC : ∀ {A : Setω} → A → TC Term+  ```+- `typeError` and `debugPrint` no longer inserts spaces around `termErr` and+  `nameErr` parts. They also do a better job of respecting line breaks in+  `strErr` parts.++- The reflection machinery now supports quantities in `Arg` (see+  [#5317](https://github.com/agda/agda/issues/5317)). The `ArgInfo`+  type has changed, and there are new types `Modality` and `Quantity`:+  ```agda+  data Quantity : Set where+    quantity-0 quantity-ω : Quantity++  {-# BUILTIN QUANTITY   Quantity   #-}+  {-# BUILTIN QUANTITY-0 quantity-0 #-}+  {-# BUILTIN QUANTITY-ω quantity-ω #-}++  data Modality : Set where+    modality : (r : Relevance) (q : Quantity) → Modality++  {-# BUILTIN MODALITY             Modality #-}+  {-# BUILTIN MODALITY-CONSTRUCTOR modality #-}++  data ArgInfo : Set where+    arg-info : (v : Visibility) (m : Modality) → ArgInfo+  ```++- The representation of reflected patterns and clauses has+  changed. Each clause now includes a telescope with the names and+  types of the pattern variables.++  ```agda+  data Clause where+    clause        : (tel : List (Σ String λ _ → Arg Type)) (ps : List (Arg Pattern)) (t : Term) → Clause+    absurd-clause : (tel : List (Σ String λ _ → Arg Type)) (ps : List (Arg Pattern)) → Clause+  ```++  These telescopes provide additional information on the types of+  pattern variables that was previously hard to reconstruct (see+  [#2151](https://github.com/agda/agda/issues/2151)). When unquoting a+  clause, the types in the clause telescope are currently ignored (but+  this is subject to change in the future).++  Three constructors of the `Pattern` datatype were also changed:++  * pattern variables now refer to a de Bruijn index (relative to the+    clause telescope) rather than a string,+  * absurd patterns take a de Bruijn index and are expected to be bound by the+    clause telescope,+  * dot patterns now include the actual dotted term.++  ```agda+  data Pattern where+    con    : (c : Name) (ps : List (Arg Pattern)) → Pattern+    dot    : (t : Term)    → Pattern   -- previously:   dot : Pattern+    var    : (x : Nat)     → Pattern   -- previously:   var : (x : String) → Pattern+    lit    : (l : Literal) → Pattern+    proj   : (f : Name)    → Pattern+    absurd : (x : Nat)     → Pattern+  ```++  It is likely that this change to the reflected syntax requires you+  to update reflection code written for previous versions of+  Agda. Here are some tips for updating your code:++  * When quoting a clause, you can recover the name of a pattern+    variable by looking up the given index in the clause+    telescope. The contents of dot patterns can safely be ignored+    (unless you have a use for them).++  * When creating a new clause for unquoting, you need to create a+    telescope for the types of the pattern variables. To get back the+    old behaviour of Agda, it is sufficient to set all the types of+    the pattern variables to `unknown`. So you can construct the+    telescope by listing the names of all pattern variables and absurd+    patterns together with their `ArgInfo`. Meanwhile, the pattern+    variables should be numbered in order to update them to the new+    representation. As for the telescope types, the contents of a+    `dot` pattern can safely be set to `unknown`.++- New operation in `TC` monad, `execTC`, which calls an external executable+  ```agda+  execTC : (exe : String) (args : List String) (stdIn : String)+         → TC (Σ Nat (λ _ → Σ String (λ _ → String)))+  ```+  The `execTC` builtin takes three arguments: the basename of the+  executable (e.g., `"echo"`), a list of arguments, and the contents+  of the standard input. It returns a triple, consisting of the exit+  code (as a natural number), the contents of the standard output, and+  the contents of the standard error.++  The builtin is only available when `--allow-exec` is passed. (Note+  that `--allow-exec` is incompatible with ``--safe``.) To make an+  executable available to Agda, add the absolute path on a new line in+  `~/.agda/executables`.++- Two new operations in the `TC` monad, `onlyReduceDefs` and+  `dontReduceDefs`:+  ```agda+  onlyReduceDefs : ∀ {a} {A : Set a} → List Name → TC A → TC A+  dontReduceDefs : ∀ {a} {A : Set a} → List Name → TC A → TC A+  ```+  These functions allow picking a specific set of functions that+  should (resp. should not) be reduced while executing the given `TC`+  computation.++  For example, the following macro unifies the current hole with the+  term `3 - 3`:+  ```agda+  macro₁ : Term -> TC ⊤+  macro₁ goal = do+    u   ← quoteTC ((1 + 2) - 3)+    u'  ← onlyReduceDefs (quote _+_ ∷ []) (normalise u)+    unify u' goal+  ```+- New operation in the `TC` monad, `withReconstructed`:+  ```agda+  withReconstructed : ∀ {a} {A : Set a} → TC A → TC A+  ```++  This function ensures reconstruction of hidden parameters+  after performing the `TC` computation.  For example, consider the+  following type and function:+  ```agda+  record RVec {a} (X : Set a) (n : Nat) : Set a where+    constructor vec+    field sel : Fin n → X++  test-rvec : Nat → RVec Nat 5+  test-rvec x = vec λ _ → x+  ```++  In the reflected syntax the body of the `test-rvec` would be represented+  as `con vec (unknown ∷ unknown ∷ unknown ∷ (lam _ x)`.  The use of+  `withReconstructed` replaces `unknown`s with the actual values:+  ```agda+  macro₂ : Name → Term → TC ⊤+  macro₂ n hole = do+    (function (clause tel ps t ∷ [])) ←+      withReconstructed (getDefinition n)+      where _ → quoteTC "ERROR" >>= unify hole+    quoteTC t >>= unify hole+  ```++- Three new constructors in the `Sort` datatype, `prop : Level →+  Sort`, `propLit : Nat → Sort`, and `inf : Nat → Sort`, representing+  the sorts `Prop ℓ`, `Propᵢ`, and `Setωᵢ`.++- Terms that belong to a type in `Prop` are no longer unquoted to+  `unknown` but to a proper `Term`. (See+  [#3553](https://github.com/agda/agda/issues/3553).)++Library management+------------------++- `.agda-lib` files can now contain an extra field `flags:` with+  default flags for the library. Flags can be any flags that are+  accepted as part of an `{-# OPTIONS ... #-}` pragma. For example,+  file `my-library.agda-lib` with++  ```+  flags: --without-K+  ```++  will apply the `--without-K` flag to all Agda files in the current+  directory and (recursive) subdirectories that do not themselves+  contain an `.agda-lib` file.+++Emacs mode+----------++* New command prefix `C-u C-u C-u` for weak-head normalization. For instance,+  given++  ```agda+  downFrom : Nat → List Nat+  downFrom 0 = []+  downFrom (suc n) = n ∷ downFrom n+  ```++  `C-u C-u C-u C-c C-n downFrom 5` returns `4 ∷ downFrom 4`.++* New keyboard shortcut `C-c C-x C-i` for toggling display of+  irrelevant arguments.++* One can no longer use commands like `M-;` (`comment-dwim`) to+  uncomment block comments. In return one can use `M-;` to comment out+  pragmas. (See [#3329](https://github.com/agda/agda/issues/3329).)++JSON Interaction mode+---------------------++Changes have been made to the structure of error and warning+messages. The changes are summarized below. See+[#5052](https://github.com/agda/agda/issues/5052) for additional+details.++* The format of an error or warning was previously a bare string. Now, errors+  and warnings are represented by an object with a `"message"` key.++  This means that responses _previously_ structured like:++  ```json+  {"…": "…", "error": "Foo bar baz"}+  ```++  will now be structured:++  ```json+  {"…": "…", "error": {"message": "Foo bar baz"}}+  ```++  This applies directly to the `PostPonedCheckFunDef` response kind+  and `Error` info kind of the `DisplayInfo` response kind.++* The format of collections of errors or warnings, which previously were each+  represented by a single newline-joined string, has been updated to represent+  each warning or error individually in a list.++  That means that responses _previously_ structured like:++  ```json+  { "…": "…"+  , "errors": "Postulates overcooked\nAxioms too wiggly"+  , "warnings": "Something wrong\nSomething else\nwrong"+  }+  ```++  will now be structured:++  ```json+  { "…": "…"+  , "errors":+    [ { "message": "Postulates overcooked" }+    , { "message": "Axioms too wiggly" }+    ]+  , "warnings":+    [ { "message": "Something wrong" }+    , { "message": "Something else\nwrong" }+    ]+  }+  ```++  This applies to `CompilationOk`, `AllGoalsWarning`, and `Error` info+  kinds of the `DisplayInfo` response kind.++* The `Error` info kind of the `DisplayInfo` response kind has+  additionally been updated to distinguish warnings and errors.++  An example of the _previous_ format of a `DisplayInfo` response with+  an `Error` info kind was:+  ```json+  {+    "kind": "DisplayInfo",+    "info": {+      "kind": "Error",+      "message": "———— Error —————————————————————————————————————————————————\n/data/code/agda-test/Test.agda:2,1-9\nFailed to find source of module M in any of the following\nlocations:\n  /data/code/agda-test/M.agda\n  /data/code/agda-test/M.lagda\nwhen scope checking the declaration\n  import M\n\n———— Warning(s) ————————————————————————————————————————————\n/data/code/agda-test/Test.agda:3,1-10\nEmpty postulate block."+    }+  }+  ```++  The updated format is:+  ```json+  {+    "kind": "DisplayInfo",+    "info": {+      "kind": "Error",+      "error": {+        "message": "/data/code/agda-test/Test.agda:2,1-9\nFailed to find source of module M in any of the following\nlocations:\n  /data/code/agda-test/M.agda\n  /data/code/agda-test/M.lagda\nwhen scope checking the declaration\n  import M"+      },+      "warnings": [+        {+          "message": "/data/code/agda-test/Test.agda:3,1-10\nEmpty postulate block."+        }+      ]+    }+  }+  ```++Compiler backends -----------------++- With option `--allow-unsolved-metas`, code with holes can be compiled.+  If a hole is reached at runtime, the compiled program crashes.+  See issue [#5103](https://github.com/agda/agda/issues/5103)++- Previously the GHC backend compiled at least one instance of Hinze's+  memoisation technique from ["Memo functions,+  polytypically!"](http://www.cs.ox.ac.uk/ralf.hinze/publications/index.html#P11)+  to reasonably efficient code. That is no longer the case (at least+  for that particular instance, see+  [#5153](https://github.com/agda/agda/issues/5153)).++LaTeX backend+-------------++- The spacing in comments is now preserved when generating LaTex files+  from literate Agda.  See+  [#5320](https://github.com/agda/agda/pull/5320) for more details.++HTML backend+------------++- The named `id` attributes for local modules inside local modules are+  now different (see [#5335](https://github.com/agda/agda/pull/5320)).++  For instance, consider the following Agda file:+  ```agda+  module Top-level where++    module Inner where++      module Inside-inner where+  ```+  Previously one could link to the module `Inside-inner` using a URL+  that ended with `#Inside-inner`. Now one can use+  `#Inner.Inside-inner` instead.++JS backend+----------++- Smaller local variable names in the generated JS code.++  Previously: `x0`, `x1`, `x2`, ...++  Now: `a`, `b`, `c`, ..., `z`, `a0`, `b0`, ..., `z0`, `a1`, `b1`, ...++- Improved indentation of generated JS code.++- More compact rendering of generated JS functions.++  Previously:+  ```js+  exports["N"]["suc"] = function (x0) {+      return function (x1) {+        return x1["suc"](x0);+      };+    };+  ```++  Now:+  ```js+  exports["N"]["suc"] = a => b => b["suc"](a);+  ```++- Irrelevant arguments are now erased in the generated JS code.++  Example Agda code:+  ```agda+  flip : {A B C : Set} -> (B -> A -> C) -> A -> B -> C+  flip f a b = f b a+  ```++  Previously generated JS code:+  ```js+  exports["flip"] = function (x0) {+      return function (x1) {+        return function (x2) {+          return function (x3) {+            return function (x4) {+              return function (x5) {+                return x3(x5)(x4);+              };+            };+          };+        };+      };+    };+  ```++  JS code generated now:+  ```js+  exports["flip"] = a => b => c => a(c)(b);+  ```++- Record fields are not stored separately (the fields are stored only+  in the constructor) in the generated JS code.++  Example Agda code:+  ```agda+  record Sigma (A : Set) (B : A -> Set) : Set where+    field+      fst : A+      snd : B fst+  ```++  Previously generated JS code (look at the `"fst"` and `"snd"` fields in the+  return value of `exports["Sigma"]["record"]`:+  ```js+  exports["Sigma"] = {};+  exports["Sigma"]["fst"] = function (x0) {+      return x0["record"]({+        "record": function (x1, x2) {+          return x1;+        }+      });+    };+  exports["Sigma"]["snd"] = function (x0) {+      return x0["record"]({+        "record": function (x1, x2) {+          return x2;+        }+      });+    };+  exports["Sigma"]["record"] = function (x0) {+      return function (x1) {+        return {+          "fst": x0,+          "record": function (x2) {+            return x2["record"](x0, x1);+          },+          "snd": x1+        };+      };+    };+  ```++  JS code generated now:+  ```js+  exports["Sigma"] = {};+  exports["Sigma"]["fst"] = a => a["record"]({"record": (b,c) => b});+  exports["Sigma"]["snd"] = a => a["record"]({"record": (b,c) => c});+  exports["Sigma"]["record"] = a => b => ({"record": c => c["record"](a,b)});+  ```++- `--js-optimize` flag has been added to the `agda` compiler.++  With `--js-optimize`, `agda` does not wrap records in JS objects.++  Example Agda code:+  ```agda+  record Sigma (A : Set) (B : A -> Set) : Set where+    field+      fst : A+      snd : B fst+  ```++  JS code generated without the `--js-optimize` flag:+  ```js+  exports["Sigma"] = {};+  exports["Sigma"]["fst"] = a => a["record"]({"record": (b,c) => b});+  exports["Sigma"]["snd"] = a => a["record"]({"record": (b,c) => c});+  exports["Sigma"]["record"] = a => b => ({"record": c => c["record"](a,b)});+  ```++  JS code generated with the `--js-optimize` flag:+  ```js+  exports["Sigma"] = {};+  exports["Sigma"]["fst"] = a => a((b,c) => b);+  exports["Sigma"]["snd"] = a => a((b,c) => c);+  exports["Sigma"]["record"] = a => b => c => c(a,b);+  ```++  With `--js-optimize`, `agda` uses JS arrays instead of JS objects.+  This is possible because constructor names are not relevant during the evaluation.++  Example Agda code:+  ```agda+  data Bool : Set where+    false : Bool+    true  : Bool++  not : Bool -> Bool+  not false = true+  not true  = false+  ```++  JS code generated without the `--js-optimize` flag:+  ```js+  exports["Bool"] = {};+  exports["Bool"]["false"] = a => a["false"]();+  exports["Bool"]["true"] = a => a["true"]();+  exports["not"] = a => a({+      "false": () => exports["Bool"]["true"],+      "true": () => exports["Bool"]["false"]+    });+  ```++  JS code generated with the `--js-optimize` flag:+  ```js+  exports["Bool"] = {};+  exports["Bool"]["false"] = a => a[0/* false */]();+  exports["Bool"]["true"] = a => a[1/* true */]();+  exports["not"] = a => a([+      /* false */() => exports["Bool"]["true"],+      /* true */() => exports["Bool"]["false"]+    ]);+  ```++  Note that comments are added to generated JS code to help human readers.++  Erased branches are replaced by `null` in the generated array.  If+  more than the half of branches are erased, the array is compressed+  to be a object like `{3: ..., 13: ...}`.++- `--js-minify` flag has been added to the `agda` compiler.++  With `--js-minify`, `agda` discards comments and whitespace in the+  generated JS code.+++Agda as a library (API)+-----------------------++* The `SourceInfo` record has been renamed to `Source`, and the+  `sourceInfo` function to `parseSource`.++Other issues+------------++For 2.6.2, the following issues were also closed (see [bug+tracker](https://github.com/agda/agda/issues)):++  -  [#418](https://github.com/agda/agda/issues/418): Unifier ignores presence of abstract keyword+  -  [#958](https://github.com/agda/agda/issues/958): Module application display forms in parameterised modules+  -  [#1145](https://github.com/agda/agda/issues/1145): Allow multiple layout keywords on the same line+  -  [#2151](https://github.com/agda/agda/issues/2151): Add TC primitive to check left-hand side+  -  [#2461](https://github.com/agda/agda/issues/2461): Support with in the presence of IApply patterns+  -  [#2858](https://github.com/agda/agda/issues/2858): Feature request: Interleaving mutually-defined functions & datatypes+  -  [#3000](https://github.com/agda/agda/issues/3000): Interaction: iterated give encounters internal error+  -  [#3118](https://github.com/agda/agda/issues/3118): Feature request: default flags in .agda-lib file+  -  [#3289](https://github.com/agda/agda/issues/3289): Postfix projections should not have hiding information+  -  [#3360](https://github.com/agda/agda/issues/3360): Make Emacs mode available as a normal package via MELPA+  -  [#3365](https://github.com/agda/agda/issues/3365): Update GitHub linguist syntax highlight file+  -  [#3398](https://github.com/agda/agda/issues/3398): With the option --allow-unsolved-metas, the unsolved metas are not shown, only yellow+  -  [#3422](https://github.com/agda/agda/issues/3422): Show names of instance candidates in error message+  -  [#3486](https://github.com/agda/agda/issues/3486): Elaborate-and-give shouldn't reduce solution+  -  [#3532](https://github.com/agda/agda/issues/3532): Refine does not work for functions with 10 arguments or more+  -  [#3538](https://github.com/agda/agda/issues/3538): Regression: Rewrite rule involving constructors rejected in parametrized module+  -  [#3588](https://github.com/agda/agda/issues/3588): Refine suggests overloaded constructor which is not in scope+  -  [#3627](https://github.com/agda/agda/issues/3627): Where-blocks of clauses with irrelevant projections can use irrelevant variables+  -  [#3644](https://github.com/agda/agda/issues/3644): Error message without position+  -  [#3672](https://github.com/agda/agda/issues/3672): Better error messages for generalize easter eggs+  -  [#3684](https://github.com/agda/agda/issues/3684): Make error about non-existent record field a warning?+  -  [#3734](https://github.com/agda/agda/issues/3734): WARNING_ON_USAGE is not raised for constructors+  -  [#3744](https://github.com/agda/agda/issues/3744): Internal error related to abstract+  -  [#3870](https://github.com/agda/agda/issues/3870): Internal error during instance search+  -  [#3926](https://github.com/agda/agda/issues/3926): Document the effect of `mutual` to the order of type checking+  -  [#3933](https://github.com/agda/agda/issues/3933): `import` can remove definitions from scope+  -  [#3961](https://github.com/agda/agda/issues/3961): Missing documentation for coverage checking+  -  [#4071](https://github.com/agda/agda/issues/4071): Ill-scoped code in error message+  -  [#4088](https://github.com/agda/agda/issues/4088): Strange scoping rules for irrefutable with, part 2+  -  [#4093](https://github.com/agda/agda/issues/4093): Make it possible to rename Set?+  -  [#4109](https://github.com/agda/agda/issues/4109): cannot declare data types in Setω+  -  [#4131](https://github.com/agda/agda/issues/4131): Record definition doesn't compile without a specific `let` binding+  -  [#4132](https://github.com/agda/agda/issues/4132): The regular expression for floats in the lexer is too liberal+  -  [#4135](https://github.com/agda/agda/issues/4135): Constructor disambiguation picks non-unique solution+  -  [#4157](https://github.com/agda/agda/issues/4157): Agda gets confused by multiple anonymous definitions in a single mutual block+  -  [#4160](https://github.com/agda/agda/issues/4160): Printing implicit lambdas with --show-implicit+  -  [#4161](https://github.com/agda/agda/issues/4161): An alternative solution for hGetContent error on Windows when non-English+  -  [#4166](https://github.com/agda/agda/issues/4166): Instances that are not in scope are candidates for instance resolution+  -  [#4208](https://github.com/agda/agda/issues/4208): Field named `_` in `genTel` record+  -  [#4252](https://github.com/agda/agda/issues/4252): Interaction ids get conflated after iterated give+  -  [#4265](https://github.com/agda/agda/issues/4265): Unsolved constraints when --no-syntactic-equality is used+  -  [#4280](https://github.com/agda/agda/issues/4280): Test case for #4169 fails in JS backend+  -  [#4291](https://github.com/agda/agda/issues/4291): Incorrect names can be generated for generalised variables+  -  [#4341](https://github.com/agda/agda/issues/4341): The documentation of inContext seems wrong.+  -  [#4350](https://github.com/agda/agda/issues/4350): Scoping bug with let open in telescope+  -  [#4365](https://github.com/agda/agda/issues/4365): Module fails to type check after parametrising it by postulates+  -  [#4400](https://github.com/agda/agda/issues/4400): TERMINATING pragma in where clause+  -  [#4425](https://github.com/agda/agda/issues/4425): [doc] What are .agdai files?+  -  [#4456](https://github.com/agda/agda/issues/4456): No error highlighting for error warnings?+  -  [#4458](https://github.com/agda/agda/issues/4458): The command agda2-measure-load-time is broken+  -  [#4481](https://github.com/agda/agda/issues/4481): Named implicit arguments do not behave the same in anonymous lambdas & definitions+  -  [#4482](https://github.com/agda/agda/issues/4482): "Unexpected implicit argument" should pinpoint exactly where the error starts+  -  [#4486](https://github.com/agda/agda/issues/4486): "did you mean" hint also for failing imports+  -  [#4491](https://github.com/agda/agda/issues/4491): Add a primitive for Data.Text's uncons+  -  [#4516](https://github.com/agda/agda/issues/4516): Internal error if files cannot be written to the directory for temporary files+  -  [#4518](https://github.com/agda/agda/issues/4518): Confusing error message if missing import+  -  [#4520](https://github.com/agda/agda/issues/4520): Better error for ambiguous BUILTIN [FROMNAT no longer working]+  -  [#4521](https://github.com/agda/agda/issues/4521): Massive increase in memory required to install Agda 2.6.1+  -  [#4526](https://github.com/agda/agda/issues/4526): Agda 2.6.1 bad performance: findProjectConfig slow in big directories+  -  [#4528](https://github.com/agda/agda/issues/4528): Internal error due to new forcing translation+  -  [#4530](https://github.com/agda/agda/issues/4530): Less normalization of goal types for instance search+  -  [#4534](https://github.com/agda/agda/issues/4534): [reflection] quote is not a defined name+  -  [#4536](https://github.com/agda/agda/issues/4536): co-pattern matching on empty record type removes body+  -  [#4538](https://github.com/agda/agda/issues/4538): changing the predefined precedence of an operator+  -  [#4543](https://github.com/agda/agda/issues/4543): Access violation on Windows on GHC 8.8.3, 8.8.4, 8.10.1 and 8.10.2+  -  [#4550](https://github.com/agda/agda/issues/4550): Documentation build: malformed code-block+  -  [#4556](https://github.com/agda/agda/issues/4556): [documentation] update hello world+  -  [#4557](https://github.com/agda/agda/issues/4557): activate github's discussions beta+  -  [#4560](https://github.com/agda/agda/issues/4560): Loss of canonicity with no-eta record and copatterns.+  -  [#4572](https://github.com/agda/agda/issues/4572): add PiSort and UnivSort to the documentation+  -  [#4576](https://github.com/agda/agda/issues/4576): quoteTC for Setω+  -  [#4580](https://github.com/agda/agda/issues/4580): No highlighting for pragmas FROMNAT, FROMNEG, FROMSTRING+  -  [#4583](https://github.com/agda/agda/issues/4583): QuickLaTeX backend does not highlight coinductive constructors as such+  -  [#4586](https://github.com/agda/agda/issues/4586): Better error message  for "Not a valid let declaration"+  -  [#4593](https://github.com/agda/agda/issues/4593): The blocking machinery seems to be broken+  -  [#4595](https://github.com/agda/agda/issues/4595): Should Setω be a type?+  -  [#4596](https://github.com/agda/agda/issues/4596): Improve pattern matching on records in telescopes+  -  [#4606](https://github.com/agda/agda/issues/4606): The combination of Cubical Agda with inductive families is logically inconsistent+  -  [#4610](https://github.com/agda/agda/issues/4610): Support Emacs 27.1+  -  [#4615](https://github.com/agda/agda/issues/4615): Enable --no-sort-comparison by default?+  -  [#4621](https://github.com/agda/agda/issues/4621): Make --rewriting infective+  -  [#4623](https://github.com/agda/agda/issues/4623): Empty where blocks should get dead code warnings+  -  [#4631](https://github.com/agda/agda/issues/4631): Non-linear patterns handled in a buggy way+  -  [#4637](https://github.com/agda/agda/issues/4637): recCon-NOT-PRINTED in termination error in connection to with+  -  [#4638](https://github.com/agda/agda/issues/4638): Erased constructors+  -  [#4649](https://github.com/agda/agda/issues/4649): Repair Agda's REPL (agda -I) to work with --safe flag+  -  [#4656](https://github.com/agda/agda/issues/4656): Function name not wrapped in `\AgdaFunction` in generated LaTeX+  -  [#4662](https://github.com/agda/agda/issues/4662): Current module contents+  -  [#4665](https://github.com/agda/agda/issues/4665): Documentation: add install instructions for stack+  -  [#4671](https://github.com/agda/agda/issues/4671): Weird error message on case-insensitive file systems+  -  [#4679](https://github.com/agda/agda/issues/4679): Cubical: giving seems to skip the boundary condition check for extended lambdas+  -  [#4681](https://github.com/agda/agda/issues/4681): Get rid of auto-inlining?+  -  [#4684](https://github.com/agda/agda/issues/4684): Type error due to --no-syntactic-equality+  -  [#4687](https://github.com/agda/agda/issues/4687): Instance search fails with two equal candidates+  -  [#4704](https://github.com/agda/agda/issues/4704): Case-split generates invalid code+  -  [#4707](https://github.com/agda/agda/issues/4707): Just warn when `using` directive has repetitions+  -  [#4721](https://github.com/agda/agda/issues/4721): de Bruijn index out of scope when using rewriting+  -  [#4727](https://github.com/agda/agda/issues/4727): Meta-variable solutions contain subterms with the wrong modality+  -  [#4735](https://github.com/agda/agda/issues/4735): primShowQName creates not-in-scope names+  -  [#4737](https://github.com/agda/agda/issues/4737): Turn error `Hiding ... has no effect` into a warning+  -  [#4750](https://github.com/agda/agda/issues/4750): Unification failure in 2.6.1 and the master branch+  -  [#4752](https://github.com/agda/agda/issues/4752): Panic on unbound variable with pattern synonym+  -  [#4768](https://github.com/agda/agda/issues/4768): De Bruijn index @0 in error "Not a finite domain"+  -  [#4769](https://github.com/agda/agda/issues/4769): mergeEqualPs ignores Name and ArgInfo of merged-in patterns+  -  [#4772](https://github.com/agda/agda/issues/4772): C-u C-u C-c C-? should show all goals normalized (Cmd_metas)+  -  [#4773](https://github.com/agda/agda/issues/4773): Missing does-not-export warning for `open` directive for parametrised module+  -  [#4775](https://github.com/agda/agda/issues/4775): Internal error when trying to use incorrect lambda syntax to pattern match+  -  [#4784](https://github.com/agda/agda/issues/4784): Make erasure compatible with univalence+  -  [#4795](https://github.com/agda/agda/issues/4795): Build "agda-tests" fails using dynamic linking+  -  [#4815](https://github.com/agda/agda/issues/4815): Current master fails compilation: binding for 'error' shadows the existing binding+  -  [#4828](https://github.com/agda/agda/issues/4828): Symlinks are incorrectly followed during compilation+  -  [#4833](https://github.com/agda/agda/issues/4833): Internal error: cannot type-check file+  -  [#4851](https://github.com/agda/agda/issues/4851): BUILTIN SIGMA and --type-in-type+  -  [#4852](https://github.com/agda/agda/issues/4852): First load the file+  -  [#4857](https://github.com/agda/agda/issues/4857): Instance argument is printed as explicit argument+  -  [#4869](https://github.com/agda/agda/issues/4869): Internal error at src/full/Agda/TypeChecking/Serialise/Instances/Internal.hs:147+  -  [#4880](https://github.com/agda/agda/issues/4880): Non-dependent, irrelevant, nameless arguments aren't accepted in arrows+  -  [#4882](https://github.com/agda/agda/issues/4882): Missing `reduce` in `literalStrategy`+  -  [#4888](https://github.com/agda/agda/issues/4888): "Illegal declaration(s) before top-level module" in Agda 2.6.1+  -  [#4909](https://github.com/agda/agda/issues/4909): Rewrite rule not accepted with --no-fast-reduce+  -  [#4924](https://github.com/agda/agda/issues/4924): Instance resolution loops infinitely even when an instance is available+  -  [#4925](https://github.com/agda/agda/issues/4925): Too aggressive literal overloading+  -  [#4928](https://github.com/agda/agda/issues/4928): Internal error checking cubical library+  -  [#4929](https://github.com/agda/agda/issues/4929): Regression in 2.6.1 connected to forcing translation (internal error)+  -  [#4944](https://github.com/agda/agda/issues/4944): Generalize: stuck on constraint ↑ i =< ↑ (↑ i) : Size+  -  [#4946](https://github.com/agda/agda/issues/4946): Size polarity brittle with generalization+  -  [#4949](https://github.com/agda/agda/issues/4949): Cubical: internal error in eta-expansion under constraints+  -  [#4950](https://github.com/agda/agda/issues/4950): Range too large in complaint about missing definitions+  -  [#4951](https://github.com/agda/agda/issues/4951): Data types in Setω are treated as non-fibrant+  -  [#4952](https://github.com/agda/agda/issues/4952): Incorrect HTML generated for renaming clause+  -  [#4962](https://github.com/agda/agda/issues/4962): JS backend: bugs involving "null"+  -  [#4967](https://github.com/agda/agda/issues/4967): Crazy bug when defining Ord instances for Int+  -  [#4970](https://github.com/agda/agda/issues/4970): `variable` use adds explicit argument+  -  [#4975](https://github.com/agda/agda/issues/4975): "no such meta variable" when calling `C-u C-c C-;`+  -  [#4982](https://github.com/agda/agda/issues/4982): Internal error related to Cubical Agda+  -  [#4986](https://github.com/agda/agda/issues/4986): Pattern matching allows you to turn `(x y : A) -> A` into `(@0 x y : A) -> A`+  -  [#4995](https://github.com/agda/agda/issues/4995): No Cycle should not look under lambdas.+  -  [#4998](https://github.com/agda/agda/issues/4998): Make case in clause with instance projection does not work+  -  [#4999](https://github.com/agda/agda/issues/4999): `primStringFromList` is not injective because of surrogate code points+  -  [#5002](https://github.com/agda/agda/issues/5002): Bad JavaScript generated+  -  [#5005](https://github.com/agda/agda/issues/5005): Add flag to print AGDA_DIR and exit+  -  [#5029](https://github.com/agda/agda/issues/5029): One can override --safe+  -  [#5033](https://github.com/agda/agda/issues/5033): Internal error related to @tick+  -  [#5048](https://github.com/agda/agda/issues/5048): Disturbing names in normalised reflected type+  -  [#5064](https://github.com/agda/agda/issues/5064): Give more information in error "Pattern matching on no-eta record types is by default not allowed"+  -  [#5065](https://github.com/agda/agda/issues/5065): The termination checker is too liberal+  -  [#5079](https://github.com/agda/agda/issues/5079): Deep pattern-matching is sometimes allowed for erased arguments+  -  [#5093](https://github.com/agda/agda/issues/5093): Weird instance propagation between parameterised modules+  -  [#5112](https://github.com/agda/agda/issues/5112): `make install-fix-whitespace` shouldn't use the `stack-X.Y.Z.yaml` files used for Agda+  -  [#5128](https://github.com/agda/agda/issues/5128): getDefinition sometimes loses patterns+  -  [#5133](https://github.com/agda/agda/issues/5133): Current master fails LaTeX-related tests+  -  [#5140](https://github.com/agda/agda/issues/5140): test/LaTeXAndHTML/succeed contains failing tests+  -  [#5146](https://github.com/agda/agda/issues/5146): v2.6.1.2 does not contain MAlonzo/RTE/Float.hs+  -  [#5161](https://github.com/agda/agda/issues/5161): No error location for error in imported module when .agdai file exists+  -  [#5167](https://github.com/agda/agda/issues/5167): Fix broken compatibility with agda-bench+  -  [#5168](https://github.com/agda/agda/issues/5168): User manual: Missing instructions for installing Agda from Hackage using stack+  -  [#5176](https://github.com/agda/agda/issues/5176): `mutual` is deprecated in doc+  -  [#5204](https://github.com/agda/agda/issues/5204): Investigate highlighting failures+  -  [#5205](https://github.com/agda/agda/issues/5205): acmart examples in (user-manual) fail to build with latest TeXLive+  -  [#5207](https://github.com/agda/agda/issues/5207): Agda generated code does not type-check with GHC 9.0+  -  [#5210](https://github.com/agda/agda/issues/5210): Internal error+  -  [#5230](https://github.com/agda/agda/issues/5230): When `stack.yaml` exists, `make` calls `stack`, even on `make debug`+  -  [#5231](https://github.com/agda/agda/issues/5231): Problems compiling hello-world.agda+  -  [#5237](https://github.com/agda/agda/issues/5237): `__IMPOSSIBLE__` from Agda.TypeChecking.Substitute+  -  [#5238](https://github.com/agda/agda/issues/5238): Rewrites are conjuring elements out of thin air+  -  [#5245](https://github.com/agda/agda/issues/5245): An infinite loop?+  -  [#5250](https://github.com/agda/agda/issues/5250): Change of warning options ignored+  -  [#5251](https://github.com/agda/agda/issues/5251): @0 annotation on lambda ignored+  -  [#5252](https://github.com/agda/agda/issues/5252): Internal error when case splitting pattern-lambda with higher rank type+  -  [#5286](https://github.com/agda/agda/issues/5286): Wrong error location with do notation and parse error in lhs+  -  [#5288](https://github.com/agda/agda/issues/5288): Very weird behaviour with compiled Data.Nat.Show.readMaybe+  -  [#5313](https://github.com/agda/agda/issues/5313): Documentation for internal level properties+  -  [#5314](https://github.com/agda/agda/issues/5314): Warn about abstract definitions without type signatures+  -  [#5317](https://github.com/agda/agda/issues/5317): The reflection machinery should support quantities+  -  [#5326](https://github.com/agda/agda/issues/5326): The highlighting code should be optimised+  -  [#5334](https://github.com/agda/agda/issues/5334): Meta-variable in constructor type busts interleaved mutual+  -  [#5335](https://github.com/agda/agda/issues/5335): Incorrect id attributes for local modules inside local modules+  -  [#5336](https://github.com/agda/agda/issues/5336): `data Foo constructor {cs : ts}` notation in `interleaved mutual`+  -  [#5339](https://github.com/agda/agda/issues/5339): `constructor` blocks do not tolerate overloading in same block+  -  [#5341](https://github.com/agda/agda/issues/5341): Do not make context variables non-erased+  -  [#5356](https://github.com/agda/agda/issues/5356): `interleaved mutual`: `data _ where` instead of `constructor`+  -  [#5358](https://github.com/agda/agda/issues/5358): tactic annotation on record field of function type drops domain in copattern definition+  -  [#5367](https://github.com/agda/agda/issues/5367): Parser regression involving `with` and `let`+  -  [#5370](https://github.com/agda/agda/issues/5370): Inconsistency in agda --help+  -  [#5375](https://github.com/agda/agda/issues/5375): Efficient conversion between interaction points and meta-variables+  -  [#5410](https://github.com/agda/agda/issues/5410): Module applications in where clauses of erased definitions yield non-erased code+  -  [#5419](https://github.com/agda/agda/issues/5419): Missing licences?+  -  [#5424](https://github.com/agda/agda/issues/5424): Internal error in v2.6.2 release candidate 1+  -  [#5434](https://github.com/agda/agda/issues/5434): The user manual's explanation of how erasure is checked for constructors does not match the implementation
− doc/user-manual.pdf

binary file changed (1228011 → absent bytes)

src/agda-mode/Main.hs view
@@ -1,13 +1,15 @@+{-# LANGUAGE ScopedTypeVariables #-}+ -- | A program which either tries to add setup code for Agda's Emacs -- mode to the users .emacs file, or provides information to Emacs -- about where the Emacs mode is installed.  module Main (main) where -import Control.Exception+import Control.Exception as E import Control.Monad import Data.Char-import Data.List+import Data.List (intercalate, isInfixOf) import Data.Maybe import Data.Version import Numeric@@ -16,6 +18,7 @@ import System.Exit import System.FilePath import System.IO+-- import System.IO.Error (isDoesNotExistError) import System.Process  import Paths_Agda (getDataDir, version)@@ -163,7 +166,7 @@   bracket (openTempFile tempDir "askEmacs")           (removeFile . fst) $ \(file, h) -> do     hClose h-    exit <- rawSystem "emacs"+    exit <- rawSystemWithDiagnostics "emacs"                       [ "--no-desktop", "-nw", "--no-splash"                           -- Andreas, 2014-01-11: ^ try a leaner startup of emacs                           -- Andreas, 2018-09-08: -nw instead of --no-window-system as some emacses do not support the long version@@ -182,6 +185,26 @@       -- prematurely.       return result +-- | Like 'rawSystem' but handles 'IOException' by printing diagnostics+-- (@PATH@) before 'exitFailure'.++rawSystemWithDiagnostics+  :: FilePath  -- ^ Command to run.+  -> [String]  -- ^ Arguments to command.+  -> IO ExitCode+rawSystemWithDiagnostics cmd args =+    rawSystem cmd args+  `E.catch` \ (e :: IOException) -> do+     informLn $ unwords [ "FAILED:", showCommandForUser cmd args ]+     informLn $ unwords [ "Exception:", show e ]+     -- The PATH might be useful in other exceptions, like "permission denied".+     -- when (isDoesNotExistError e) $ do+     path <- fromMaybe "(not found)" <$> findExecutable cmd+     informLn $ unwords [ "Executable", cmd, "at:", path ]+     informLn "PATH:"+     mapM_ (informLn . ("  - " ++)) =<< getSearchPath+     exitFailure+ -- | Escapes the string so that Emacs can parse it as an Elisp string.  escape :: FilePath -> FilePath@@ -225,7 +248,7 @@       exitFailure   where   compile dataDir f = do-    exit <- rawSystem "emacs" $+    exit <- rawSystemWithDiagnostics "emacs" $                       [ "--no-init-file", "--no-site-file"                       , "--directory", dataDir                       , "--batch"
− src/data/Agda.css
@@ -1,41 +0,0 @@-/* Aspects. */-.Agda .Comment       { color: #B22222 }-.Agda .Background    {}-.Agda .Markup        { color: #000000 }-.Agda .Keyword       { color: #CD6600 }-.Agda .String        { color: #B22222 }-.Agda .Number        { color: #A020F0 }-.Agda .Symbol        { color: #404040 }-.Agda .PrimitiveType { color: #0000CD }-.Agda .Pragma        { color: black   }-.Agda .Operator      {}-.Agda .Hole          { background: #B4EEB4 }--/* NameKinds. */-.Agda .Bound                  { color: black   }-.Agda .Generalizable          { color: black   }-.Agda .InductiveConstructor   { color: #008B00 }-.Agda .CoinductiveConstructor { color: #8B7500 }-.Agda .Datatype               { color: #0000CD }-.Agda .Field                  { color: #EE1289 }-.Agda .Function               { color: #0000CD }-.Agda .Module                 { color: #A020F0 }-.Agda .Postulate              { color: #0000CD }-.Agda .Primitive              { color: #0000CD }-.Agda .Record                 { color: #0000CD }--/* OtherAspects. */-.Agda .DottedPattern        {}-.Agda .UnsolvedMeta         { color: black; background: yellow         }-.Agda .UnsolvedConstraint   { color: black; background: yellow         }-.Agda .TerminationProblem   { color: black; background: #FFA07A        }-.Agda .IncompletePattern    { color: black; background: #F5DEB3        }-.Agda .Error                { color: red;   text-decoration: underline }-.Agda .TypeChecks           { color: black; background: #ADD8E6        }-.Agda .Deadcode             { color: black; background: #808080        }-.Agda .ShadowingInTelescope { color: black; background: #808080        }--/* Standard attributes. */-.Agda a { text-decoration: none }-.Agda a[href]:hover { background-color: #B4EEB4 }-.Agda [href].hover-highlight { background-color: #B4EEB4; }
src/data/JS/agda-rts.js view
@@ -10,69 +10,62 @@ // which return Agda types like Maybe. These are never emitted by the compiler, // but can be used internally to define other prefixes. -const biginteger = require("biginteger");- // Integers-exports.primIntegerFromString = function(x) {-  return biginteger.BigInteger(x);-};-exports.primShowInteger = function(x) {-  return x.toString();-};-exports.uprimIntegerPlus = function(x,y) {-  return x.add(y);-};-exports.uprimIntegerMinus = function(x,y) {-  return x.subtract(y);-};-exports.uprimIntegerMultiply = function(x,y) {-  return x.multiply(y);-};-exports.uprimIntegerRem = function(x, y) {-  return x.remainder(y);-};-exports.uprimIntegerQuot = function(x, y) {-  return x.quotient(y);-};-exports.uprimIntegerEqual = function(x,y) {-  return x.compare(y) == 0;-};-exports.uprimIntegerGreaterOrEqualThan = function(x,y) {-  return x.compare(y) >= 0;-};-exports.uprimIntegerLessThan = function(x,y) {-  return x.compare(y) == -1;-}; +// primIntegerFromString : String -> Int+exports.primIntegerFromString = BigInt;++// primShowInteger : Int -> String+exports.primShowInteger = x => x.toString();++// uprimIntegerPlus : (Int, Int) -> Int+exports.uprimIntegerPlus = (x, y) => x + y;++// uprimIntegerMinus : (Int, Int) -> Int+exports.uprimIntegerMinus = (x, y) => x - y;++// uprimIntegerMultiply : (Int, Int) -> Int+exports.uprimIntegerMultiply = (x, y) => x * y;++// uprimIntegerRem : (Int, Int) -> Int+exports.uprimIntegerRem = (x, y) => x % y;++// uprimIntegerQuot : (Int, Int) -> Int+exports.uprimIntegerQuot = (x, y) => x / y;++// uprimIntegerEqual : (Int, Int) -> Bool+exports.uprimIntegerEqual = (x, y) => x === y;++// uprimIntegerGreaterOrEqualThan : (Int, Int) -> Bool+exports.uprimIntegerGreaterOrEqualThan = (x, y) => x >= y;++// uprimIntegerLessThan : (Int, Int) -> Bool+exports.uprimIntegerLessThan = (x, y) => x < y;+ // Words-const WORD64_MAX_VALUE = exports.primIntegerFromString("18446744073709552000");+const WORD64_MAX_VALUE = 18446744073709552000n; -exports.primWord64ToNat = function(x) {-    return x;-};-exports.primWord64FromNat = function(x) {-    return x.remainder(WORD64_MAX_VALUE);-};-exports.uprimWord64Plus = function(x, y) {-    return x.add(y).remainder(WORD64_MAX_VALUE);-};-exports.uprimWord64Minus = function(x, y) {-    return x.add(WORD64_MAX_VALUE).subtract(y).remainder(WORD64_MAX_VALUE);-};-exports.uprimWord64Multiply = function(x, y) {-    return x.multiply(y).remainder(WORD64_MAX_VALUE);-};+// primWord64ToNat : Word64 -> Nat+exports.primWord64ToNat = x => x; +// primWord64FromNat : Nat -> Word64+exports.primWord64FromNat = x => x % WORD64_MAX_VALUE;++// uprimWord64Plus : (Word64, Word64) -> Word64+exports.uprimWord64Plus = (x, y) => (x + y) % WORD64_MAX_VALUE;++// uprimWord64Minus : (Word64, Word64) -> Word64+exports.uprimWord64Minus = (x, y) => (x + WORD64_MAX_VALUE - y) % WORD64_MAX_VALUE;++// uprimWord64Multiply : (Word64, Word64) -> Word64+exports.uprimWord64Multiply = (x, y) => (x * y) % WORD64_MAX_VALUE;+ // Natural numbers-exports.primNatMinus = function(x) {-  return function(y) {-    var z = x.subtract(y);-    if (z.isNegative()) {-      return biginteger.ZERO;-    } else {-      return z;-    }-  };++// primNatMinus : Nat -> Nat -> Nat+exports.primNatMinus = x => y => {+  const z = x - y;+  return z < 0n ? 0n : z; };  // Floating-point numbers@@ -192,11 +185,11 @@   // These WORD64 values were obtained via `castDoubleToWord64` in Haskell:-const WORD64_NAN      = exports.primIntegerFromString("18444492273895866368");-const WORD64_POS_INF  = exports.primIntegerFromString("9218868437227405312");-const WORD64_NEG_INF  = exports.primIntegerFromString("18442240474082181120");-const WORD64_POS_ZERO = exports.primIntegerFromString("0");-const WORD64_NEG_ZERO = exports.primIntegerFromString("9223372036854775808");+const WORD64_NAN      = 18444492273895866368n;+const WORD64_POS_INF  = 9218868437227405312n;+const WORD64_NEG_INF  = 18442240474082181120n;+const WORD64_POS_ZERO = 0n;+const WORD64_NEG_ZERO = 9223372036854775808n;  exports.primFloatToWord64 = function(x) {     if (exports.primFloatIsNaN(x)) {@@ -223,32 +216,33 @@         sign = (sign === -1 ? "1" : "0");         mantissa = (mantissa.toString(2)).padStart(11, "0");         exponent = (mantissa.toString(2)).padStart(52, "0");-        return exports.primIntegerFromString(parseInt(-            sign + mantissa + exponent, 2).toString());+        return BigInt(parseInt(sign + mantissa + exponent, 2));     } }; -exports.primNatToFloat = function(x) {-    return x.valueOf();-};-exports.primIntToFloat = function(x) {-    return x.valueOf();-};-exports.primRatioToFloat = function(x) {-    return function(y) {-        return x.valueOf() / y.valueOf();-    };-};-exports.uprimFloatEncode = function(x, y) {-    var mantissa = x.valueOf();-    var exponent = y.valueOf();-    if (Number.isSafeInteger(mantissa) && -1024 <= exponent && exponent <= 1024) {-        return mantissa * (2 ** exponent);-    }-    else {-        return null;-    }+// primNatToFloat : Nat -> Float+exports.primNatToFloat = Number;++// primIntToFloat : Int -> Float+exports.primIntToFloat = Number;++// primRatioToFloat : Int -> Int -> Float+exports.primRatioToFloat = x => y => Number(x) / Number(y);++// uprimFloatEncode : (Int, Int) -> Maybe Float+exports.uprimFloatEncode = (x, y) => {+  const mantissa = Number(x);+  const exponent = Number(y);++  if (Number.isSafeInteger(mantissa) && -1024 <= exponent && exponent <= 1024) {+    return mantissa * (2 ** exponent);+  }++  else {+    return null;+  } };+ exports.primShowFloat = function(x) {     // See Issue #2192.     if (Number.isInteger(x)) {@@ -340,32 +334,44 @@     return Math.atanh(x); }; +// Cubical primitives.+exports.primIMin = x => y => x && y;+exports.primIMax = x => y => x || y;+exports.primINeg = x => !x;+exports.primPartial = _ => _ => x => x;+exports.primPartialP = _ => _ => x => x;+exports.primPOr = _ => i => _ => _ => x => y => i ? x : y;+exports.primComp = _ => _ => _ => _ => x => x;+exports.primTransp = _ => _ => _ => x => x;+exports.primHComp = _ => _ => _ => _ => x => x;+exports.primSubOut = _ => _ => _ => _ => x => x;+exports.prim_glueU = _ => _ => _ => _ => _ => x => x;+exports.prim_unglueU = _ => _ => _ => _ => x => x;+exports.primFaceForall = f => f(true) == true && f(false) == false;+exports.primDepIMin =+    i => f => i ? f({ "tt" : a => a["tt"]() }) : false;+exports.primIdFace = _ => _ => _ => _ => x => x["i"];+exports.primIdPath = _ => _ => _ => _ => x => x["p"];+exports.primIdJ = _ => _ => _ => _ => _ => x => _ => _ => x;+exports.primIdElim =+    _ => _ => _ => _ => _ => f => x => y => f(y["i"])(x)(y["p"]);+ // Other stuff-exports.primSeq = function(x, y) {-  return y;-};-exports.uprimQNameEquality = function(x,y) {-    return x["id"].compare(y["id"]) == 0 && x["moduleId"].compare(y["moduleId"]) == 0;-};-exports.primQNameEquality = function(x) {-    return function(y) {-        return exports.uprimQNameEquality(x, y);-    };-};-exports.primQNameLess = function(x) {-  return function(y) {-    switch (x["id"].compare(y["id"])) {-      case -1: return true;-      case  1: return false;-      default: return x["moduleId"].compare(y["moduleId"]) == -1;-    };-  };-};-exports.primShowQName = function(x) {-    return x["name"];-};-exports.primQNameFixity = function(x) {-    return x["fixity"];-}; +// primSeq : (X, Y) -> Y+exports.primSeq = (x, y) => y; +// uprimQNameEquality : (Name, Name) -> Bool+exports.uprimQNameEquality = (x, y) => x['id'] === y['id'] && x['moduleId'] === y['moduleId'];++// primQNameEquality : Name -> Name -> Bool+exports.primQNameEquality = x => y => exports.uprimQNameEquality(x, y);++// primQNameLess : Name -> Name -> Bool+exports.primQNameLess = x => y => x['id'] === y['id'] ? x['moduleId'] < y['moduleId'] : x['id'] < y['id'];++// primShowQName : Name -> String+exports.primShowQName = x => x['name'];++// primQNameFixity : Name -> Fixity+exports.primQNameFixity = x => x['fixity'];
− src/data/JS/biginteger.js
@@ -1,1620 +0,0 @@-/*-	JavaScript BigInteger library version 0.9.1-	http://silentmatt.com/biginteger/--	Copyright (c) 2009 Matthew Crumley <email@matthewcrumley.com>-	Copyright (c) 2010,2011 by John Tobey <John.Tobey@gmail.com>-	Licensed under the MIT license.--	Support for arbitrary internal representation base was added by-	Vitaly Magerya.-*/--/*-	File: biginteger.js--	Exports:--		<BigInteger>-*/-(function(exports) {-"use strict";-/*-	Class: BigInteger-	An arbitrarily-large integer.--	<BigInteger> objects should be considered immutable. None of the "built-in"-	methods modify *this* or their arguments. All properties should be-	considered private.--	All the methods of <BigInteger> instances can be called "statically". The-	static versions are convenient if you don't already have a <BigInteger>-	object.--	As an example, these calls are equivalent.--	> BigInteger(4).multiply(5); // returns BigInteger(20);-	> BigInteger.multiply(4, 5); // returns BigInteger(20);--	> var a = 42;-	> var a = BigInteger.toJSValue("0b101010"); // Not completely useless...-*/--var CONSTRUCT = {}; // Unique token to call "private" version of constructor--/*-	Constructor: BigInteger()-	Convert a value to a <BigInteger>.--	Although <BigInteger()> is the constructor for <BigInteger> objects, it is-	best not to call it as a constructor. If *n* is a <BigInteger> object, it is-	simply returned as-is. Otherwise, <BigInteger()> is equivalent to <parse>-	without a radix argument.--	> var n0 = BigInteger();      // Same as <BigInteger.ZERO>-	> var n1 = BigInteger("123"); // Create a new <BigInteger> with value 123-	> var n2 = BigInteger(123);   // Create a new <BigInteger> with value 123-	> var n3 = BigInteger(n2);    // Return n2, unchanged--	The constructor form only takes an array and a sign. *n* must be an-	array of numbers in little-endian order, where each digit is between 0-	and BigInteger.base.  The second parameter sets the sign: -1 for-	negative, +1 for positive, or 0 for zero. The array is *not copied and-	may be modified*. If the array contains only zeros, the sign parameter-	is ignored and is forced to zero.--	> new BigInteger([5], -1): create a new BigInteger with value -5--	Parameters:--		n - Value to convert to a <BigInteger>.--	Returns:--		A <BigInteger> value.--	See Also:--		<parse>, <BigInteger>-*/-function BigInteger(n, s, token) {-	if (token !== CONSTRUCT) {-		if (n instanceof BigInteger) {-			return n;-		}-		else if (typeof n === "undefined") {-			return ZERO;-		}-		return BigInteger.parse(n);-	}--	n = n || [];  // Provide the nullary constructor for subclasses.-	while (n.length && !n[n.length - 1]) {-		--n.length;-	}-	this._d = n;-	this._s = n.length ? (s || 1) : 0;-}--BigInteger._construct = function(n, s) {-	return new BigInteger(n, s, CONSTRUCT);-};--// Base-10 speedup hacks in parse, toString, exp10 and log functions-// require base to be a power of 10. 10^7 is the largest such power-// that won't cause a precision loss when digits are multiplied.-var BigInteger_base = 10000000;-var BigInteger_base_log10 = 7;--BigInteger.base = BigInteger_base;-BigInteger.base_log10 = BigInteger_base_log10;--var ZERO = new BigInteger([], 0, CONSTRUCT);-// Constant: ZERO-// <BigInteger> 0.-BigInteger.ZERO = ZERO;--var ONE = new BigInteger([1], 1, CONSTRUCT);-// Constant: ONE-// <BigInteger> 1.-BigInteger.ONE = ONE;--var M_ONE = new BigInteger(ONE._d, -1, CONSTRUCT);-// Constant: M_ONE-// <BigInteger> -1.-BigInteger.M_ONE = M_ONE;--// Constant: _0-// Shortcut for <ZERO>.-BigInteger._0 = ZERO;--// Constant: _1-// Shortcut for <ONE>.-BigInteger._1 = ONE;--/*-	Constant: small-	Array of <BigIntegers> from 0 to 36.--	These are used internally for parsing, but useful when you need a "small"-	<BigInteger>.--	See Also:--		<ZERO>, <ONE>, <_0>, <_1>-*/-BigInteger.small = [-	ZERO,-	ONE,-	/* Assuming BigInteger_base > 36 */-	new BigInteger( [2], 1, CONSTRUCT),-	new BigInteger( [3], 1, CONSTRUCT),-	new BigInteger( [4], 1, CONSTRUCT),-	new BigInteger( [5], 1, CONSTRUCT),-	new BigInteger( [6], 1, CONSTRUCT),-	new BigInteger( [7], 1, CONSTRUCT),-	new BigInteger( [8], 1, CONSTRUCT),-	new BigInteger( [9], 1, CONSTRUCT),-	new BigInteger([10], 1, CONSTRUCT),-	new BigInteger([11], 1, CONSTRUCT),-	new BigInteger([12], 1, CONSTRUCT),-	new BigInteger([13], 1, CONSTRUCT),-	new BigInteger([14], 1, CONSTRUCT),-	new BigInteger([15], 1, CONSTRUCT),-	new BigInteger([16], 1, CONSTRUCT),-	new BigInteger([17], 1, CONSTRUCT),-	new BigInteger([18], 1, CONSTRUCT),-	new BigInteger([19], 1, CONSTRUCT),-	new BigInteger([20], 1, CONSTRUCT),-	new BigInteger([21], 1, CONSTRUCT),-	new BigInteger([22], 1, CONSTRUCT),-	new BigInteger([23], 1, CONSTRUCT),-	new BigInteger([24], 1, CONSTRUCT),-	new BigInteger([25], 1, CONSTRUCT),-	new BigInteger([26], 1, CONSTRUCT),-	new BigInteger([27], 1, CONSTRUCT),-	new BigInteger([28], 1, CONSTRUCT),-	new BigInteger([29], 1, CONSTRUCT),-	new BigInteger([30], 1, CONSTRUCT),-	new BigInteger([31], 1, CONSTRUCT),-	new BigInteger([32], 1, CONSTRUCT),-	new BigInteger([33], 1, CONSTRUCT),-	new BigInteger([34], 1, CONSTRUCT),-	new BigInteger([35], 1, CONSTRUCT),-	new BigInteger([36], 1, CONSTRUCT)-];--// Used for parsing/radix conversion-BigInteger.digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");--/*-	Method: toString-	Convert a <BigInteger> to a string.--	When *base* is greater than 10, letters are upper case.--	Parameters:--		base - Optional base to represent the number in (default is base 10).-		       Must be between 2 and 36 inclusive, or an Error will be thrown.--	Returns:--		The string representation of the <BigInteger>.-*/-BigInteger.prototype.toString = function(base) {-	base = +base || 10;-	if (base < 2 || base > 36) {-		throw new Error("illegal radix " + base + ".");-	}-	if (this._s === 0) {-		return "0";-	}-	if (base === 10) {-		var str = this._s < 0 ? "-" : "";-		str += this._d[this._d.length - 1].toString();-		for (var i = this._d.length - 2; i >= 0; i--) {-			var group = this._d[i].toString();-			while (group.length < BigInteger_base_log10) group = '0' + group;-			str += group;-		}-		return str;-	}-	else {-		var numerals = BigInteger.digits;-		base = BigInteger.small[base];-		var sign = this._s;--		var n = this.abs();-		var digits = [];-		var digit;--		while (n._s !== 0) {-			var divmod = n.divRem(base);-			n = divmod[0];-			digit = divmod[1];-			// TODO: This could be changed to unshift instead of reversing at the end.-			// Benchmark both to compare speeds.-			digits.push(numerals[digit.valueOf()]);-		}-		return (sign < 0 ? "-" : "") + digits.reverse().join("");-	}-};--// Verify strings for parsing-BigInteger.radixRegex = [-	/^$/,-	/^$/,-	/^[01]*$/,-	/^[012]*$/,-	/^[0-3]*$/,-	/^[0-4]*$/,-	/^[0-5]*$/,-	/^[0-6]*$/,-	/^[0-7]*$/,-	/^[0-8]*$/,-	/^[0-9]*$/,-	/^[0-9aA]*$/,-	/^[0-9abAB]*$/,-	/^[0-9abcABC]*$/,-	/^[0-9a-dA-D]*$/,-	/^[0-9a-eA-E]*$/,-	/^[0-9a-fA-F]*$/,-	/^[0-9a-gA-G]*$/,-	/^[0-9a-hA-H]*$/,-	/^[0-9a-iA-I]*$/,-	/^[0-9a-jA-J]*$/,-	/^[0-9a-kA-K]*$/,-	/^[0-9a-lA-L]*$/,-	/^[0-9a-mA-M]*$/,-	/^[0-9a-nA-N]*$/,-	/^[0-9a-oA-O]*$/,-	/^[0-9a-pA-P]*$/,-	/^[0-9a-qA-Q]*$/,-	/^[0-9a-rA-R]*$/,-	/^[0-9a-sA-S]*$/,-	/^[0-9a-tA-T]*$/,-	/^[0-9a-uA-U]*$/,-	/^[0-9a-vA-V]*$/,-	/^[0-9a-wA-W]*$/,-	/^[0-9a-xA-X]*$/,-	/^[0-9a-yA-Y]*$/,-	/^[0-9a-zA-Z]*$/-];--/*-	Function: parse-	Parse a string into a <BigInteger>.--	*base* is optional but, if provided, must be from 2 to 36 inclusive. If-	*base* is not provided, it will be guessed based on the leading characters-	of *s* as follows:--	- "0x" or "0X": *base* = 16-	- "0c" or "0C": *base* = 8-	- "0b" or "0B": *base* = 2-	- else: *base* = 10--	If no base is provided, or *base* is 10, the number can be in exponential-	form. For example, these are all valid:--	> BigInteger.parse("1e9");              // Same as "1000000000"-	> BigInteger.parse("1.234*10^3");       // Same as 1234-	> BigInteger.parse("56789 * 10 ** -2"); // Same as 567--	If any characters fall outside the range defined by the radix, an exception-	will be thrown.--	Parameters:--		s - The string to parse.-		base - Optional radix (default is to guess based on *s*).--	Returns:--		a <BigInteger> instance.-*/-BigInteger.parse = function(s, base) {-	// Expands a number in exponential form to decimal form.-	// expandExponential("-13.441*10^5") === "1344100";-	// expandExponential("1.12300e-1") === "0.112300";-	// expandExponential(1000000000000000000000000000000) === "1000000000000000000000000000000";-	function expandExponential(str) {-		str = str.replace(/\s*[*xX]\s*10\s*(\^|\*\*)\s*/, "e");--		return str.replace(/^([+\-])?(\d+)\.?(\d*)[eE]([+\-]?\d+)$/, function(x, s, n, f, c) {-			c = +c;-			var l = c < 0;-			var i = n.length + c;-			x = (l ? n : f).length;-			c = ((c = Math.abs(c)) >= x ? c - x + l : 0);-			var z = (new Array(c + 1)).join("0");-			var r = n + f;-			return (s || "") + (l ? r = z + r : r += z).substr(0, i += l ? z.length : 0) + (i < r.length ? "." + r.substr(i) : "");-		});-	}--	s = s.toString();-	if (typeof base === "undefined" || +base === 10) {-		s = expandExponential(s);-	}--	var prefixRE;-	if (typeof base === "undefined") {-		prefixRE = '0[xcb]';-	}-	else if (base == 16) {-		prefixRE = '0x';-	}-	else if (base == 8) {-		prefixRE = '0c';-	}-	else if (base == 2) {-		prefixRE = '0b';-	}-	else {-		prefixRE = '';-	}-	var parts = new RegExp('^([+\\-]?)(' + prefixRE + ')?([0-9a-z]*)(?:\\.\\d*)?$', 'i').exec(s);-	if (parts) {-		var sign = parts[1] || "+";-		var baseSection = parts[2] || "";-		var digits = parts[3] || "";--		if (typeof base === "undefined") {-			// Guess base-			if (baseSection === "0x" || baseSection === "0X") { // Hex-				base = 16;-			}-			else if (baseSection === "0c" || baseSection === "0C") { // Octal-				base = 8;-			}-			else if (baseSection === "0b" || baseSection === "0B") { // Binary-				base = 2;-			}-			else {-				base = 10;-			}-		}-		else if (base < 2 || base > 36) {-			throw new Error("Illegal radix " + base + ".");-		}--		base = +base;--		// Check for digits outside the range-		if (!(BigInteger.radixRegex[base].test(digits))) {-			throw new Error("Bad digit for radix " + base);-		}--		// Strip leading zeros, and convert to array-		digits = digits.replace(/^0+/, "").split("");-		if (digits.length === 0) {-			return ZERO;-		}--		// Get the sign (we know it's not zero)-		sign = (sign === "-") ? -1 : 1;--		// Optimize 10-		if (base == 10) {-			var d = [];-			while (digits.length >= BigInteger_base_log10) {-				d.push(parseInt(digits.splice(digits.length-BigInteger.base_log10, BigInteger.base_log10).join(''), 10));-			}-			d.push(parseInt(digits.join(''), 10));-			return new BigInteger(d, sign, CONSTRUCT);-		}--		// Do the conversion-		var d = ZERO;-		base = BigInteger.small[base];-		var small = BigInteger.small;-		for (var i = 0; i < digits.length; i++) {-			d = d.multiply(base).add(small[parseInt(digits[i], 36)]);-		}-		return new BigInteger(d._d, sign, CONSTRUCT);-	}-	else {-		throw new Error("Invalid BigInteger format: " + s);-	}-};--/*-	Function: add-	Add two <BigIntegers>.--	Parameters:--		n - The number to add to *this*. Will be converted to a <BigInteger>.--	Returns:--		The numbers added together.--	See Also:--		<subtract>, <multiply>, <quotient>, <next>-*/-BigInteger.prototype.add = function(n) {-	if (this._s === 0) {-		return BigInteger(n);-	}--	n = BigInteger(n);-	if (n._s === 0) {-		return this;-	}-	if (this._s !== n._s) {-		n = n.negate();-		return this.subtract(n);-	}--	var a = this._d;-	var b = n._d;-	var al = a.length;-	var bl = b.length;-	var sum = new Array(Math.max(al, bl) + 1);-	var size = Math.min(al, bl);-	var carry = 0;-	var digit;--	for (var i = 0; i < size; i++) {-		digit = a[i] + b[i] + carry;-		sum[i] = digit % BigInteger_base;-		carry = (digit / BigInteger_base) | 0;-	}-	if (bl > al) {-		a = b;-		al = bl;-	}-	for (i = size; carry && i < al; i++) {-		digit = a[i] + carry;-		sum[i] = digit % BigInteger_base;-		carry = (digit / BigInteger_base) | 0;-	}-	if (carry) {-		sum[i] = carry;-	}--	for ( ; i < al; i++) {-		sum[i] = a[i];-	}--	return new BigInteger(sum, this._s, CONSTRUCT);-};--/*-	Function: negate-	Get the additive inverse of a <BigInteger>.--	Returns:--		A <BigInteger> with the same magnatude, but with the opposite sign.--	See Also:--		<abs>-*/-BigInteger.prototype.negate = function() {-	return new BigInteger(this._d, (-this._s) | 0, CONSTRUCT);-};--/*-	Function: abs-	Get the absolute value of a <BigInteger>.--	Returns:--		A <BigInteger> with the same magnatude, but always positive (or zero).--	See Also:--		<negate>-*/-BigInteger.prototype.abs = function() {-	return (this._s < 0) ? this.negate() : this;-};--/*-	Function: subtract-	Subtract two <BigIntegers>.--	Parameters:--		n - The number to subtract from *this*. Will be converted to a <BigInteger>.--	Returns:--		The *n* subtracted from *this*.--	See Also:--		<add>, <multiply>, <quotient>, <prev>-*/-BigInteger.prototype.subtract = function(n) {-	if (this._s === 0) {-		return BigInteger(n).negate();-	}--	n = BigInteger(n);-	if (n._s === 0) {-		return this;-	}-	if (this._s !== n._s) {-		n = n.negate();-		return this.add(n);-	}--	var m = this;-	// negative - negative => -|a| - -|b| => -|a| + |b| => |b| - |a|-	if (this._s < 0) {-		m = new BigInteger(n._d, 1, CONSTRUCT);-		n = new BigInteger(this._d, 1, CONSTRUCT);-	}--	// Both are positive => a - b-	var sign = m.compareAbs(n);-	if (sign === 0) {-		return ZERO;-	}-	else if (sign < 0) {-		// swap m and n-		var t = n;-		n = m;-		m = t;-	}--	// a > b-	var a = m._d;-	var b = n._d;-	var al = a.length;-	var bl = b.length;-	var diff = new Array(al); // al >= bl since a > b-	var borrow = 0;-	var i;-	var digit;--	for (i = 0; i < bl; i++) {-		digit = a[i] - borrow - b[i];-		if (digit < 0) {-			digit += BigInteger_base;-			borrow = 1;-		}-		else {-			borrow = 0;-		}-		diff[i] = digit;-	}-	for (i = bl; i < al; i++) {-		digit = a[i] - borrow;-		if (digit < 0) {-			digit += BigInteger_base;-		}-		else {-			diff[i++] = digit;-			break;-		}-		diff[i] = digit;-	}-	for ( ; i < al; i++) {-		diff[i] = a[i];-	}--	return new BigInteger(diff, sign, CONSTRUCT);-};--(function() {-	function addOne(n, sign) {-		var a = n._d;-		var sum = a.slice();-		var carry = true;-		var i = 0;--		while (true) {-			var digit = (a[i] || 0) + 1;-			sum[i] = digit % BigInteger_base;-			if (digit <= BigInteger_base - 1) {-				break;-			}-			++i;-		}--		return new BigInteger(sum, sign, CONSTRUCT);-	}--	function subtractOne(n, sign) {-		var a = n._d;-		var sum = a.slice();-		var borrow = true;-		var i = 0;--		while (true) {-			var digit = (a[i] || 0) - 1;-			if (digit < 0) {-				sum[i] = digit + BigInteger_base;-			}-			else {-				sum[i] = digit;-				break;-			}-			++i;-		}--		return new BigInteger(sum, sign, CONSTRUCT);-	}--	/*-		Function: next-		Get the next <BigInteger> (add one).--		Returns:--			*this* + 1.--		See Also:--			<add>, <prev>-	*/-	BigInteger.prototype.next = function() {-		switch (this._s) {-		case 0:-			return ONE;-		case -1:-			return subtractOne(this, -1);-		// case 1:-		default:-			return addOne(this, 1);-		}-	};--	/*-		Function: prev-		Get the previous <BigInteger> (subtract one).--		Returns:--			*this* - 1.--		See Also:--			<next>, <subtract>-	*/-	BigInteger.prototype.prev = function() {-		switch (this._s) {-		case 0:-			return M_ONE;-		case -1:-			return addOne(this, -1);-		// case 1:-		default:-			return subtractOne(this, 1);-		}-	};-})();--/*-	Function: compareAbs-	Compare the absolute value of two <BigIntegers>.--	Calling <compareAbs> is faster than calling <abs> twice, then <compare>.--	Parameters:--		n - The number to compare to *this*. Will be converted to a <BigInteger>.--	Returns:--		-1, 0, or +1 if *|this|* is less than, equal to, or greater than *|n|*.--	See Also:--		<compare>, <abs>-*/-BigInteger.prototype.compareAbs = function(n) {-	if (this === n) {-		return 0;-	}--	if (!(n instanceof BigInteger)) {-		if (!isFinite(n)) {-			return(isNaN(n) ? n : -1);-		}-		n = BigInteger(n);-	}--	if (this._s === 0) {-		return (n._s !== 0) ? -1 : 0;-	}-	if (n._s === 0) {-		return 1;-	}--	var l = this._d.length;-	var nl = n._d.length;-	if (l < nl) {-		return -1;-	}-	else if (l > nl) {-		return 1;-	}--	var a = this._d;-	var b = n._d;-	for (var i = l-1; i >= 0; i--) {-		if (a[i] !== b[i]) {-			return a[i] < b[i] ? -1 : 1;-		}-	}--	return 0;-};--/*-	Function: compare-	Compare two <BigIntegers>.--	Parameters:--		n - The number to compare to *this*. Will be converted to a <BigInteger>.--	Returns:--		-1, 0, or +1 if *this* is less than, equal to, or greater than *n*.--	See Also:--		<compareAbs>, <isPositive>, <isNegative>, <isUnit>-*/-BigInteger.prototype.compare = function(n) {-	if (this === n) {-		return 0;-	}--	n = BigInteger(n);--	if (this._s === 0) {-		return -n._s;-	}--	if (this._s === n._s) { // both positive or both negative-		var cmp = this.compareAbs(n);-		return cmp * this._s;-	}-	else {-		return this._s;-	}-};--/*-	Function: isUnit-	Return true iff *this* is either 1 or -1.--	Returns:--		true if *this* compares equal to <BigInteger.ONE> or <BigInteger.M_ONE>.--	See Also:--		<isZero>, <isNegative>, <isPositive>, <compareAbs>, <compare>,-		<BigInteger.ONE>, <BigInteger.M_ONE>-*/-BigInteger.prototype.isUnit = function() {-	return this === ONE ||-		this === M_ONE ||-		(this._d.length === 1 && this._d[0] === 1);-};--/*-	Function: multiply-	Multiply two <BigIntegers>.--	Parameters:--		n - The number to multiply *this* by. Will be converted to a-		<BigInteger>.--	Returns:--		The numbers multiplied together.--	See Also:--		<add>, <subtract>, <quotient>, <square>-*/-BigInteger.prototype.multiply = function(n) {-	// TODO: Consider adding Karatsuba multiplication for large numbers-	if (this._s === 0) {-		return ZERO;-	}--	n = BigInteger(n);-	if (n._s === 0) {-		return ZERO;-	}-	if (this.isUnit()) {-		if (this._s < 0) {-			return n.negate();-		}-		return n;-	}-	if (n.isUnit()) {-		if (n._s < 0) {-			return this.negate();-		}-		return this;-	}-	if (this === n) {-		return this.square();-	}--	var r = (this._d.length >= n._d.length);-	var a = (r ? this : n)._d; // a will be longer than b-	var b = (r ? n : this)._d;-	var al = a.length;-	var bl = b.length;--	var pl = al + bl;-	var partial = new Array(pl);-	var i;-	for (i = 0; i < pl; i++) {-		partial[i] = 0;-	}--	for (i = 0; i < bl; i++) {-		var carry = 0;-		var bi = b[i];-		var jlimit = al + i;-		var digit;-		for (var j = i; j < jlimit; j++) {-			digit = partial[j] + bi * a[j - i] + carry;-			carry = (digit / BigInteger_base) | 0;-			partial[j] = (digit % BigInteger_base) | 0;-		}-		if (carry) {-			digit = partial[j] + carry;-			carry = (digit / BigInteger_base) | 0;-			partial[j] = digit % BigInteger_base;-		}-	}-	return new BigInteger(partial, this._s * n._s, CONSTRUCT);-};--// Multiply a BigInteger by a single-digit native number-// Assumes that this and n are >= 0-// This is not really intended to be used outside the library itself-BigInteger.prototype.multiplySingleDigit = function(n) {-	if (n === 0 || this._s === 0) {-		return ZERO;-	}-	if (n === 1) {-		return this;-	}--	var digit;-	if (this._d.length === 1) {-		digit = this._d[0] * n;-		if (digit >= BigInteger_base) {-			return new BigInteger([(digit % BigInteger_base)|0,-					(digit / BigInteger_base)|0], 1, CONSTRUCT);-		}-		return new BigInteger([digit], 1, CONSTRUCT);-	}--	if (n === 2) {-		return this.add(this);-	}-	if (this.isUnit()) {-		return new BigInteger([n], 1, CONSTRUCT);-	}--	var a = this._d;-	var al = a.length;--	var pl = al + 1;-	var partial = new Array(pl);-	for (var i = 0; i < pl; i++) {-		partial[i] = 0;-	}--	var carry = 0;-	for (var j = 0; j < al; j++) {-		digit = n * a[j] + carry;-		carry = (digit / BigInteger_base) | 0;-		partial[j] = (digit % BigInteger_base) | 0;-	}-	if (carry) {-		partial[j] = carry;-	}--	return new BigInteger(partial, 1, CONSTRUCT);-};--/*-	Function: square-	Multiply a <BigInteger> by itself.--	This is slightly faster than regular multiplication, since it removes the-	duplicated multiplcations.--	Returns:--		> this.multiply(this)--	See Also:-		<multiply>-*/-BigInteger.prototype.square = function() {-	// Normally, squaring a 10-digit number would take 100 multiplications.-	// Of these 10 are unique diagonals, of the remaining 90 (100-10), 45 are repeated.-	// This procedure saves (N*(N-1))/2 multiplications, (e.g., 45 of 100 multiplies).-	// Based on code by Gary Darby, Intellitech Systems Inc., www.DelphiForFun.org--	if (this._s === 0) {-		return ZERO;-	}-	if (this.isUnit()) {-		return ONE;-	}--	var digits = this._d;-	var length = digits.length;-	var imult1 = new Array(length + length + 1);-	var product, carry, k;-	var i;--	// Calculate diagonal-	for (i = 0; i < length; i++) {-		k = i * 2;-		product = digits[i] * digits[i];-		carry = (product / BigInteger_base) | 0;-		imult1[k] = product % BigInteger_base;-		imult1[k + 1] = carry;-	}--	// Calculate repeating part-	for (i = 0; i < length; i++) {-		carry = 0;-		k = i * 2 + 1;-		for (var j = i + 1; j < length; j++, k++) {-			product = digits[j] * digits[i] * 2 + imult1[k] + carry;-			carry = (product / BigInteger_base) | 0;-			imult1[k] = product % BigInteger_base;-		}-		k = length + i;-		var digit = carry + imult1[k];-		carry = (digit / BigInteger_base) | 0;-		imult1[k] = digit % BigInteger_base;-		imult1[k + 1] += carry;-	}--	return new BigInteger(imult1, 1, CONSTRUCT);-};--/*-	Function: quotient-	Divide two <BigIntegers> and truncate towards zero.--	<quotient> throws an exception if *n* is zero.--	Parameters:--		n - The number to divide *this* by. Will be converted to a <BigInteger>.--	Returns:--		The *this* / *n*, truncated to an integer.--	See Also:--		<add>, <subtract>, <multiply>, <divRem>, <remainder>-*/-BigInteger.prototype.quotient = function(n) {-	return this.divRem(n)[0];-};--/*-	Function: divide-	Deprecated synonym for <quotient>.-*/-BigInteger.prototype.divide = BigInteger.prototype.quotient;--/*-	Function: remainder-	Calculate the remainder of two <BigIntegers>.--	<remainder> throws an exception if *n* is zero.--	Parameters:--		n - The remainder after *this* is divided *this* by *n*. Will be-		    converted to a <BigInteger>.--	Returns:--		*this* % *n*.--	See Also:--		<divRem>, <quotient>-*/-BigInteger.prototype.remainder = function(n) {-	return this.divRem(n)[1];-};--/*-	Function: divRem-	Calculate the integer quotient and remainder of two <BigIntegers>.--	<divRem> throws an exception if *n* is zero.--	Parameters:--		n - The number to divide *this* by. Will be converted to a <BigInteger>.--	Returns:--		A two-element array containing the quotient and the remainder.--		> a.divRem(b)--		is exactly equivalent to--		> [a.quotient(b), a.remainder(b)]--		except it is faster, because they are calculated at the same time.--	See Also:--		<quotient>, <remainder>-*/-BigInteger.prototype.divRem = function(n) {-	n = BigInteger(n);-	if (n._s === 0) {-		throw new Error("Divide by zero");-	}-	if (this._s === 0) {-		return [ZERO, ZERO];-	}-	if (n._d.length === 1) {-		return this.divRemSmall(n._s * n._d[0]);-	}--	// Test for easy cases -- |n1| <= |n2|-	switch (this.compareAbs(n)) {-	case 0: // n1 == n2-		return [this._s === n._s ? ONE : M_ONE, ZERO];-	case -1: // |n1| < |n2|-		return [ZERO, this];-	}--	var sign = this._s * n._s;-	var a = n.abs();-	var b_digits = this._d;-	var b_index = b_digits.length;-	var digits = n._d.length;-	var quot = [];-	var guess;--	var part = new BigInteger([], 0, CONSTRUCT);--	while (b_index) {-		part._d.unshift(b_digits[--b_index]);-		part = new BigInteger(part._d, 1, CONSTRUCT);--		if (part.compareAbs(n) < 0) {-			quot.push(0);-			continue;-		}-		if (part._s === 0) {-			guess = 0;-		}-		else {-			var xlen = part._d.length, ylen = a._d.length;-			var highx = part._d[xlen-1]*BigInteger_base + part._d[xlen-2];-			var highy = a._d[ylen-1]*BigInteger_base + a._d[ylen-2];-			if (part._d.length > a._d.length) {-				// The length of part._d can either match a._d length,-				// or exceed it by one.-				highx = (highx+1)*BigInteger_base;-			}-			guess = Math.ceil(highx/highy);-		}-		do {-			var check = a.multiplySingleDigit(guess);-			if (check.compareAbs(part) <= 0) {-				break;-			}-			guess--;-		} while (guess);--		quot.push(guess);-		if (!guess) {-			continue;-		}-		var diff = part.subtract(check);-		part._d = diff._d.slice();-	}--	return [new BigInteger(quot.reverse(), sign, CONSTRUCT),-		   new BigInteger(part._d, this._s, CONSTRUCT)];-};--// Throws an exception if n is outside of (-BigInteger.base, -1] or-// [1, BigInteger.base).  It's not necessary to call this, since the-// other division functions will call it if they are able to.-BigInteger.prototype.divRemSmall = function(n) {-	var r;-	n = +n;-	if (n === 0) {-		throw new Error("Divide by zero");-	}--	var n_s = n < 0 ? -1 : 1;-	var sign = this._s * n_s;-	n = Math.abs(n);--	if (n < 1 || n >= BigInteger_base) {-		throw new Error("Argument out of range");-	}--	if (this._s === 0) {-		return [ZERO, ZERO];-	}--	if (n === 1 || n === -1) {-		return [(sign === 1) ? this.abs() : new BigInteger(this._d, sign, CONSTRUCT), ZERO];-	}--	// 2 <= n < BigInteger_base--	// divide a single digit by a single digit-	if (this._d.length === 1) {-		var q = new BigInteger([(this._d[0] / n) | 0], 1, CONSTRUCT);-		r = new BigInteger([(this._d[0] % n) | 0], 1, CONSTRUCT);-		if (sign < 0) {-			q = q.negate();-		}-		if (this._s < 0) {-			r = r.negate();-		}-		return [q, r];-	}--	var digits = this._d.slice();-	var quot = new Array(digits.length);-	var part = 0;-	var diff = 0;-	var i = 0;-	var guess;--	while (digits.length) {-		part = part * BigInteger_base + digits[digits.length - 1];-		if (part < n) {-			quot[i++] = 0;-			digits.pop();-			diff = BigInteger_base * diff + part;-			continue;-		}-		if (part === 0) {-			guess = 0;-		}-		else {-			guess = (part / n) | 0;-		}--		var check = n * guess;-		diff = part - check;-		quot[i++] = guess;-		if (!guess) {-			digits.pop();-			continue;-		}--		digits.pop();-		part = diff;-	}--	r = new BigInteger([diff], 1, CONSTRUCT);-	if (this._s < 0) {-		r = r.negate();-	}-	return [new BigInteger(quot.reverse(), sign, CONSTRUCT), r];-};--/*-	Function: isEven-	Return true iff *this* is divisible by two.--	Note that <BigInteger.ZERO> is even.--	Returns:--		true if *this* is even, false otherwise.--	See Also:--		<isOdd>-*/-BigInteger.prototype.isEven = function() {-	var digits = this._d;-	return this._s === 0 || digits.length === 0 || (digits[0] % 2) === 0;-};--/*-	Function: isOdd-	Return true iff *this* is not divisible by two.--	Returns:--		true if *this* is odd, false otherwise.--	See Also:--		<isEven>-*/-BigInteger.prototype.isOdd = function() {-	return !this.isEven();-};--/*-	Function: sign-	Get the sign of a <BigInteger>.--	Returns:--		* -1 if *this* < 0-		* 0 if *this* == 0-		* +1 if *this* > 0--	See Also:--		<isZero>, <isPositive>, <isNegative>, <compare>, <BigInteger.ZERO>-*/-BigInteger.prototype.sign = function() {-	return this._s;-};--/*-	Function: isPositive-	Return true iff *this* > 0.--	Returns:--		true if *this*.compare(<BigInteger.ZERO>) == 1.--	See Also:--		<sign>, <isZero>, <isNegative>, <isUnit>, <compare>, <BigInteger.ZERO>-*/-BigInteger.prototype.isPositive = function() {-	return this._s > 0;-};--/*-	Function: isNegative-	Return true iff *this* < 0.--	Returns:--		true if *this*.compare(<BigInteger.ZERO>) == -1.--	See Also:--		<sign>, <isPositive>, <isZero>, <isUnit>, <compare>, <BigInteger.ZERO>-*/-BigInteger.prototype.isNegative = function() {-	return this._s < 0;-};--/*-	Function: isZero-	Return true iff *this* == 0.--	Returns:--		true if *this*.compare(<BigInteger.ZERO>) == 0.--	See Also:--		<sign>, <isPositive>, <isNegative>, <isUnit>, <BigInteger.ZERO>-*/-BigInteger.prototype.isZero = function() {-	return this._s === 0;-};--/*-	Function: exp10-	Multiply a <BigInteger> by a power of 10.--	This is equivalent to, but faster than--	> if (n >= 0) {-	>     return this.multiply(BigInteger("1e" + n));-	> }-	> else { // n <= 0-	>     return this.quotient(BigInteger("1e" + -n));-	> }--	Parameters:--		n - The power of 10 to multiply *this* by. *n* is converted to a-		javascipt number and must be no greater than <BigInteger.MAX_EXP>-		(0x7FFFFFFF), or an exception will be thrown.--	Returns:--		*this* * (10 ** *n*), truncated to an integer if necessary.--	See Also:--		<pow>, <multiply>-*/-BigInteger.prototype.exp10 = function(n) {-	n = +n;-	if (n === 0) {-		return this;-	}-	if (Math.abs(n) > Number(MAX_EXP)) {-		throw new Error("exponent too large in BigInteger.exp10");-	}-	// Optimization for this == 0. This also keeps us from having to trim zeros in the positive n case-	if (this._s === 0) {-		return ZERO;-	}-	if (n > 0) {-		var k = new BigInteger(this._d.slice(), this._s, CONSTRUCT);--		for (; n >= BigInteger_base_log10; n -= BigInteger_base_log10) {-			k._d.unshift(0);-		}-		if (n == 0)-			return k;-		k._s = 1;-		k = k.multiplySingleDigit(Math.pow(10, n));-		return (this._s < 0 ? k.negate() : k);-	} else if (-n >= this._d.length*BigInteger_base_log10) {-		return ZERO;-	} else {-		var k = new BigInteger(this._d.slice(), this._s, CONSTRUCT);--		for (n = -n; n >= BigInteger_base_log10; n -= BigInteger_base_log10) {-			k._d.shift();-		}-		return (n == 0) ? k : k.divRemSmall(Math.pow(10, n))[0];-	}-};--/*-	Function: pow-	Raise a <BigInteger> to a power.--	In this implementation, 0**0 is 1.--	Parameters:--		n - The exponent to raise *this* by. *n* must be no greater than-		<BigInteger.MAX_EXP> (0x7FFFFFFF), or an exception will be thrown.--	Returns:--		*this* raised to the *nth* power.--	See Also:--		<modPow>-*/-BigInteger.prototype.pow = function(n) {-	if (this.isUnit()) {-		if (this._s > 0) {-			return this;-		}-		else {-			return BigInteger(n).isOdd() ? this : this.negate();-		}-	}--	n = BigInteger(n);-	if (n._s === 0) {-		return ONE;-	}-	else if (n._s < 0) {-		if (this._s === 0) {-			throw new Error("Divide by zero");-		}-		else {-			return ZERO;-		}-	}-	if (this._s === 0) {-		return ZERO;-	}-	if (n.isUnit()) {-		return this;-	}--	if (n.compareAbs(MAX_EXP) > 0) {-		throw new Error("exponent too large in BigInteger.pow");-	}-	var x = this;-	var aux = ONE;-	var two = BigInteger.small[2];--	while (n.isPositive()) {-		if (n.isOdd()) {-			aux = aux.multiply(x);-			if (n.isUnit()) {-				return aux;-			}-		}-		x = x.square();-		n = n.quotient(two);-	}--	return aux;-};--/*-	Function: modPow-	Raise a <BigInteger> to a power (mod m).--	Because it is reduced by a modulus, <modPow> is not limited by-	<BigInteger.MAX_EXP> like <pow>.--	Parameters:--		exponent - The exponent to raise *this* by. Must be positive.-		modulus - The modulus.--	Returns:--		*this* ^ *exponent* (mod *modulus*).--	See Also:--		<pow>, <mod>-*/-BigInteger.prototype.modPow = function(exponent, modulus) {-	var result = ONE;-	var base = this;--	while (exponent.isPositive()) {-		if (exponent.isOdd()) {-			result = result.multiply(base).remainder(modulus);-		}--		exponent = exponent.quotient(BigInteger.small[2]);-		if (exponent.isPositive()) {-			base = base.square().remainder(modulus);-		}-	}--	return result;-};--/*-	Function: log-	Get the natural logarithm of a <BigInteger> as a native JavaScript number.--	This is equivalent to--	> Math.log(this.toJSValue())--	but handles values outside of the native number range.--	Returns:--		log( *this* )--	See Also:--		<toJSValue>-*/-BigInteger.prototype.log = function() {-	switch (this._s) {-	case 0:	 return -Infinity;-	case -1: return NaN;-	default: // Fall through.-	}--	var l = this._d.length;--	if (l*BigInteger_base_log10 < 30) {-		return Math.log(this.valueOf());-	}--	var N = Math.ceil(30/BigInteger_base_log10);-	var firstNdigits = this._d.slice(l - N);-	return Math.log((new BigInteger(firstNdigits, 1, CONSTRUCT)).valueOf()) + (l - N) * Math.log(BigInteger_base);-};--/*-	Function: valueOf-	Convert a <BigInteger> to a native JavaScript integer.--	This is called automatically by JavaScipt to convert a <BigInteger> to a-	native value.--	Returns:--		> parseInt(this.toString(), 10)--	See Also:--		<toString>, <toJSValue>-*/-BigInteger.prototype.valueOf = function() {-	return parseInt(this.toString(), 10);-};--/*-	Function: toJSValue-	Convert a <BigInteger> to a native JavaScript integer.--	This is the same as valueOf, but more explicitly named.--	Returns:--		> parseInt(this.toString(), 10)--	See Also:--		<toString>, <valueOf>-*/-BigInteger.prototype.toJSValue = function() {-	return parseInt(this.toString(), 10);-};--var MAX_EXP = BigInteger(0x7FFFFFFF);-// Constant: MAX_EXP-// The largest exponent allowed in <pow> and <exp10> (0x7FFFFFFF or 2147483647).-BigInteger.MAX_EXP = MAX_EXP;--(function() {-	function makeUnary(fn) {-		return function(a) {-			return fn.call(BigInteger(a));-		};-	}--	function makeBinary(fn) {-		return function(a, b) {-			return fn.call(BigInteger(a), BigInteger(b));-		};-	}--	function makeTrinary(fn) {-		return function(a, b, c) {-			return fn.call(BigInteger(a), BigInteger(b), BigInteger(c));-		};-	}--	(function() {-		var i, fn;-		var unary = "toJSValue,isEven,isOdd,sign,isZero,isNegative,abs,isUnit,square,negate,isPositive,toString,next,prev,log".split(",");-		var binary = "compare,remainder,divRem,subtract,add,quotient,divide,multiply,pow,compareAbs".split(",");-		var trinary = ["modPow"];--		for (i = 0; i < unary.length; i++) {-			fn = unary[i];-			BigInteger[fn] = makeUnary(BigInteger.prototype[fn]);-		}--		for (i = 0; i < binary.length; i++) {-			fn = binary[i];-			BigInteger[fn] = makeBinary(BigInteger.prototype[fn]);-		}--		for (i = 0; i < trinary.length; i++) {-			fn = trinary[i];-			BigInteger[fn] = makeTrinary(BigInteger.prototype[fn]);-		}--		BigInteger.exp10 = function(x, n) {-			return BigInteger(x).exp10(n);-		};-	})();-})();--exports.BigInteger = BigInteger;-})(typeof exports !== 'undefined' ? exports : this);
− src/data/JS/highlight-hover.js
@@ -1,32 +0,0 @@-// Copyright 2002-2010, Simon Marlow.  All rights reserved.-// https://github.com/haskell/haddock/blob/ghc-8.8/LICENSE-// Slightly modified by Tesla Ice Zhang--var highlight = function (on) {-  return function () {-    var links = document.getElementsByTagName('a');-    for (var i = 0; i < links.length; i++) {-      var that = links[i];--      if (this.href != that.href) {-        continue;-      }--      if (on) {-        that.classList.add("hover-highlight");-      } else {-        that.classList.remove("hover-highlight");-      }-    }-  }-};--window.onload = function () {-  var links = document.getElementsByTagName('a');-  for (var i = 0; i < links.length; i++) {-    var link = links[i];-    if (!link.hasAttribute("href")) continue;-    link.onmouseover = highlight(true);-    link.onmouseout = highlight(false);-  }-};
src/data/MAlonzo/src/MAlonzo/RTE.hs view
@@ -32,9 +32,6 @@ erased :: a erased = coe (\ _ -> erased) -mazIncompleteMatch :: String -> a-mazIncompleteMatch s = error ("Agda: incomplete pattern matching: " ++ s)- mazUnreachableError :: a mazUnreachableError = error ("Agda: unreachable code reached.") 
− src/data/agda.sty
@@ -1,712 +0,0 @@-% -----------------------------------------------------------------------% Some useful commands when doing highlighting of Agda code in LaTeX.-% ------------------------------------------------------------------------\ProvidesPackage{agda}--\RequirePackage{ifxetex, ifluatex, xifthen, xcolor, polytable, etoolbox,-                calc, environ, xparse, xkeyval}--% https://tex.stackexchange.com/questions/47576/combining-ifxetex-and-ifluatex-with-the-logical-or-operation-\newif\ifxetexorluatex-\ifxetex-  \xetexorluatextrue-\else-  \ifluatex-    \xetexorluatextrue-  \else-    \xetexorluatexfalse-  \fi-\fi--% -----------------------------------------------------------------------% Options--\DeclareOption{bw}   {\newcommand{\AgdaColourScheme}{bw}}-\DeclareOption{conor}{\newcommand{\AgdaColourScheme}{conor}}--\newif\if@AgdaEnableReferences\@AgdaEnableReferencesfalse-\DeclareOption{references}{-  \@AgdaEnableReferencestrue-}--\newif\if@AgdaEnableLinks\@AgdaEnableLinksfalse-\DeclareOption{links}{-  \@AgdaEnableLinkstrue-}--\ProcessOptions\relax--% -----------------------------------------------------------------------% Font setup--\tracinglostchars=2 % If the font is missing some symbol, then say-                    % so in the compilation output.--% -----------------------------------------------------------------------% Colour schemes.--\providecommand{\AgdaColourScheme}{standard}--% -----------------------------------------------------------------------% References to code (needs additional post-processing of tex files to-% work, see wiki for details).--\if@AgdaEnableReferences-  \RequirePackage{catchfilebetweentags, xstring}-  \newcommand{\AgdaRef}[2][]{%-    \StrSubstitute{#2}{\_}{AgdaUnderscore}[\tmp]%-    \ifthenelse{\isempty{#1}}%-               {\ExecuteMetaData{AgdaTag-\tmp}}%-               {\ExecuteMetaData{#1}{AgdaTag-\tmp}}-  }-\fi--\providecommand{\AgdaRef}[2][]{#2}--% -----------------------------------------------------------------------% Links (only done if the option is passed and the user has loaded the-% hyperref package).--\if@AgdaEnableLinks-  \@ifpackageloaded{hyperref}{--    % List that holds added targets.-    \newcommand{\AgdaList}[0]{}--    \newtoggle{AgdaIsElem}-    \newcounter{AgdaIndex}-    \newcommand{\AgdaLookup}[3]{%-      \togglefalse{AgdaIsElem}%-      \setcounter{AgdaIndex}{0}%-      \renewcommand*{\do}[1]{%-      \ifstrequal{#1}{##1}%-        {\toggletrue{AgdaIsElem}\listbreak}%-        {\stepcounter{AgdaIndex}}}%-      \dolistloop{\AgdaList}%-      \iftoggle{AgdaIsElem}{#2}{#3}%-    }--    \newcommand*{\AgdaTargetHelper}[1]{%-      \AgdaLookup{#1}%-        {\PackageError{agda}{``#1'' used as target more than once}%-                            {Overloaded identifiers and links do not%-                             work well, consider using unique%-                             \MessageBreak identifiers instead.}%-        }%-        {\listadd{\AgdaList}{#1}%-         \hypertarget{Agda\theAgdaIndex}{}%-        }%-    }--    \newcommand{\AgdaTarget}[1]{\forcsvlist{\AgdaTargetHelper}{#1}}--    \newcommand{\AgdaLink}[1]{%-      \AgdaLookup{#1}%-        {\hyperlink{Agda\theAgdaIndex}{#1}}%-        {#1}%-    }-  }{\PackageError{agda}{Load the hyperref package before the agda package}{}}-\fi--\providecommand{\AgdaTarget}[1]{}-\providecommand{\AgdaLink}[1]{#1}--% -----------------------------------------------------------------------% Font styles.--\newcommand{\AgdaFontStyle}[1]{\textsf{#1}}-\ifthenelse{\equal{\AgdaColourScheme}{bw}}{-    \newcommand{\AgdaKeywordFontStyle}[1]{\underline{#1}}-}{-    \newcommand{\AgdaKeywordFontStyle}[1]{\textsf{#1}}-}-\newcommand{\AgdaStringFontStyle}[1]{\texttt{#1}}-\newcommand{\AgdaCommentFontStyle}[1]{\texttt{#1}}-\newcommand{\AgdaBoundFontStyle}[1]{\textit{#1}}--% -----------------------------------------------------------------------% Colours.--% -----------------------------------% The black and white colour scheme.-\ifthenelse{\equal{\AgdaColourScheme}{bw}}{--    % Aspect colours.-    \definecolor{AgdaComment}      {HTML}{000000}-    \definecolor{AgdaPragma}       {HTML}{000000}-    \definecolor{AgdaKeyword}      {HTML}{000000}-    \definecolor{AgdaString}       {HTML}{000000}-    \definecolor{AgdaNumber}       {HTML}{000000}-    \definecolor{AgdaSymbol}       {HTML}{000000}-    \definecolor{AgdaPrimitiveType}{HTML}{000000}--    % NameKind colours.-    \definecolor{AgdaBound}                 {HTML}{000000}-    \definecolor{AgdaGeneralizable}         {HTML}{000000}-    \definecolor{AgdaInductiveConstructor}  {HTML}{000000}-    \definecolor{AgdaCoinductiveConstructor}{HTML}{000000}-    \definecolor{AgdaDatatype}              {HTML}{000000}-    \definecolor{AgdaField}                 {HTML}{000000}-    \definecolor{AgdaFunction}              {HTML}{000000}-    \definecolor{AgdaMacro}                 {HTML}{000000}-    \definecolor{AgdaModule}                {HTML}{000000}-    \definecolor{AgdaPostulate}             {HTML}{000000}-    \definecolor{AgdaPrimitive}             {HTML}{000000}-    \definecolor{AgdaRecord}                {HTML}{000000}-    \definecolor{AgdaArgument}              {HTML}{000000}--    % Other aspect colours.-    \definecolor{AgdaDottedPattern}     {HTML}{000000}-    \definecolor{AgdaUnsolvedMeta}      {HTML}{D3D3D3}-    \definecolor{AgdaUnsolvedConstraint}{HTML}{D3D3D3}-    \definecolor{AgdaTerminationProblem}{HTML}{BEBEBE}-    \definecolor{AgdaIncompletePattern} {HTML}{D3D3D3}-    \definecolor{AgdaErrorWarning}      {HTML}{BEBEBE}-    \definecolor{AgdaError}             {HTML}{696969}--    % Misc.-    \definecolor{AgdaHole}              {HTML}{BEBEBE}--% -----------------------------------% Conor McBride's colour scheme.-}{ \ifthenelse{\equal{\AgdaColourScheme}{conor}}{--    % Aspect colours.-    \definecolor{AgdaComment}      {HTML}{B22222}-    \definecolor{AgdaPragma}       {HTML}{000000}-    \definecolor{AgdaKeyword}      {HTML}{000000}-    \definecolor{AgdaString}       {HTML}{000000}-    \definecolor{AgdaNumber}       {HTML}{000000}-    \definecolor{AgdaSymbol}       {HTML}{000000}-    \definecolor{AgdaPrimitiveType}{HTML}{0000CD}--    % NameKind colours.-    \definecolor{AgdaBound}                 {HTML}{A020F0}-    \definecolor{AgdaGeneralizable}         {HTML}{A020F0}-    \definecolor{AgdaInductiveConstructor}  {HTML}{8B0000}-    \definecolor{AgdaCoinductiveConstructor}{HTML}{8B0000}-    \definecolor{AgdaDatatype}              {HTML}{0000CD}-    \definecolor{AgdaField}                 {HTML}{8B0000}-    \definecolor{AgdaFunction}              {HTML}{006400}-    \definecolor{AgdaMacro}                 {HTML}{006400}-    \definecolor{AgdaModule}                {HTML}{006400}-    \definecolor{AgdaPostulate}             {HTML}{006400}-    \definecolor{AgdaPrimitive}             {HTML}{006400}-    \definecolor{AgdaRecord}                {HTML}{0000CD}-    \definecolor{AgdaArgument}              {HTML}{404040}--    % Other aspect colours.-    \definecolor{AgdaDottedPattern}     {HTML}{000000}-    \definecolor{AgdaUnsolvedMeta}      {HTML}{FFD700}-    \definecolor{AgdaUnsolvedConstraint}{HTML}{FFD700}-    \definecolor{AgdaTerminationProblem}{HTML}{FF0000}-    \definecolor{AgdaIncompletePattern} {HTML}{A020F0}-    \definecolor{AgdaErrorWarning}      {HTML}{FF0000}-    \definecolor{AgdaError}             {HTML}{F4A460}--    % Misc.-    \definecolor{AgdaHole}              {HTML}{9DFF9D}--% -----------------------------------% The standard colour scheme.-}{-    % Aspect colours.-    \definecolor{AgdaComment}      {HTML}{B22222}-    \definecolor{AgdaPragma}       {HTML}{000000}-    \definecolor{AgdaKeyword}      {HTML}{CD6600}-    \definecolor{AgdaString}       {HTML}{B22222}-    \definecolor{AgdaNumber}       {HTML}{A020F0}-    \definecolor{AgdaSymbol}       {HTML}{404040}-    \definecolor{AgdaPrimitiveType}{HTML}{0000CD}--    % NameKind colours.-    \definecolor{AgdaBound}                 {HTML}{000000}-    \definecolor{AgdaGeneralizable}         {HTML}{000000}-    \definecolor{AgdaInductiveConstructor}  {HTML}{008B00}-    \definecolor{AgdaCoinductiveConstructor}{HTML}{8B7500}-    \definecolor{AgdaDatatype}              {HTML}{0000CD}-    \definecolor{AgdaField}                 {HTML}{EE1289}-    \definecolor{AgdaFunction}              {HTML}{0000CD}-    \definecolor{AgdaMacro}                 {HTML}{458B74}-    \definecolor{AgdaModule}                {HTML}{A020F0}-    \definecolor{AgdaPostulate}             {HTML}{0000CD}-    \definecolor{AgdaPrimitive}             {HTML}{0000CD}-    \definecolor{AgdaRecord}                {HTML}{0000CD}-    \definecolor{AgdaArgument}              {HTML}{404040}--    % Other aspect colours.-    \definecolor{AgdaDottedPattern}     {HTML}{000000}-    \definecolor{AgdaUnsolvedMeta}      {HTML}{FFFF00}-    \definecolor{AgdaUnsolvedConstraint}{HTML}{FFFF00}-    \definecolor{AgdaTerminationProblem}{HTML}{FFA07A}-    \definecolor{AgdaIncompletePattern} {HTML}{F5DEB3}-    \definecolor{AgdaErrorWarning}      {HTML}{FFA07A}-    \definecolor{AgdaError}             {HTML}{FF0000}--    % Misc.-    \definecolor{AgdaHole}              {HTML}{9DFF9D}-}}--% -----------------------------------------------------------------------% Commands.--\newcommand{\AgdaNoSpaceMath}[1]-    {\begingroup\thickmuskip=0mu\medmuskip=0mu#1\endgroup}--% Aspect commands.-\newcommand{\AgdaComment}     [1]-    {\AgdaNoSpaceMath{\AgdaCommentFontStyle{\textcolor{AgdaComment}{#1}}}}-\newcommand{\AgdaPragma}      [1]-    {\AgdaNoSpaceMath{\AgdaCommentFontStyle{\textcolor{AgdaPragma}{#1}}}}-\newcommand{\AgdaKeyword}     [1]-    {\AgdaNoSpaceMath{\AgdaKeywordFontStyle{\textcolor{AgdaKeyword}{#1}}}}-\newcommand{\AgdaString}      [1]-    {\AgdaNoSpaceMath{\AgdaStringFontStyle{\textcolor{AgdaString}{#1}}}}-\newcommand{\AgdaNumber}      [1]-    {\AgdaNoSpaceMath{\AgdaFontStyle{\textcolor{AgdaNumber}{#1}}}}-\newcommand{\AgdaSymbol}      [1]-    {\AgdaNoSpaceMath{\AgdaFontStyle{\textcolor{AgdaSymbol}{#1}}}}-\newcommand{\AgdaPrimitiveType}[1]-    {\AgdaNoSpaceMath{\AgdaFontStyle{\textcolor{AgdaPrimitiveType}{#1}}}}-% Note that, in code generated by the LaTeX backend, \AgdaOperator is-% always applied to a NameKind command.-\newcommand{\AgdaOperator}    [1]{#1}--% NameKind commands.--% The user can control the typesetting of (certain) individual tokens-% by redefining the following command. The first argument is the token-% and the second argument the thing to be typeset (sometimes just the-% token, sometimes \AgdaLink{<the token>}). Example:-%-%   \usepackage{ifthen}-%-%   % Insert extra space before some tokens.-%   \DeclareRobustCommand{\AgdaFormat}[2]{%-%     \ifthenelse{-%       \equal{#1}{≡⟨} \OR-%       \equal{#1}{≡⟨⟩} \OR-%       \equal{#1}{∎}-%     }{\ }{}#2}-%-% Note the use of \DeclareRobustCommand.--\newcommand{\AgdaFormat}[2]{#2}--\newcommand{\AgdaBound}[1]-    {\AgdaNoSpaceMath{\AgdaBoundFontStyle{\textcolor{AgdaBound}{\AgdaFormat{#1}{#1}}}}}-\newcommand{\AgdaGeneralizable}[1]-    {\AgdaNoSpaceMath{\AgdaBoundFontStyle{\textcolor{AgdaGeneralizable}{\AgdaFormat{#1}{#1}}}}}-\newcommand{\AgdaInductiveConstructor}[1]-    {\AgdaNoSpaceMath{\AgdaFontStyle{\textcolor{AgdaInductiveConstructor}{\AgdaFormat{#1}{\AgdaLink{#1}}}}}}-\newcommand{\AgdaCoinductiveConstructor}[1]-    {\AgdaNoSpaceMath{\AgdaFontStyle{\textcolor{AgdaCoinductiveConstructor}{\AgdaFormat{#1}{\AgdaLink{#1}}}}}}-\newcommand{\AgdaDatatype}[1]-    {\AgdaNoSpaceMath{\AgdaFontStyle{\textcolor{AgdaDatatype}{\AgdaFormat{#1}{\AgdaLink{#1}}}}}}-\newcommand{\AgdaField}[1]-    {\AgdaNoSpaceMath{\AgdaFontStyle{\textcolor{AgdaField}{\AgdaFormat{#1}{\AgdaLink{#1}}}}}}-\newcommand{\AgdaFunction}[1]-    {\AgdaNoSpaceMath{\AgdaFontStyle{\textcolor{AgdaFunction}{\AgdaFormat{#1}{\AgdaLink{#1}}}}}}-\newcommand{\AgdaMacro}[1]-    {\AgdaNoSpaceMath{\AgdaFontStyle{\textcolor{AgdaMacro}{\AgdaFormat{#1}{\AgdaLink{#1}}}}}}-\newcommand{\AgdaModule}[1]-    {\AgdaNoSpaceMath{\AgdaFontStyle{\textcolor{AgdaModule}{\AgdaFormat{#1}{\AgdaLink{#1}}}}}}-\newcommand{\AgdaPostulate}[1]-    {\AgdaNoSpaceMath{\AgdaFontStyle{\textcolor{AgdaPostulate}{\AgdaFormat{#1}{\AgdaLink{#1}}}}}}-\newcommand{\AgdaPrimitive}[1]-    {\AgdaNoSpaceMath{\AgdaFontStyle{\textcolor{AgdaPrimitive}{\AgdaFormat{#1}{#1}}}}}-\newcommand{\AgdaRecord}[1]-    {\AgdaNoSpaceMath{\AgdaFontStyle{\textcolor{AgdaRecord}{\AgdaFormat{#1}{\AgdaLink{#1}}}}}}-\newcommand{\AgdaArgument}[1]-    {\AgdaNoSpaceMath{\AgdaBoundFontStyle{\textcolor{AgdaArgument}{\AgdaFormat{#1}{#1}}}}}--% Other aspect commands.-\newcommand{\AgdaFixityOp}          [1]{\AgdaNoSpaceMath{$#1$}}-\newcommand{\AgdaDottedPattern}     [1]{\textcolor{AgdaDottedPattern}{#1}}-\newcommand{\AgdaUnsolvedMeta}      [1]-    {\AgdaFontStyle{\colorbox{AgdaUnsolvedMeta}{#1}}}-\newcommand{\AgdaUnsolvedConstraint}[1]-    {\AgdaFontStyle{\colorbox{AgdaUnsolvedConstraint}{#1}}}-\newcommand{\AgdaTerminationProblem}[1]-    {\AgdaFontStyle{\colorbox{AgdaTerminationProblem}{#1}}}-\newcommand{\AgdaIncompletePattern} [1]{\colorbox{AgdaIncompletePattern}{#1}}-\newcommand{\AgdaErrorWarning}      [1]{\colorbox{AgdaErrorWarning}{#1}}-\newcommand{\AgdaError}             [1]-    {\AgdaFontStyle{\textcolor{AgdaError}{\underline{#1}}}}-\newcommand{\AgdaCatchallClause}    [1]{#1} % feel free to change this--% Used to hide code from LaTeX.-%-% Note that this macro has been deprecated in favour of giving the-% hide argument to the code environment.-\long\def\AgdaHide#1{\ignorespaces}--% Misc.-\newcommand{\AgdaHole}[1]{\colorbox{AgdaHole}{#1}}--% -----------------------------------------------------------------------% The code environment.--\newcommand{\AgdaCodeStyle}{}-% \newcommand{\AgdaCodeStyle}{\tiny}--\ifdefined\mathindent-  {}-\else-  \newdimen\mathindent\mathindent\leftmargini-\fi--% Adds the given amount of vertical space and starts a new line.-%-% The implementation comes from lhs2TeX's polycode.fmt, written by-% Andres Löh.-\newcommand{\Agda@NewlineWithVerticalSpace}[1]{%-  {\parskip=0pt\parindent=0pt\par\vskip #1\noindent}}--% Should there be space around code?-\newboolean{Agda@SpaceAroundCode}--% Use this command to avoid extra space around code blocks.-\newcommand{\AgdaNoSpaceAroundCode}{%-  \setboolean{Agda@SpaceAroundCode}{false}}--% Use this command to include extra space around code blocks.-\newcommand{\AgdaSpaceAroundCode}{%-  \setboolean{Agda@SpaceAroundCode}{true}}--% By default space is inserted around code blocks.-\AgdaSpaceAroundCode{}--% Sometimes one might want to break up a code block into multiple-% pieces, but keep code in different blocks aligned with respect to-% each other. Then one can use the AgdaAlign environment. Example-% usage:-%-%   \begin{AgdaAlign}-%   \begin{code}-%     code-%       code  (more code)-%   \end{code}-%   Explanation...-%   \begin{code}-%     aligned with "code"-%       code  (aligned with (more code))-%   \end{code}-%   \end{AgdaAlign}-%-% Note that AgdaAlign environments should not be nested.-%-% Sometimes one might also want to hide code in the middle of a code-% block. This can be accomplished in the following way:-%-%   \begin{AgdaAlign}-%   \begin{code}-%     visible-%   \end{code}-%   \begin{code}[hide]-%     hidden-%   \end{code}-%   \begin{code}-%     visible-%   \end{code}-%   \end{AgdaAlign}-%-% However, the result may be ugly: extra space is perhaps inserted-% around the code blocks.-%-% The AgdaSuppressSpace environment ensures that extra space is only-% inserted before the first code block, and after the last one (but-% not if \AgdaNoSpaceAroundCode{} is used). Example usage:-%-%   \begin{AgdaAlign}-%   \begin{code}-%     code-%       more code-%   \end{code}-%   Explanation...-%   \begin{AgdaSuppressSpace}-%   \begin{code}-%     aligned with "code"-%       aligned with "more code"-%   \end{code}-%   \begin{code}[hide]-%     hidden code-%   \end{code}-%   \begin{code}-%       also aligned with "more code"-%   \end{code}-%   \end{AgdaSuppressSpace}-%   \end{AgdaAlign}-%-% Note that AgdaSuppressSpace environments should not be nested.-%-% There is also a combined environment, AgdaMultiCode, that combines-% the effects of AgdaAlign and AgdaSuppressSpace.--% The number of the current/next code block (excluding hidden ones).-\newcounter{Agda@Current}-\setcounter{Agda@Current}{0}--% The number of the previous code block (excluding hidden ones), used-% locally in \Agda@SuppressEnd.-\newcounter{Agda@Previous}--% Is AgdaAlign active?-\newboolean{Agda@Align}-\setboolean{Agda@Align}{false}--% The number of the first code block (if any) in a given AgdaAlign-% environment.-\newcounter{Agda@AlignStart}--\newcommand{\Agda@AlignStart}{%-  \ifthenelse{\boolean{Agda@Align}}{%-    \PackageError{agda}{Nested AgdaAlign environments}{%-      AgdaAlign and AgdaMultiCode environments must not be-      nested.}}{%-    \setboolean{Agda@Align}{true}%-    \setcounter{Agda@AlignStart}{\value{Agda@Current}}}}--\newcommand{\Agda@AlignEnd}{\setboolean{Agda@Align}{false}}--\newenvironment{AgdaAlign}{%-  \Agda@AlignStart{}}{%-  \Agda@AlignEnd{}%-  \ignorespacesafterend}--% Is AgdaSuppressSpace active?-\newboolean{Agda@Suppress}-\setboolean{Agda@Suppress}{false}--% The number of the first code block (if any) in a given-% AgdaSuppressSpace environment.-\newcounter{Agda@SuppressStart}--% Does a "do not suppress space after" label exist for the current-% code block? (This boolean is used locally in the code environment's-% implementation.)-\newboolean{Agda@DoNotSuppressSpaceAfter}--\newcommand{\Agda@SuppressStart}{%-  \ifthenelse{\boolean{Agda@Suppress}}{%-    \PackageError{agda}{Nested AgdaSuppressSpace environments}{%-      AgdaSuppressSpace and AgdaMultiCode environments must not be-      nested.}}{%-    \setboolean{Agda@Suppress}{true}%-    \setcounter{Agda@SuppressStart}{\value{Agda@Current}}}}--% Marks the given code block as one that space should not be-% suppressed after (if AgdaSpaceAroundCode and AgdaSuppressSpace are-% both active).-\newcommand{\Agda@DoNotSuppressSpaceAfter}[1]{%-  % The use of labels is intended to ensure that LaTeX will provide a-  % warning if the document needs to be recompiled.-  \label{Agda@DoNotSuppressSpaceAfter@#1}}--\newcommand{\Agda@SuppressEnd}{%-  \ifthenelse{\value{Agda@SuppressStart} = \value{Agda@Current}}{}{%-    % Mark the previous code block in the .aux file.-    \setcounter{Agda@Previous}{\theAgda@Current-1}%-    \immediate\write\@auxout{%-      \noexpand\Agda@DoNotSuppressSpaceAfter{\theAgda@Previous}}}%-  \setboolean{Agda@Suppress}{false}}--\newenvironment{AgdaSuppressSpace}{%-  \Agda@SuppressStart{}}{%-  \Agda@SuppressEnd{}%-  \ignorespacesafterend}--\newenvironment{AgdaMultiCode}{%-  \Agda@AlignStart{}%-  \Agda@SuppressStart{}}{%-  \Agda@SuppressEnd{}%-  \Agda@AlignEnd{}%-  \ignorespacesafterend}--% Vertical space used for empty lines. By default \abovedisplayskip.-\newlength{\AgdaEmptySkip}-\setlength{\AgdaEmptySkip}{\abovedisplayskip}--% Extra space to be inserted for empty lines (the difference between-% \AgdaEmptySkip and \baselineskip). Used internally.-\newlength{\AgdaEmptyExtraSkip}--% Counter used for code numbers.-\newcounter{AgdaCodeNumber}-% Formats a code number.-\newcommand{\AgdaFormatCodeNumber}[1]{(#1)}--% A boolean used to handle the option number.-\newboolean{Agda@Number}-\setboolean{Agda@Number}{false}--% A boolean used to handle the option inline*. (For some reason the-% approach used for hide and inline does not work for inline*.)-\newboolean{Agda@InlineStar}-\setboolean{Agda@InlineStar}{false}--% Keys used by the code environment.-\define@boolkey[Agda]{code}{hide}[true]{}-\define@boolkey[Agda]{code}{inline}[true]{}-\define@boolkey[Agda]{code}{inline*}[true]{%-  \setboolean{Agda@InlineStar}{true}}-\define@key[Agda]{code}{number}[]{%-  \ifthenelse{\boolean{Agda@Number}}{}{%-    \setboolean{Agda@Number}{true}%-    % Increase the counter if this has not already been done.-    \refstepcounter{AgdaCodeNumber}}%-  % If the label is non-empty, set it. Note that it is possible to-  % give several labels for a single code listing.-  \ifthenelse{\equal{#1}{}}{}{\label{#1}}}--% The code environment.-%-% Options:-%-% * hide: The code is hidden. Other options are ignored.-%-% * number: Give the code an equation number.-%-% * number=l: Give the code an equation number and the label l. It is-%   possible to use this option several times with different labels.-%-% * inline/inline*: The code is inlined. In this case most of the-%   discussion above does not apply, alignment is not respected, and so-%   on. It is recommended to only use this option for a single line of-%   code, and to not use two consecutive spaces in this piece of code.-%-%   Note that this environment ignores spaces after its end. If a space-%   (\AgdaSpace{}) should be inserted after the inline code, use-%   inline*, otherwise use inline.-%-%   When this option is used number is ignored.-%-% The implementation is based on plainhscode in lhs2TeX's-% polycode.fmt, written by Andres Löh.-\NewEnviron{code}[1][]{%-  % Process the options. Complain about unknown options.-  \setkeys[Agda]{code}[number]{#1}%-  \ifAgda@code@hide%-    % Hide the code.-  \else%-  \ifAgda@code@inline%-    % Inline code.-    %-    % Make the polytable primitives emitted by the LaTeX backend-    % do nothing.-    \DeclareDocumentCommand{\>}{O{}O{}}{}%-    \DeclareDocumentCommand{\<}{O{}}{}%-    \AgdaCodeStyle\BODY%-  \else%-  \ifthenelse{\boolean{Agda@InlineStar}}{%-    % Inline code with space at the end.-    %-    \DeclareDocumentCommand{\>}{O{}O{}}{}%-    \DeclareDocumentCommand{\<}{O{}}{}%-    \AgdaCodeStyle\BODY\AgdaSpace{}}{%-    %-    % Displayed code.-    %-    % Conditionally emit space before the code block. Unconditionally-    % switch to a new line.-    \ifthenelse{\boolean{Agda@SpaceAroundCode} \and%-                \(\not \boolean{Agda@Suppress} \or%-                  \value{Agda@SuppressStart} = \value{Agda@Current}\)}{%-      \Agda@NewlineWithVerticalSpace{\abovedisplayskip}}{%-      \Agda@NewlineWithVerticalSpace{0pt}}%-    %-    % Check if numbers have been requested. If they have, then a side-    % effect of this call is that Agda@Number is set to true, the code-    % number counter is increased, and the label (if any) is set.-    \setkeys[Agda]{code}[hide,inline,inline*]{#1}%-    \ifthenelse{\boolean{Agda@Number}}{%-      % Equation numbers have been requested. Use a minipage, so that-      % there is room for the code number to the right, and the code-      % number becomes centered vertically.-      \begin{minipage}{%-          \linewidth-%-          \widthof{%-            \AgdaSpace{}%-            \AgdaFormatCodeNumber{\theAgdaCodeNumber}}}}{}%-    %-    % Indent the entire code block.-    \advance\leftskip\mathindent%-    %-    % The code's style can be customised.-    \AgdaCodeStyle%-    %-    % Used to control the height of empty lines.-    \setlength{\AgdaEmptyExtraSkip}{\AgdaEmptySkip - \baselineskip}%-    %-    % The environment used to handle indentation (of individual lines)-    % and alignment.-    \begin{pboxed}%-      %-      % Conditionally preserve alignment between code blocks.-      \ifthenelse{\boolean{Agda@Align}}{%-        \ifthenelse{\value{Agda@AlignStart} = \value{Agda@Current}}{%-          \savecolumns}{%-          \restorecolumns}}{}%-      %-      % The code.-      \BODY%-    \end{pboxed}%-    %-    \ifthenelse{\boolean{Agda@Number}}{%-      % Equation numbers have been requested.-      \end{minipage}%-      % Insert the code number to the right.-      \hfill \AgdaFormatCodeNumber{\theAgdaCodeNumber}}{}%-    %-    % Does the label Agda@DoNotSuppressAfter@<current code block-    % number> exist?-    \ifcsdef{r@Agda@DoNotSuppressSpaceAfter@\theAgda@Current}{%-      \setboolean{Agda@DoNotSuppressSpaceAfter}{true}}{%-      \setboolean{Agda@DoNotSuppressSpaceAfter}{false}}%-    %-    % Conditionally emit space after the code block. Unconditionally-    % switch to a new line.-    \ifthenelse{\boolean{Agda@SpaceAroundCode} \and%-                \(\not \boolean{Agda@Suppress} \or%-                  \boolean{Agda@DoNotSuppressSpaceAfter}\)}{%-      \Agda@NewlineWithVerticalSpace{\belowdisplayskip}}{%-      \Agda@NewlineWithVerticalSpace{0pt}}%-    %-    % Step the code block counter, but only for non-hidden code.-    \stepcounter{Agda@Current}}%-  \fi%-  \fi%-  % Reset Agda@Number and Agda@InlineStar.-  \setboolean{Agda@Number}{false}%-  \setboolean{Agda@InlineStar}{false}}--% Space inserted after tokens.-\newcommand{\AgdaSpace}{ }--% Space inserted to indent something.-\newcommand{\AgdaIndentSpace}{\AgdaSpace{}$\;\;$}--% Default column for polytable.-\defaultcolumn{@{}l@{\AgdaSpace{}}}--% \AgdaIndent expects a non-negative integer as its only argument.-% This integer should be the distance, in code blocks, to the thing-% relative to which the text is indented.-%-% The default implementation only indents if the thing that the text-% is indented relative to exists in the same code block or is wrapped-% in the same AgdaAlign or AgdaMultiCode environment.-\newcommand{\AgdaIndent}[1]{%-  \ifthenelse{#1 = 0-                \or-              \( \boolean{Agda@Align}-                   \and-                 \cnttest{\value{Agda@Current} - #1}{>=}{-                          \value{Agda@AlignStart}}-              \)}{\AgdaIndentSpace{}}{}}--% Underscores are typeset using \AgdaUnderscore{}.-\newcommand{\AgdaUnderscore}{\_}--\endinput
src/data/emacs-mode/agda-input.el view
@@ -309,6 +309,8 @@   ("increment" . ("∆"))   ("inf"       . ("∞"))   ("&"         . ("⅋"))+  ("z;"        . ("⨟"))+  ("z:"        . ("⦂"))    ;; Circled operators. @@ -966,6 +968,12 @@   ;; ("_y" . ("y"))   ;; ("_z" . ("z")) +  ("_Gb" . ("ᵦ"))+  ("_Gg" . ("ᵧ"))+  ("_Gr" . ("ᵨ"))+  ("_Gf" . ("ᵩ"))+  ("_Gc" . ("ᵪ"))+   ("^a" . ("ᵃ"))   ("^b" . ("ᵇ"))   ("^c" . ("ᶜ"))@@ -1019,6 +1027,14 @@   ;; ("^X" . ("X"))   ;; ("^Y" . ("Y"))   ;; ("^Z" . ("Z"))++  ("^Gb" . ("ᵝ"))+  ("^Gg" . ("ᵞ"))+  ("^Gd" . ("ᵟ"))+  ("^Ge" . ("ᵋ"))+  ("^Gth" . ("ᶿ"))+  ("^Gf" . ("ᵠ"))+  ("^Gc" . ("ᵡ"))    ;; Some ISO8859-1 characters. 
src/data/emacs-mode/agda2-mode-pkg.el view
@@ -1,3 +1,3 @@-(define-package "agda2-mode" "2.6.2"+(define-package "agda2-mode" "2.6.2.1"   "interactive development for Agda, a dependently typed functional programming language"   '((emacs "24.3") (annotation "1.0") (eri "1.0")))
src/data/emacs-mode/agda2-mode.el view
@@ -28,7 +28,7 @@  ;;; Code: -(defvar agda2-version "2.6.2"+(defvar agda2-version "2.6.2.1"   "The version of the Agda mode. Note that the same version of the Agda executable must be used.") @@ -606,10 +606,10 @@                       "Cmd_abort"))  (defun agda2-abort-done ()-  "Removes annotations, resets certain variables.+  "Resets certain variables. Intended to be used by the backend if an abort command was successful."-  (agda2-remove-annotations)+  (agda2-info-action "*Aborted*" "Aborted." t)   (setq agda2-highlight-in-progress nil         agda2-last-responses        nil)) 
+ src/data/html/Agda.css view
@@ -0,0 +1,41 @@+/* Aspects. */+.Agda .Comment       { color: #B22222 }+.Agda .Background    {}+.Agda .Markup        { color: #000000 }+.Agda .Keyword       { color: #CD6600 }+.Agda .String        { color: #B22222 }+.Agda .Number        { color: #A020F0 }+.Agda .Symbol        { color: #404040 }+.Agda .PrimitiveType { color: #0000CD }+.Agda .Pragma        { color: black   }+.Agda .Operator      {}+.Agda .Hole          { background: #B4EEB4 }++/* NameKinds. */+.Agda .Bound                  { color: black   }+.Agda .Generalizable          { color: black   }+.Agda .InductiveConstructor   { color: #008B00 }+.Agda .CoinductiveConstructor { color: #8B7500 }+.Agda .Datatype               { color: #0000CD }+.Agda .Field                  { color: #EE1289 }+.Agda .Function               { color: #0000CD }+.Agda .Module                 { color: #A020F0 }+.Agda .Postulate              { color: #0000CD }+.Agda .Primitive              { color: #0000CD }+.Agda .Record                 { color: #0000CD }++/* OtherAspects. */+.Agda .DottedPattern        {}+.Agda .UnsolvedMeta         { color: black; background: yellow         }+.Agda .UnsolvedConstraint   { color: black; background: yellow         }+.Agda .TerminationProblem   { color: black; background: #FFA07A        }+.Agda .IncompletePattern    { color: black; background: #F5DEB3        }+.Agda .Error                { color: red;   text-decoration: underline }+.Agda .TypeChecks           { color: black; background: #ADD8E6        }+.Agda .Deadcode             { color: black; background: #808080        }+.Agda .ShadowingInTelescope { color: black; background: #808080        }++/* Standard attributes. */+.Agda a { text-decoration: none }+.Agda a[href]:hover { background-color: #B4EEB4 }+.Agda [href].hover-highlight { background-color: #B4EEB4; }
+ src/data/html/highlight-hover.js view
@@ -0,0 +1,32 @@+// Copyright 2002-2010, Simon Marlow.  All rights reserved.+// https://github.com/haskell/haddock/blob/ghc-8.8/LICENSE+// Slightly modified by Tesla Ice Zhang++var highlight = function (on) {+  return function () {+    var links = document.getElementsByTagName('a');+    for (var i = 0; i < links.length; i++) {+      var that = links[i];++      if (this.href != that.href) {+        continue;+      }++      if (on) {+        that.classList.add("hover-highlight");+      } else {+        that.classList.remove("hover-highlight");+      }+    }+  }+};++window.onload = function () {+  var links = document.getElementsByTagName('a');+  for (var i = 0; i < links.length; i++) {+    var link = links[i];+    if (!link.hasAttribute("href")) continue;+    link.onmouseover = highlight(true);+    link.onmouseout = highlight(false);+  }+};
+ src/data/latex/agda.sty view
@@ -0,0 +1,722 @@+% ----------------------------------------------------------------------+% Some useful commands when doing highlighting of Agda code in LaTeX.+% ----------------------------------------------------------------------++% !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!+% !!! NOTE: when you make changes to this file, bump the date. !!!+% !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!+\ProvidesPackage{agda}+  [2021/07/14 version 2.6.2.1 Formatting LaTeX generated by Agda]++\RequirePackage{ifxetex, ifluatex, xifthen, xcolor, polytable, etoolbox,+                calc, environ, xparse, xkeyval}++% https://tex.stackexchange.com/questions/47576/combining-ifxetex-and-ifluatex-with-the-logical-or-operation+\newif\ifxetexorluatex+\ifxetex+  \xetexorluatextrue+\else+  \ifluatex+    \xetexorluatextrue+  \else+    \xetexorluatexfalse+  \fi+\fi++% ----------------------------------------------------------------------+% Options++\DeclareOption{bw}   {\newcommand{\AgdaColourScheme}{bw}}+\DeclareOption{conor}{\newcommand{\AgdaColourScheme}{conor}}++\newif\if@AgdaEnableReferences\@AgdaEnableReferencesfalse+\DeclareOption{references}{+  \@AgdaEnableReferencestrue+}++\newif\if@AgdaEnableLinks\@AgdaEnableLinksfalse+\DeclareOption{links}{+  \@AgdaEnableLinkstrue+}++\ProcessOptions\relax++% ----------------------------------------------------------------------+% Font setup++\tracinglostchars=2 % If the font is missing some symbol, then say+                    % so in the compilation output.++% ----------------------------------------------------------------------+% Colour schemes.++\providecommand{\AgdaColourScheme}{standard}++% ----------------------------------------------------------------------+% References to code (needs additional post-processing of tex files to+% work, see wiki for details).++\if@AgdaEnableReferences+  \RequirePackage{catchfilebetweentags, xstring}+  \newcommand{\AgdaRef}[2][]{%+    \StrSubstitute{#2}{\_}{AgdaUnderscore}[\tmp]%+    \ifthenelse{\isempty{#1}}%+               {\ExecuteMetaData{AgdaTag-\tmp}}%+               {\ExecuteMetaData{#1}{AgdaTag-\tmp}}+  }+\fi++\providecommand{\AgdaRef}[2][]{#2}++% ----------------------------------------------------------------------+% Links (only done if the option is passed and the user has loaded the+% hyperref package).++\if@AgdaEnableLinks+  \@ifpackageloaded{hyperref}{++    % List that holds added targets.+    \newcommand{\AgdaList}[0]{}++    \newtoggle{AgdaIsElem}+    \newcounter{AgdaIndex}+    \newcommand{\AgdaLookup}[3]{%+      \togglefalse{AgdaIsElem}%+      \setcounter{AgdaIndex}{0}%+      \renewcommand*{\do}[1]{%+      \ifstrequal{#1}{##1}%+        {\toggletrue{AgdaIsElem}\listbreak}%+        {\stepcounter{AgdaIndex}}}%+      \dolistloop{\AgdaList}%+      \iftoggle{AgdaIsElem}{#2}{#3}%+    }++    \newcommand*{\AgdaTargetHelper}[1]{%+      \AgdaLookup{#1}%+        {\PackageError{agda}{``#1'' used as target more than once}%+                            {Overloaded identifiers and links do not%+                             work well, consider using unique%+                             \MessageBreak identifiers instead.}%+        }%+        {\listadd{\AgdaList}{#1}%+         \hypertarget{Agda\theAgdaIndex}{}%+        }%+    }++    \newcommand{\AgdaTarget}[1]{\forcsvlist{\AgdaTargetHelper}{#1}}++    \newcommand{\AgdaLink}[1]{%+      \AgdaLookup{#1}%+        {\hyperlink{Agda\theAgdaIndex}{#1}}%+        {#1}%+    }+  }{\PackageError{agda}{Load the hyperref package before the agda package}{}}+\fi++\providecommand{\AgdaTarget}[1]{}+\providecommand{\AgdaLink}[1]{#1}++% ----------------------------------------------------------------------+% Font styles.++\newcommand{\AgdaFontStyle}[1]{\textsf{#1}}+\ifthenelse{\equal{\AgdaColourScheme}{bw}}{+    \newcommand{\AgdaKeywordFontStyle}[1]{\underline{#1}}+}{+    \newcommand{\AgdaKeywordFontStyle}[1]{\textsf{#1}}+}+\newcommand{\AgdaStringFontStyle}[1]{\texttt{#1}}+\newcommand{\AgdaCommentFontStyle}[1]{\texttt{#1}}+\newcommand{\AgdaBoundFontStyle}[1]{\textit{#1}}++% ----------------------------------------------------------------------+% Colours.++% ----------------------------------+% The black and white colour scheme.+\ifthenelse{\equal{\AgdaColourScheme}{bw}}{++    % Aspect colours.+    \definecolor{AgdaComment}      {HTML}{000000}+    \definecolor{AgdaPragma}       {HTML}{000000}+    \definecolor{AgdaKeyword}      {HTML}{000000}+    \definecolor{AgdaString}       {HTML}{000000}+    \definecolor{AgdaNumber}       {HTML}{000000}+    \definecolor{AgdaSymbol}       {HTML}{000000}+    \definecolor{AgdaPrimitiveType}{HTML}{000000}++    % NameKind colours.+    \definecolor{AgdaBound}                 {HTML}{000000}+    \definecolor{AgdaGeneralizable}         {HTML}{000000}+    \definecolor{AgdaInductiveConstructor}  {HTML}{000000}+    \definecolor{AgdaCoinductiveConstructor}{HTML}{000000}+    \definecolor{AgdaDatatype}              {HTML}{000000}+    \definecolor{AgdaField}                 {HTML}{000000}+    \definecolor{AgdaFunction}              {HTML}{000000}+    \definecolor{AgdaMacro}                 {HTML}{000000}+    \definecolor{AgdaModule}                {HTML}{000000}+    \definecolor{AgdaPostulate}             {HTML}{000000}+    \definecolor{AgdaPrimitive}             {HTML}{000000}+    \definecolor{AgdaRecord}                {HTML}{000000}+    \definecolor{AgdaArgument}              {HTML}{000000}++    % Other aspect colours.+    \definecolor{AgdaDottedPattern}     {HTML}{000000}+    \definecolor{AgdaUnsolvedMeta}      {HTML}{D3D3D3}+    \definecolor{AgdaUnsolvedConstraint}{HTML}{D3D3D3}+    \definecolor{AgdaTerminationProblem}{HTML}{BEBEBE}+    \definecolor{AgdaIncompletePattern} {HTML}{D3D3D3}+    \definecolor{AgdaErrorWarning}      {HTML}{BEBEBE}+    \definecolor{AgdaError}             {HTML}{696969}++    % Misc.+    \definecolor{AgdaHole}              {HTML}{BEBEBE}++% ----------------------------------+% Conor McBride's colour scheme.+}{ \ifthenelse{\equal{\AgdaColourScheme}{conor}}{++    % Aspect colours.+    \definecolor{AgdaComment}      {HTML}{B22222}+    \definecolor{AgdaPragma}       {HTML}{000000}+    \definecolor{AgdaKeyword}      {HTML}{000000}+    \definecolor{AgdaString}       {HTML}{000000}+    \definecolor{AgdaNumber}       {HTML}{000000}+    \definecolor{AgdaSymbol}       {HTML}{000000}+    \definecolor{AgdaPrimitiveType}{HTML}{0000CD}++    % NameKind colours.+    \definecolor{AgdaBound}                 {HTML}{A020F0}+    \definecolor{AgdaGeneralizable}         {HTML}{A020F0}+    \definecolor{AgdaInductiveConstructor}  {HTML}{8B0000}+    \definecolor{AgdaCoinductiveConstructor}{HTML}{8B0000}+    \definecolor{AgdaDatatype}              {HTML}{0000CD}+    \definecolor{AgdaField}                 {HTML}{8B0000}+    \definecolor{AgdaFunction}              {HTML}{006400}+    \definecolor{AgdaMacro}                 {HTML}{006400}+    \definecolor{AgdaModule}                {HTML}{006400}+    \definecolor{AgdaPostulate}             {HTML}{006400}+    \definecolor{AgdaPrimitive}             {HTML}{006400}+    \definecolor{AgdaRecord}                {HTML}{0000CD}+    \definecolor{AgdaArgument}              {HTML}{404040}++    % Other aspect colours.+    \definecolor{AgdaDottedPattern}     {HTML}{000000}+    \definecolor{AgdaUnsolvedMeta}      {HTML}{FFD700}+    \definecolor{AgdaUnsolvedConstraint}{HTML}{FFD700}+    \definecolor{AgdaTerminationProblem}{HTML}{FF0000}+    \definecolor{AgdaIncompletePattern} {HTML}{A020F0}+    \definecolor{AgdaErrorWarning}      {HTML}{FF0000}+    \definecolor{AgdaError}             {HTML}{F4A460}++    % Misc.+    \definecolor{AgdaHole}              {HTML}{9DFF9D}++% ----------------------------------+% The standard colour scheme.+}{+    % Aspect colours.+    \definecolor{AgdaComment}      {HTML}{B22222}+    \definecolor{AgdaPragma}       {HTML}{000000}+    \definecolor{AgdaKeyword}      {HTML}{CD6600}+    \definecolor{AgdaString}       {HTML}{B22222}+    \definecolor{AgdaNumber}       {HTML}{A020F0}+    \definecolor{AgdaSymbol}       {HTML}{404040}+    \definecolor{AgdaPrimitiveType}{HTML}{0000CD}++    % NameKind colours.+    \definecolor{AgdaBound}                 {HTML}{000000}+    \definecolor{AgdaGeneralizable}         {HTML}{000000}+    \definecolor{AgdaInductiveConstructor}  {HTML}{008B00}+    \definecolor{AgdaCoinductiveConstructor}{HTML}{8B7500}+    \definecolor{AgdaDatatype}              {HTML}{0000CD}+    \definecolor{AgdaField}                 {HTML}{EE1289}+    \definecolor{AgdaFunction}              {HTML}{0000CD}+    \definecolor{AgdaMacro}                 {HTML}{458B74}+    \definecolor{AgdaModule}                {HTML}{A020F0}+    \definecolor{AgdaPostulate}             {HTML}{0000CD}+    \definecolor{AgdaPrimitive}             {HTML}{0000CD}+    \definecolor{AgdaRecord}                {HTML}{0000CD}+    \definecolor{AgdaArgument}              {HTML}{404040}++    % Other aspect colours.+    \definecolor{AgdaDottedPattern}     {HTML}{000000}+    \definecolor{AgdaUnsolvedMeta}      {HTML}{FFFF00}+    \definecolor{AgdaUnsolvedConstraint}{HTML}{FFFF00}+    \definecolor{AgdaTerminationProblem}{HTML}{FFA07A}+    \definecolor{AgdaIncompletePattern} {HTML}{F5DEB3}+    \definecolor{AgdaErrorWarning}      {HTML}{FFA07A}+    \definecolor{AgdaError}             {HTML}{FF0000}++    % Misc.+    \definecolor{AgdaHole}              {HTML}{9DFF9D}+}}++% ----------------------------------------------------------------------+% Commands.++\newcommand{\AgdaNoSpaceMath}[1]+    {\begingroup\thickmuskip=0mu\medmuskip=0mu#1\endgroup}++% Aspect commands.+\newcommand{\AgdaComment}     [1]+    {\AgdaNoSpaceMath{\textcolor{AgdaComment}{\AgdaCommentFontStyle{#1}}}}+\newcommand{\AgdaPragma}      [1]+    {\AgdaNoSpaceMath{\textcolor{AgdaPragma}{\AgdaCommentFontStyle{#1}}}}+\newcommand{\AgdaKeyword}     [1]+    {\AgdaNoSpaceMath{\textcolor{AgdaKeyword}{\AgdaKeywordFontStyle{#1}}}}+\newcommand{\AgdaString}      [1]+    {\AgdaNoSpaceMath{\textcolor{AgdaString}{\AgdaStringFontStyle{#1}}}}+\newcommand{\AgdaNumber}      [1]+    {\AgdaNoSpaceMath{\textcolor{AgdaNumber}{\AgdaFontStyle{#1}}}}+\newcommand{\AgdaSymbol}      [1]+    {\AgdaNoSpaceMath{\textcolor{AgdaSymbol}{\AgdaFontStyle{#1}}}}+\newcommand{\AgdaPrimitiveType}[1]+    {\AgdaNoSpaceMath{\textcolor{AgdaPrimitiveType}{\AgdaFontStyle{#1}}}}+%% Andreas, 2021-07-14, issue #5471+%% To make italics correction \/ work, the font-style modifier+%% needs to be inside, in particular inside the \textcolor modifier,+%% as the \textcolor{} wrapping around something hides its content+%% to the logic that resolves \/ into a space or not.++% Note that, in code generated by the LaTeX backend, \AgdaOperator is+% always applied to a NameKind command.+\newcommand{\AgdaOperator}    [1]{#1}++% NameKind commands.++% The user can control the typesetting of (certain) individual tokens+% by redefining the following command. The first argument is the token+% and the second argument the thing to be typeset (sometimes just the+% token, sometimes \AgdaLink{<the token>}). Example:+%+%   \usepackage{ifthen}+%+%   % Insert extra space before some tokens.+%   \DeclareRobustCommand{\AgdaFormat}[2]{%+%     \ifthenelse{+%       \equal{#1}{≡⟨} \OR+%       \equal{#1}{≡⟨⟩} \OR+%       \equal{#1}{∎}+%     }{\ }{}#2}+%+% Note the use of \DeclareRobustCommand.++\newcommand{\AgdaFormat}[2]{#2}++\newcommand{\AgdaBound}[1]+    {\AgdaNoSpaceMath{\textcolor{AgdaBound}{\AgdaBoundFontStyle{\AgdaFormat{#1}{#1}}}}}+\newcommand{\AgdaGeneralizable}[1]+    {\AgdaNoSpaceMath{\textcolor{AgdaGeneralizable}{\AgdaBoundFontStyle{\AgdaFormat{#1}{#1}}}}}+\newcommand{\AgdaInductiveConstructor}[1]+    {\AgdaNoSpaceMath{\textcolor{AgdaInductiveConstructor}{\AgdaFontStyle{\AgdaFormat{#1}{\AgdaLink{#1}}}}}}+\newcommand{\AgdaCoinductiveConstructor}[1]+    {\AgdaNoSpaceMath{\textcolor{AgdaCoinductiveConstructor}{\AgdaFontStyle{\AgdaFormat{#1}{\AgdaLink{#1}}}}}}+\newcommand{\AgdaDatatype}[1]+    {\AgdaNoSpaceMath{\textcolor{AgdaDatatype}{\AgdaFontStyle{\AgdaFormat{#1}{\AgdaLink{#1}}}}}}+\newcommand{\AgdaField}[1]+    {\AgdaNoSpaceMath{\textcolor{AgdaField}{\AgdaFontStyle{\AgdaFormat{#1}{\AgdaLink{#1}}}}}}+\newcommand{\AgdaFunction}[1]+    {\AgdaNoSpaceMath{\textcolor{AgdaFunction}{\AgdaFontStyle{\AgdaFormat{#1}{\AgdaLink{#1}}}}}}+\newcommand{\AgdaMacro}[1]+    {\AgdaNoSpaceMath{\textcolor{AgdaMacro}{\AgdaFontStyle{\AgdaFormat{#1}{\AgdaLink{#1}}}}}}+\newcommand{\AgdaModule}[1]+    {\AgdaNoSpaceMath{\textcolor{AgdaModule}{\AgdaFontStyle{\AgdaFormat{#1}{\AgdaLink{#1}}}}}}+\newcommand{\AgdaPostulate}[1]+    {\AgdaNoSpaceMath{\textcolor{AgdaPostulate}{\AgdaFontStyle{\AgdaFormat{#1}{\AgdaLink{#1}}}}}}+\newcommand{\AgdaPrimitive}[1]+    {\AgdaNoSpaceMath{\textcolor{AgdaPrimitive}{\AgdaFontStyle{\AgdaFormat{#1}{#1}}}}}+\newcommand{\AgdaRecord}[1]+    {\AgdaNoSpaceMath{\textcolor{AgdaRecord}{\AgdaFontStyle{\AgdaFormat{#1}{\AgdaLink{#1}}}}}}+\newcommand{\AgdaArgument}[1]+    {\AgdaNoSpaceMath{\textcolor{AgdaArgument}{\AgdaBoundFontStyle{\AgdaFormat{#1}{#1}}}}}++% Other aspect commands.+\newcommand{\AgdaFixityOp}          [1]{\AgdaNoSpaceMath{$#1$}}+\newcommand{\AgdaDottedPattern}     [1]{\textcolor{AgdaDottedPattern}{#1}}+\newcommand{\AgdaUnsolvedMeta}      [1]+    {\AgdaFontStyle{\colorbox{AgdaUnsolvedMeta}{#1}}}+\newcommand{\AgdaUnsolvedConstraint}[1]+    {\AgdaFontStyle{\colorbox{AgdaUnsolvedConstraint}{#1}}}+\newcommand{\AgdaTerminationProblem}[1]+    {\AgdaFontStyle{\colorbox{AgdaTerminationProblem}{#1}}}+\newcommand{\AgdaIncompletePattern} [1]{\colorbox{AgdaIncompletePattern}{#1}}+\newcommand{\AgdaErrorWarning}      [1]{\colorbox{AgdaErrorWarning}{#1}}+\newcommand{\AgdaError}             [1]+    {\textcolor{AgdaError}{\AgdaFontStyle{\underline{#1}}}}+\newcommand{\AgdaCatchallClause}    [1]{#1} % feel free to change this++% Used to hide code from LaTeX.+%+% Note that this macro has been deprecated in favour of giving the+% hide argument to the code environment.+\long\def\AgdaHide#1{\ignorespaces}++% Misc.+\newcommand{\AgdaHole}[1]{\colorbox{AgdaHole}{#1}}++% ----------------------------------------------------------------------+% The code environment.++\newcommand{\AgdaCodeStyle}{}+% \newcommand{\AgdaCodeStyle}{\tiny}++\ifdefined\mathindent+  {}+\else+  \newdimen\mathindent\mathindent\leftmargini+\fi++% Adds the given amount of vertical space and starts a new line.+%+% The implementation comes from lhs2TeX's polycode.fmt, written by+% Andres Löh.+\newcommand{\Agda@NewlineWithVerticalSpace}[1]{%+  {\parskip=0pt\parindent=0pt\par\vskip #1\noindent}}++% Should there be space around code?+\newboolean{Agda@SpaceAroundCode}++% Use this command to avoid extra space around code blocks.+\newcommand{\AgdaNoSpaceAroundCode}{%+  \setboolean{Agda@SpaceAroundCode}{false}}++% Use this command to include extra space around code blocks.+\newcommand{\AgdaSpaceAroundCode}{%+  \setboolean{Agda@SpaceAroundCode}{true}}++% By default space is inserted around code blocks.+\AgdaSpaceAroundCode{}++% Sometimes one might want to break up a code block into multiple+% pieces, but keep code in different blocks aligned with respect to+% each other. Then one can use the AgdaAlign environment. Example+% usage:+%+%   \begin{AgdaAlign}+%   \begin{code}+%     code+%       code  (more code)+%   \end{code}+%   Explanation...+%   \begin{code}+%     aligned with "code"+%       code  (aligned with (more code))+%   \end{code}+%   \end{AgdaAlign}+%+% Note that AgdaAlign environments should not be nested.+%+% Sometimes one might also want to hide code in the middle of a code+% block. This can be accomplished in the following way:+%+%   \begin{AgdaAlign}+%   \begin{code}+%     visible+%   \end{code}+%   \begin{code}[hide]+%     hidden+%   \end{code}+%   \begin{code}+%     visible+%   \end{code}+%   \end{AgdaAlign}+%+% However, the result may be ugly: extra space is perhaps inserted+% around the code blocks.+%+% The AgdaSuppressSpace environment ensures that extra space is only+% inserted before the first code block, and after the last one (but+% not if \AgdaNoSpaceAroundCode{} is used). Example usage:+%+%   \begin{AgdaAlign}+%   \begin{code}+%     code+%       more code+%   \end{code}+%   Explanation...+%   \begin{AgdaSuppressSpace}+%   \begin{code}+%     aligned with "code"+%       aligned with "more code"+%   \end{code}+%   \begin{code}[hide]+%     hidden code+%   \end{code}+%   \begin{code}+%       also aligned with "more code"+%   \end{code}+%   \end{AgdaSuppressSpace}+%   \end{AgdaAlign}+%+% Note that AgdaSuppressSpace environments should not be nested.+%+% There is also a combined environment, AgdaMultiCode, that combines+% the effects of AgdaAlign and AgdaSuppressSpace.++% The number of the current/next code block (excluding hidden ones).+\newcounter{Agda@Current}+\setcounter{Agda@Current}{0}++% The number of the previous code block (excluding hidden ones), used+% locally in \Agda@SuppressEnd.+\newcounter{Agda@Previous}++% Is AgdaAlign active?+\newboolean{Agda@Align}+\setboolean{Agda@Align}{false}++% The number of the first code block (if any) in a given AgdaAlign+% environment.+\newcounter{Agda@AlignStart}++\newcommand{\Agda@AlignStart}{%+  \ifthenelse{\boolean{Agda@Align}}{%+    \PackageError{agda}{Nested AgdaAlign environments}{%+      AgdaAlign and AgdaMultiCode environments must not be+      nested.}}{%+    \setboolean{Agda@Align}{true}%+    \setcounter{Agda@AlignStart}{\value{Agda@Current}}}}++\newcommand{\Agda@AlignEnd}{\setboolean{Agda@Align}{false}}++\newenvironment{AgdaAlign}{%+  \Agda@AlignStart{}}{%+  \Agda@AlignEnd{}%+  \ignorespacesafterend}++% Is AgdaSuppressSpace active?+\newboolean{Agda@Suppress}+\setboolean{Agda@Suppress}{false}++% The number of the first code block (if any) in a given+% AgdaSuppressSpace environment.+\newcounter{Agda@SuppressStart}++% Does a "do not suppress space after" label exist for the current+% code block? (This boolean is used locally in the code environment's+% implementation.)+\newboolean{Agda@DoNotSuppressSpaceAfter}++\newcommand{\Agda@SuppressStart}{%+  \ifthenelse{\boolean{Agda@Suppress}}{%+    \PackageError{agda}{Nested AgdaSuppressSpace environments}{%+      AgdaSuppressSpace and AgdaMultiCode environments must not be+      nested.}}{%+    \setboolean{Agda@Suppress}{true}%+    \setcounter{Agda@SuppressStart}{\value{Agda@Current}}}}++% Marks the given code block as one that space should not be+% suppressed after (if AgdaSpaceAroundCode and AgdaSuppressSpace are+% both active).+\newcommand{\Agda@DoNotSuppressSpaceAfter}[1]{%+  % The use of labels is intended to ensure that LaTeX will provide a+  % warning if the document needs to be recompiled.+  \label{Agda@DoNotSuppressSpaceAfter@#1}}++\newcommand{\Agda@SuppressEnd}{%+  \ifthenelse{\value{Agda@SuppressStart} = \value{Agda@Current}}{}{%+    % Mark the previous code block in the .aux file.+    \setcounter{Agda@Previous}{\theAgda@Current-1}%+    \immediate\write\@auxout{%+      \noexpand\Agda@DoNotSuppressSpaceAfter{\theAgda@Previous}}}%+  \setboolean{Agda@Suppress}{false}}++\newenvironment{AgdaSuppressSpace}{%+  \Agda@SuppressStart{}}{%+  \Agda@SuppressEnd{}%+  \ignorespacesafterend}++\newenvironment{AgdaMultiCode}{%+  \Agda@AlignStart{}%+  \Agda@SuppressStart{}}{%+  \Agda@SuppressEnd{}%+  \Agda@AlignEnd{}%+  \ignorespacesafterend}++% Vertical space used for empty lines. By default \abovedisplayskip.+\newlength{\AgdaEmptySkip}+\setlength{\AgdaEmptySkip}{\abovedisplayskip}++% Extra space to be inserted for empty lines (the difference between+% \AgdaEmptySkip and \baselineskip). Used internally.+\newlength{\AgdaEmptyExtraSkip}++% Counter used for code numbers.+\newcounter{AgdaCodeNumber}+% Formats a code number.+\newcommand{\AgdaFormatCodeNumber}[1]{(#1)}++% A boolean used to handle the option number.+\newboolean{Agda@Number}+\setboolean{Agda@Number}{false}++% A boolean used to handle the option inline*. (For some reason the+% approach used for hide and inline does not work for inline*.)+\newboolean{Agda@InlineStar}+\setboolean{Agda@InlineStar}{false}++% Keys used by the code environment.+\define@boolkey[Agda]{code}{hide}[true]{}+\define@boolkey[Agda]{code}{inline}[true]{}+\define@boolkey[Agda]{code}{inline*}[true]{%+  \setboolean{Agda@InlineStar}{true}}+\define@key[Agda]{code}{number}[]{%+  \ifthenelse{\boolean{Agda@Number}}{}{%+    \setboolean{Agda@Number}{true}%+    % Increase the counter if this has not already been done.+    \refstepcounter{AgdaCodeNumber}}%+  % If the label is non-empty, set it. Note that it is possible to+  % give several labels for a single code listing.+  \ifthenelse{\equal{#1}{}}{}{\label{#1}}}++% The code environment.+%+% Options:+%+% * hide: The code is hidden. Other options are ignored.+%+% * number: Give the code an equation number.+%+% * number=l: Give the code an equation number and the label l. It is+%   possible to use this option several times with different labels.+%+% * inline/inline*: The code is inlined. In this case most of the+%   discussion above does not apply, alignment is not respected, and so+%   on. It is recommended to only use this option for a single line of+%   code, and to not use two consecutive spaces in this piece of code.+%+%   Note that this environment ignores spaces after its end. If a space+%   (\AgdaSpace{}) should be inserted after the inline code, use+%   inline*, otherwise use inline.+%+%   When this option is used number is ignored.+%+% The implementation is based on plainhscode in lhs2TeX's+% polycode.fmt, written by Andres Löh.+\NewEnviron{code}[1][]{%+  % Process the options. Complain about unknown options.+  \setkeys[Agda]{code}[number]{#1}%+  \ifAgda@code@hide%+    % Hide the code.+  \else%+  \ifAgda@code@inline%+    % Inline code.+    %+    % Make the polytable primitives emitted by the LaTeX backend+    % do nothing.+    \DeclareDocumentCommand{\>}{O{}O{}}{}%+    \DeclareDocumentCommand{\<}{O{}}{}%+    \AgdaCodeStyle\BODY%+  \else%+  \ifthenelse{\boolean{Agda@InlineStar}}{%+    % Inline code with space at the end.+    %+    \DeclareDocumentCommand{\>}{O{}O{}}{}%+    \DeclareDocumentCommand{\<}{O{}}{}%+    \AgdaCodeStyle\BODY\AgdaSpace{}}{%+    %+    % Displayed code.+    %+    % Conditionally emit space before the code block. Unconditionally+    % switch to a new line.+    \ifthenelse{\boolean{Agda@SpaceAroundCode} \and%+                \(\not \boolean{Agda@Suppress} \or%+                  \value{Agda@SuppressStart} = \value{Agda@Current}\)}{%+      \Agda@NewlineWithVerticalSpace{\abovedisplayskip}}{%+      \Agda@NewlineWithVerticalSpace{0pt}}%+    %+    % Check if numbers have been requested. If they have, then a side+    % effect of this call is that Agda@Number is set to true, the code+    % number counter is increased, and the label (if any) is set.+    \setkeys[Agda]{code}[hide,inline,inline*]{#1}%+    \ifthenelse{\boolean{Agda@Number}}{%+      % Equation numbers have been requested. Use a minipage, so that+      % there is room for the code number to the right, and the code+      % number becomes centered vertically.+      \begin{minipage}{%+          \linewidth-%+          \widthof{%+            \AgdaSpace{}%+            \AgdaFormatCodeNumber{\theAgdaCodeNumber}}}}{}%+    %+    % Indent the entire code block.+    \advance\leftskip\mathindent%+    %+    % The code's style can be customised.+    \AgdaCodeStyle%+    %+    % Used to control the height of empty lines.+    \setlength{\AgdaEmptyExtraSkip}{\AgdaEmptySkip - \baselineskip}%+    %+    % The environment used to handle indentation (of individual lines)+    % and alignment.+    \begin{pboxed}%+      %+      % Conditionally preserve alignment between code blocks.+      \ifthenelse{\boolean{Agda@Align}}{%+        \ifthenelse{\value{Agda@AlignStart} = \value{Agda@Current}}{%+          \savecolumns}{%+          \restorecolumns}}{}%+      %+      % The code.+      \BODY%+    \end{pboxed}%+    %+    \ifthenelse{\boolean{Agda@Number}}{%+      % Equation numbers have been requested.+      \end{minipage}%+      % Insert the code number to the right.+      \hfill \AgdaFormatCodeNumber{\theAgdaCodeNumber}}{}%+    %+    % Does the label Agda@DoNotSuppressAfter@<current code block+    % number> exist?+    \ifcsdef{r@Agda@DoNotSuppressSpaceAfter@\theAgda@Current}{%+      \setboolean{Agda@DoNotSuppressSpaceAfter}{true}}{%+      \setboolean{Agda@DoNotSuppressSpaceAfter}{false}}%+    %+    % Conditionally emit space after the code block. Unconditionally+    % switch to a new line.+    \ifthenelse{\boolean{Agda@SpaceAroundCode} \and%+                \(\not \boolean{Agda@Suppress} \or%+                  \boolean{Agda@DoNotSuppressSpaceAfter}\)}{%+      \Agda@NewlineWithVerticalSpace{\belowdisplayskip}}{%+      \Agda@NewlineWithVerticalSpace{0pt}}%+    %+    % Step the code block counter, but only for non-hidden code.+    \stepcounter{Agda@Current}}%+  \fi%+  \fi%+  % Reset Agda@Number and Agda@InlineStar.+  \setboolean{Agda@Number}{false}%+  \setboolean{Agda@InlineStar}{false}}++% Space inserted after tokens.+\newcommand{\AgdaSpace}{ }++% Space inserted to indent something.+\newcommand{\AgdaIndentSpace}{\AgdaSpace{}$\;\;$}++% Default column for polytable.+\defaultcolumn{@{}l@{\AgdaSpace{}}}++% \AgdaIndent expects a non-negative integer as its only argument.+% This integer should be the distance, in code blocks, to the thing+% relative to which the text is indented.+%+% The default implementation only indents if the thing that the text+% is indented relative to exists in the same code block or is wrapped+% in the same AgdaAlign or AgdaMultiCode environment.+\newcommand{\AgdaIndent}[1]{%+  \ifthenelse{#1 = 0+                \or+              \( \boolean{Agda@Align}+                   \and+                 \cnttest{\value{Agda@Current} - #1}{>=}{+                          \value{Agda@AlignStart}}+              \)}{\AgdaIndentSpace{}}{}}++% Underscores are typeset using \AgdaUnderscore{}.+\newcommand{\AgdaUnderscore}{\_}++\endinput
+ src/data/latex/postprocess-latex.pl view
@@ -0,0 +1,24 @@+#!/usr/bin/env perl++use strict;+use warnings;++my $tag_prefix = "AgdaTag";+my $underscore = "AgdaUnderscore";+my $commands   = qr"(InductiveConstructor|CoinductiveConstructor\+                    |Datatype|Field|Function|Module|Postulate|Record)";++while (<>) {++  s|(\\Agda$commands)\{(.*?)\}++   | my $cmd = $1;+     my $arg = $3;+     my $tag = "$tag_prefix-$3" =~ s/\\_/$underscore/gr;++     $_ = "%\n%<*$tag>\n$cmd\{$arg\}%\n%</$tag>\n";+   |gxe;++  print;++}
src/data/lib/prim/Agda/Builtin/Cubical/Id.agda view
@@ -13,6 +13,12 @@   {-# BUILTIN ID           Id       #-}   {-# BUILTIN CONID        conid    #-} +  -- Id x y is treated as a pair of I and x ≡ y, using "i" for the+  -- first component and "p" for the second.+  {-# COMPILE JS conid =+      _ => _ => _ => _ => i => p => { return { "i" : i, "p" : p } }+    #-}+   primitive     primDepIMin : _     primIdFace : ∀ {ℓ} {A : Set ℓ} {x y : A} → Id x y → I
src/data/lib/prim/Agda/Builtin/Cubical/Sub.agda view
@@ -12,5 +12,8 @@    {-# BUILTIN SUBIN inc #-} +  -- Sub A φ u is treated as A.+  {-# COMPILE JS inc = _ => _ => _ => x => x #-}+   primitive     primSubOut : ∀ {ℓ} {A : Set ℓ} {φ : I} {u : Partial φ A} → Sub _ φ u → A
src/data/lib/prim/Agda/Builtin/Reflection.agda view
@@ -349,3 +349,39 @@ {-# BUILTIN AGDATCMWITHRECONSPARAMS           withReconstructed          #-} {-# BUILTIN AGDATCMNOCONSTRAINTS              noConstraints              #-} {-# BUILTIN AGDATCMRUNSPECULATIVE             runSpeculative             #-}++-- All the TC primitives are compiled to functions that return+-- undefined, rather than just undefined, in an attempt to make sure+-- that code will run properly.+{-# COMPILE JS returnTC          = _ => _ => _ =>      undefined #-}+{-# COMPILE JS bindTC            = _ => _ => _ => _ =>+                                   _ => _ =>           undefined #-}+{-# COMPILE JS unify             = _ => _ =>           undefined #-}+{-# COMPILE JS typeError         = _ => _ => _ =>      undefined #-}+{-# COMPILE JS inferType         = _ =>                undefined #-}+{-# COMPILE JS checkType         = _ => _ =>           undefined #-}+{-# COMPILE JS normalise         = _ =>                undefined #-}+{-# COMPILE JS reduce            = _ =>                undefined #-}+{-# COMPILE JS catchTC           = _ => _ => _ => _ => undefined #-}+{-# COMPILE JS quoteTC           = _ => _ => _ =>      undefined #-}+{-# COMPILE JS unquoteTC         = _ => _ => _ =>      undefined #-}+{-# COMPILE JS quoteωTC          = _ => _ =>           undefined #-}+{-# COMPILE JS getContext        =                     undefined #-}+{-# COMPILE JS extendContext     = _ => _ => _ => _ => undefined #-}+{-# COMPILE JS inContext         = _ => _ => _ => _ => undefined #-}+{-# COMPILE JS freshName         = _ =>                undefined #-}+{-# COMPILE JS declareDef        = _ => _ =>           undefined #-}+{-# COMPILE JS declarePostulate  = _ => _ =>           undefined #-}+{-# COMPILE JS defineFun         = _ => _ =>           undefined #-}+{-# COMPILE JS getType           = _ =>                undefined #-}+{-# COMPILE JS getDefinition     = _ =>                undefined #-}+{-# COMPILE JS blockOnMeta       = _ => _ => _ =>      undefined #-}+{-# COMPILE JS commitTC          =                     undefined #-}+{-# COMPILE JS isMacro           = _ =>                undefined #-}+{-# COMPILE JS withNormalisation = _ => _ => _ => _ => undefined #-}+{-# COMPILE JS withReconstructed = _ => _ => _ =>      undefined #-}+{-# COMPILE JS debugPrint        = _ => _ => _ =>      undefined #-}+{-# COMPILE JS onlyReduceDefs    = _ => _ => _ => _ => undefined #-}+{-# COMPILE JS dontReduceDefs    = _ => _ => _ => _ => undefined #-}+{-# COMPILE JS noConstraints     = _ => _ => _ =>      undefined #-}+{-# COMPILE JS runSpeculative    = _ => _ => _ =>      undefined #-}
src/data/lib/prim/Agda/Builtin/Reflection/External.agda view
@@ -13,3 +13,5 @@          → TC (Σ Nat (λ _ → Σ String (λ _ → String)))  {-# BUILTIN AGDATCMEXEC execTC #-}++{-# COMPILE JS execTC = _ => _ => _ => undefined #-}
src/data/lib/prim/Agda/Primitive/Cubical.agda view
@@ -7,6 +7,10 @@ {-# BUILTIN IZERO    i0 #-} {-# BUILTIN IONE     i1 #-} +-- I is treated as the type of booleans.+{-# COMPILE JS i0 = false #-}+{-# COMPILE JS i1 = true  #-}+ infix  30 primINeg infixr 20 primIMin primIMax @@ -26,6 +30,15 @@ {-# BUILTIN ISONE1   IsOne1   #-} {-# BUILTIN ISONE2   IsOne2   #-} +-- IsOne i is treated as the unit type.+{-# COMPILE JS itIsOne = { "tt" : a => a["tt"]() } #-}+{-# COMPILE JS IsOne1 =+  _ => _ => _ => { return { "tt" : a => a["tt"]() } }+  #-}+{-# COMPILE JS IsOne2 =+  _ => _ => _ => { return { "tt" : a => a["tt"]() } }+  #-}+ -- Partial : ∀{ℓ} (i : I) (A : Set ℓ) → Set ℓ -- Partial i A = IsOne i → A @@ -36,6 +49,11 @@   isOneEmpty : ∀ {ℓ} {A : Partial i0 (Set ℓ)} → PartialP i0 A  {-# BUILTIN ISONEEMPTY isOneEmpty #-}++-- Partial i A and PartialP i A are treated as IsOne i → A.+{-# COMPILE JS isOneEmpty =+  _ => x => _ => x({ "tt" : a => a["tt"]() })+  #-}  primitive   primPOr : ∀ {ℓ} (i j : I) {A : Partial (primIMax i j) (Set ℓ)}
− src/data/postprocess-latex.pl
@@ -1,24 +0,0 @@-#!/usr/bin/env perl--use strict;-use warnings;--my $tag_prefix = "AgdaTag";-my $underscore = "AgdaUnderscore";-my $commands   = qr"(InductiveConstructor|CoinductiveConstructor\-                    |Datatype|Field|Function|Module|Postulate|Record)";--while (<>) {--  s|(\\Agda$commands)\{(.*?)\}--   | my $cmd = $1;-     my $arg = $3;-     my $tag = "$tag_prefix-$3" =~ s/\\_/$underscore/gr;--     $_ = "%\n%<*$tag>\n$cmd\{$arg\}%\n%</$tag>\n";-   |gxe;--  print;--}
src/full/Agda/Compiler/Common.hs view
@@ -16,6 +16,7 @@ import Control.Monad import Control.Monad.State +import Agda.Syntax.Common import qualified Agda.Syntax.Concrete.Name as C import Agda.Syntax.Internal as I @@ -146,6 +147,14 @@     -- We match on whether @["--no-main"]@ is one of the stored options.     when (["--no-main"] `elem` iFilePragmaOptions mainI) $       stPragmaOptions `modifyTCLens` \ o -> o { optCompileNoMain = True }++    -- Perhaps all pragma options from the top-level module should be+    -- made available to the compiler in a suitable way. Here are more+    -- hacks:+    when (any ("--cubical" `elem`) (iFilePragmaOptions mainI)) $+      stPragmaOptions `modifyTCLens` \ o -> o { optCubical = Just CFull }+    when (any ("--erased-cubical" `elem`) (iFilePragmaOptions mainI)) $+      stPragmaOptions `modifyTCLens` \ o -> o { optCubical = Just CErased }      setScope (iInsideScope mainI) -- so that compiler errors don't use overly qualified names     ignoreAbstractMode cont
src/full/Agda/Compiler/JS/Compiler.hs view
@@ -34,7 +34,7 @@     mnameToList, qnameName, qnameModule, nameId ) import Agda.Syntax.Internal   ( Name, Type-  , arity, nameFixity, unDom )+  , nameFixity, unDom, telToList ) import Agda.Syntax.Literal       ( Literal(..) ) import Agda.Syntax.Treeless      ( ArgUsage(..), filterUsed ) import qualified Agda.Syntax.Treeless as T@@ -43,6 +43,7 @@ import Agda.TypeChecking.Reduce ( instantiateFull ) import Agda.TypeChecking.Substitute as TC ( TelV(..), raise, subst ) import Agda.TypeChecking.Pretty+import Agda.TypeChecking.Telescope ( telViewPath )  import Agda.Utils.FileName ( isNewerThan ) import Agda.Utils.Function ( iterate' )@@ -146,8 +147,18 @@ --- Top-level compilation ---  jsPreCompile :: JSOptions -> TCM JSOptions-jsPreCompile opts = return opts+jsPreCompile opts = do+  cubical <- optCubical <$> pragmaOptions+  let notSupported s =+        typeError $ GenericError $+          "Compilation of code that uses " ++ s ++ " is not supported."+  case cubical of+    Nothing      -> return ()+    Just CErased -> return ()+    Just CFull   -> notSupported "--cubical" +  return opts+ -- | After all modules have been compiled, copy RTE modules and verify compiled modules.  jsPostCompile :: JSOptions -> IsMain -> Map.Map ModuleName Module -> TCM ()@@ -192,10 +203,21 @@  --- Module compilation --- -type JSModuleEnv = Maybe CoinductionKit+data JSModuleEnv = JSModuleEnv+  { jsCoinductionKit :: Maybe CoinductionKit+  , jsCompile        :: Bool+    -- ^ Should this module be compiled?+  }  jsPreModule :: JSOptions -> IsMain -> ModuleName -> Maybe FilePath -> TCM (Recompile JSModuleEnv Module)-jsPreModule _opts _ m mifile = ifM uptodate noComp yesComp+jsPreModule _opts _ m mifile = do+  cubical <- optCubical <$> pragmaOptions+  let compile = case cubical of+        -- Code that uses --cubical is not compiled.+        Just CFull   -> False+        Just CErased -> True+        Nothing      -> True+  ifM uptodate noComp (yesComp compile)   where     uptodate = case mifile of       Nothing -> pure False@@ -209,11 +231,15 @@     -- A skipped module acts as a fake main module, to be skipped by --js-verify as well.     skippedModule = Module (jsMod m) mempty mempty (Just __IMPOSSIBLE__) -    yesComp = do+    yesComp compile = do       m   <- prettyShow <$> curMName       out <- outFile_       reportSLn "compile.js" 1 $ repl [m, ifileDesc, out] "Compiling <<0>> in <<1>> to <<2>>"-      Recompile <$> coinductionKit+      kit <- coinductionKit+      return $ Recompile $ JSModuleEnv+        { jsCoinductionKit = kit+        , jsCompile        = compile+        }  jsPostModule :: JSOptions -> JSModuleEnv -> IsMain -> ModuleName -> [Maybe Export] -> TCM Module jsPostModule opts _ isMain _ defs = do@@ -368,13 +394,18 @@     dropEquals = dropWhile $ \ c -> isSpace c || c == '='  definition' :: EnvWithOpts -> QName -> Definition -> Type -> JSQName -> TCM (Maybe Export)-definition' kit q d t ls = if not (usableModality d) then return Nothing else do+definition' kit q d t ls =+  if not (jsCompile (snd kit)) || not (usableModality d)+  then return Nothing+  else do   checkCompilerPragmas q   case theDef d of     -- coinduction-    Constructor{} | Just q == (nameOfSharp <$> snd kit) -> do+    Constructor{}+      | Just q == (nameOfSharp <$> jsCoinductionKit (snd kit)) -> do       return Nothing-    Function{} | Just q == (nameOfFlat <$> snd kit) -> do+    Function{}+      | Just q == (nameOfFlat <$> jsCoinductionKit (snd kit)) -> do       ret $ Lambda 1 $ Apply (Lookup (local 0) flatName) []      DataOrRecSig{} -> __IMPOSSIBLE__@@ -418,8 +449,12 @@           else Just $ Export ls funBody'      Primitive{primName = p}-      | p `Set.member` cubicalPrimitives ->-        typeError $ NotImplemented p+      | p == builtin_glueU ->+        -- The string prim^glueU is not a valid JS name.+        plainJS "agdaRTS.prim_glueU"+      | p == builtin_unglueU ->+        -- The string prim^unglueU is not a valid JS name.+        plainJS "agdaRTS.prim_unglueU"       | p `Set.member` primitives ->         plainJS $ "agdaRTS." ++ p       | Just e <- defJSDef d ->@@ -428,10 +463,6 @@         ret Undefined     PrimitiveSort{} -> return Nothing -    Datatype{ dataPathCons = _ : _ } -> do-      s <- render <$> prettyTCM q-      typeError $ NotImplemented $-        "Higher inductive types (" ++ s ++ ")"     Datatype{} -> do         computeErasedConstructorArgs q         ret emp@@ -441,7 +472,8 @@      Constructor{} | Just e <- defJSDef d -> plainJS e     Constructor{conData = p, conPars = nc} -> do-      let np = arity t - nc+      TelV tel _ <- telViewPath t+      let np = length (telToList tel) - nc       erased <- getErasedConArgs q       let nargs = np - length (filter id erased)           args = [ Local $ LocalId $ nargs - i | i <- [0 .. nargs-1] ]@@ -451,7 +483,7 @@         Record { recFields = flds } -> ret $ curriedLambda nargs $           if optJSOptimize (fst kit)             then Lambda 1 $ Apply (Local (LocalId 0)) args-            else Object $ Map.fromList [ (l, Lambda 1 $ Apply (Lookup (Local (LocalId 0)) l) args) ]+            else Object $ Map.singleton l $ Lambda 1 $ Apply (Lookup (Local (LocalId 0)) l) args         dt -> do           i <- index           ret $ curriedLambda (nargs + 1) $ Apply (Lookup (Local (LocalId 0)) i) args@@ -487,7 +519,8 @@           Datatype {} -> return (String "*")           Record {} -> return (String "*")           _ -> qname q-      T.TApp (T.TCon q) [x] | Just q == (nameOfSharp <$> snd kit) -> do+      T.TApp (T.TCon q) [x]+        | Just q == (nameOfSharp <$> jsCoinductionKit (snd kit)) -> do         x <- go x         let evalThunk = unlines               [ "function() {"@@ -498,7 +531,7 @@               , "  return result;"               , "}"               ]-        return $ Object $ Map.fromList+        return $ Object $ Map.fromListWith __IMPOSSIBLE__           [(flatName, PlainJS evalThunk)           ,(MemberId "__flat_helper", Lambda 0 x)]       T.TApp t' xs | Just f <- getDef t' -> do@@ -512,7 +545,8 @@             -- number of eta expanded args             etaN = length $ dropWhile (== ArgUsed) $ reverse $ drop given used -            args = filterUsed used $ xs ++ (T.TVar <$> downFrom etaN)+            args = filterUsed used $+                     raise etaN xs ++ (T.TVar <$> downFrom etaN)          curriedLambda etaN <$> (curriedApply <$> go (raise etaN t') <*> mapM go args) @@ -529,7 +563,7 @@         dt <- getConstInfo dt         alts' <- traverse (compileAlt kit) alts         let cs  = defConstructors $ theDef dt-            obj = Object $ Map.fromList [(snd x, y) | (x, y) <- alts']+            obj = Object $ Map.fromListWith __IMPOSSIBLE__ [(snd x, y) | (x, y) <- alts']             arr = mkArray [headWithDefault (mempty, Null) [(Comment s, y) | ((c', MemberId s), y) <- alts', c' == c] | c <- cs]         case (theDef dt, defJSDef dt) of           (_, Just e) -> do@@ -563,7 +597,8 @@      mkArray xs         | 2 * length (filter ((==Null) . snd) xs) <= length xs = Array xs-        | otherwise = Object $ Map.fromList [(MemberIndex i c, x) | (i, (c, x)) <- zip [0..] xs, x /= Null]+        | otherwise = Object $ Map.fromListWith __IMPOSSIBLE__+            [ (MemberIndex i c, x) | (i, (c, x)) <- zip [0..] xs, x /= Null ]  compilePrim :: T.TPrim -> Exp compilePrim p =@@ -637,7 +672,7 @@  litqname :: QName -> Exp litqname q =-  Object $ Map.fromList+  Object $ Map.fromListWith __IMPOSSIBLE__     [ (mem "id", Integer $ fromIntegral n)     , (mem "moduleId", Integer $ fromIntegral m)     , (mem "name", String $ T.pack $ prettyShow q)@@ -648,7 +683,7 @@     fx = theFixity $ nameFixity $ qnameName q      litfixity :: Fixity -> Exp-    litfixity fx = Object $ Map.fromList+    litfixity fx = Object $ Map.fromListWith __IMPOSSIBLE__       [ (mem "assoc", litAssoc $ fixityAssoc fx)       , (mem "prec", litPrec $ fixityLevel fx)] @@ -683,32 +718,12 @@   m <- curMName   outFile (jsMod m) --- | Cubical primitives that are (currently) not compiled.+-- | Primitives implemented in the JS Agda RTS. ----- TODO: Primitives that are neither part of this set nor of--- 'primitives', and for which 'defJSDef' does not return anything,--- are silently compiled to 'Undefined'. Thus, if a cubical primitive--- is by accident omitted from 'cubicalPrimitives', then programs that--- should be rejected are compiled to something which might not work--- as intended. A better approach might be to list exactly those+-- TODO: Primitives that are not part of this set, and for which+-- 'defJSDef' does not return anything, are silently compiled to+-- 'Undefined'. A better approach might be to list exactly those -- primitives which should be compiled to 'Undefined'.--cubicalPrimitives :: Set String-cubicalPrimitives = Set.fromList-  [ "primIMin"-  , "primIMax"-  , "primINeg"-  , "primPartial"-  , "primPartialP"-  , "primPFrom1"-  , "primPOr"-  , "primComp"-  , "primTransp"-  , "primHComp"-  , "primSubOut"-  ]---- | Primitives implemented in the JS Agda RTS. primitives :: Set String primitives = Set.fromList   [  "primShowInteger"@@ -822,25 +837,25 @@   -- , "primShowMeta"                -- missing   -- , "primMetaToNat"               -- missing   -- , "primMetaToNatInjective"      -- missing-  -- , "primIMin"                    -- missing-  -- , "primIMax"                    -- missing-  -- , "primINeg"                    -- missing-  -- , "primPOr"                     -- missing-  -- , "primComp"                    -- missing-  -- , builtinTrans                  -- missing-  -- , builtinHComp                  -- missing-  -- , "primIdJ"                     -- missing-  -- , "primPartial"                 -- missing-  -- , "primPartialP"                -- missing+  , builtinIMin+  , builtinIMax+  , builtinINeg+  , "primPartial"+  , "primPartialP"+  , builtinPOr+  , builtinComp+  , builtinTrans+  , builtinHComp+  , builtinSubOut+  , builtin_glueU+  , builtin_unglueU+  , builtinFaceForall+  , "primDepIMin"+  , "primIdFace"+  , "primIdPath"+  , "primIdJ"+  , builtinIdElim   -- , builtinGlue                   -- missing   -- , builtin_glue                  -- missing   -- , builtin_unglue                -- missing-  -- , builtinFaceForall             -- missing-  -- , "primDepIMin"                 -- missing-  -- , "primIdFace"                  -- missing-  -- , "primIdPath"                  -- missing-  -- , builtinIdElim                 -- missing-  -- , builtinSubOut                 -- missing-  -- , builtin_glueU                 -- missing-  -- , builtin_unglueU               -- missing   ]
src/full/Agda/Compiler/MAlonzo/Compiler.hs view
@@ -7,6 +7,7 @@ import Control.Monad.Reader import Control.Monad.Writer hiding ((<>)) +import qualified Data.HashSet as HashSet import qualified Data.List as List import Data.Map (Map) import qualified Data.Map as Map@@ -33,6 +34,7 @@ import Agda.Compiler.MAlonzo.Primitives import Agda.Compiler.MAlonzo.HaskellTypes import Agda.Compiler.MAlonzo.Pragmas+import Agda.Compiler.MAlonzo.Strict import Agda.Compiler.ToTreeless import Agda.Compiler.Treeless.Unused import Agda.Compiler.Treeless.Erase@@ -78,7 +80,7 @@ ghcBackend :: Backend ghcBackend = Backend ghcBackend' -ghcBackend' :: Backend' GHCFlags GHCCompileEnv GHCModuleEnv GHCModule GHCDefinition+ghcBackend' :: Backend' GHCFlags GHCEnv GHCModuleEnv GHCModule GHCDefinition ghcBackend' = Backend'   { backendName           = "GHC"   , backendVersion        = Nothing@@ -101,7 +103,11 @@   , flagGhcCallGhc :: Bool   , flagGhcBin     :: Maybe FilePath     -- ^ Use the compiler at PATH instead of "ghc"-  , flagGhcFlags   :: [String]+  , flagGhcFlags      :: [String]+  , flagGhcStrictData :: Bool+    -- ^ Make inductive constructors strict?+  , flagGhcStrict :: Bool+    -- ^ Make functions strict?   }   deriving Generic @@ -109,10 +115,12 @@  defaultGHCFlags :: GHCFlags defaultGHCFlags = GHCFlags-  { flagGhcCompile = False-  , flagGhcCallGhc = True-  , flagGhcBin     = Nothing-  , flagGhcFlags   = []+  { flagGhcCompile    = False+  , flagGhcCallGhc    = True+  , flagGhcBin        = Nothing+  , flagGhcFlags      = []+  , flagGhcStrictData = False+  , flagGhcStrict     = False   }  ghcCommandLineFlags :: [OptDescr (Flag GHCFlags)]@@ -125,11 +133,19 @@                     "give the flag GHC-FLAG to GHC"     , Option []     ["with-compiler"] (ReqArg withCompilerFlag "PATH")                     "use the compiler available at PATH"+    , Option []     ["ghc-strict-data"] (NoArg strictData)+                    "make inductive constructors strict"+    , Option []     ["ghc-strict"] (NoArg strict)+                    "make functions strict"     ]   where-    enable      o = pure o{ flagGhcCompile = True }-    dontCallGHC o = pure o{ flagGhcCallGhc = False }-    ghcFlag f   o = pure o{ flagGhcFlags   = flagGhcFlags o ++ [f] }+    enable      o = pure o{ flagGhcCompile    = True }+    dontCallGHC o = pure o{ flagGhcCallGhc    = False }+    ghcFlag f   o = pure o{ flagGhcFlags      = flagGhcFlags o ++ [f] }+    strictData  o = pure o{ flagGhcStrictData = True }+    strict      o = pure o{ flagGhcStrictData = True+                          , flagGhcStrict     = True+                          }  withCompilerFlag :: FilePath -> Flag GHCFlags withCompilerFlag fp o = case flagGhcBin o of@@ -138,15 +154,6 @@  --- Context types --- --- | The options derived from @GHCFlags@ and other shared options.-data GHCOptions = GHCOptions-  { optGhcCallGhc    :: Bool-  , optGhcBin        :: FilePath-    -- ^ Use the compiler at PATH instead of "ghc"-  , optGhcFlags      :: [String]-  , optGhcCompileDir :: FilePath-  }- -- | Monads that can read @GHCOptions@ class Monad m => ReadGHCOpts m where   askGhcOpts :: m GHCOptions@@ -154,29 +161,14 @@ instance Monad m => ReadGHCOpts (ReaderT GHCOptions m) where   askGhcOpts = ask -data GHCCompileEnv = GHCCompileEnv-  { ghcCompileEnvOpts :: GHCOptions-  }--instance Monad m => ReadGHCOpts (ReaderT GHCCompileEnv m) where-  askGhcOpts = withReaderT ghcCompileEnvOpts askGhcOpts---- | Module compilation environment, bundling the overall---   backend session options along with the module's basic---   readable properties.-data GHCModuleEnv = GHCModuleEnv-  { ghcModCompileEnv  :: GHCCompileEnv-  , ghcModHsModuleEnv :: HsModuleEnv-  }+instance Monad m => ReadGHCOpts (ReaderT GHCEnv m) where+  askGhcOpts = withReaderT ghcEnvOpts askGhcOpts  instance Monad m => ReadGHCOpts (ReaderT GHCModuleEnv m) where-  askGhcOpts = withReaderT ghcModCompileEnv askGhcOpts--instance Monad m => ReadHsModuleEnv (ReaderT GHCModuleEnv m) where-  askHsModuleEnv = withReaderT ghcModHsModuleEnv askHsModuleEnv+  askGhcOpts = withReaderT ghcModEnv askGhcOpts  data GHCModule = GHCModule-  { ghcModEnv                :: GHCModuleEnv+  { ghcModModuleEnv :: GHCModuleEnv   , ghcModMainFuncs :: [MainFunctionDef]   -- ^ The `main` function definition(s), if both the module is   --   the @IsMain@ module (root/focused) and a suitable `main`@@ -184,10 +176,10 @@   }  instance Monad m => ReadGHCOpts (ReaderT GHCModule m) where-  askGhcOpts = withReaderT ghcModEnv askGhcOpts+  askGhcOpts = withReaderT ghcModModuleEnv askGhcOpts -instance Monad m => ReadHsModuleEnv (ReaderT GHCModule m) where-  askHsModuleEnv = withReaderT ghcModEnv askHsModuleEnv+instance Monad m => ReadGHCModuleEnv (ReaderT GHCModule m) where+  askGHCModuleEnv = withReaderT ghcModModuleEnv askGHCModuleEnv  data GHCDefinition = GHCDefinition   { ghcDefUsesFloat  :: UsesFloat@@ -199,18 +191,130 @@  --- Top-level compilation --- -ghcPreCompile :: GHCFlags -> TCM GHCCompileEnv+ghcPreCompile :: GHCFlags -> TCM GHCEnv ghcPreCompile flags = do+  cubical <- optCubical <$> pragmaOptions+  let notSupported s =+        typeError $ GenericError $+          "Compilation of code that uses " ++ s ++ " is not supported."+  case cubical of+    Nothing      -> return ()+    Just CErased -> return ()+    Just CFull   -> notSupported "--cubical"+   outDir <- compileDir   let ghcOpts = GHCOptions                 { optGhcCallGhc    = flagGhcCallGhc flags                 , optGhcBin        = fromMaybe "ghc" (flagGhcBin flags)                 , optGhcFlags      = flagGhcFlags flags                 , optGhcCompileDir = outDir+                , optGhcStrictData = flagGhcStrictData flags+                , optGhcStrict     = flagGhcStrict flags                 }-  return $ GHCCompileEnv ghcOpts -ghcPostCompile :: GHCCompileEnv -> IsMain -> Map ModuleName GHCModule -> TCM ()+  mbool       <- getBuiltinName builtinBool+  mtrue       <- getBuiltinName builtinTrue+  mfalse      <- getBuiltinName builtinFalse+  mlist       <- getBuiltinName builtinList+  mnil        <- getBuiltinName builtinNil+  mcons       <- getBuiltinName builtinCons+  mmaybe      <- getBuiltinName builtinMaybe+  mnothing    <- getBuiltinName builtinNothing+  mjust       <- getBuiltinName builtinJust+  mnat        <- getBuiltinName builtinNat+  minteger    <- getBuiltinName builtinInteger+  mword64     <- getBuiltinName builtinWord64+  minf        <- getBuiltinName builtinInf+  msharp      <- getBuiltinName builtinSharp+  mflat       <- getBuiltinName builtinFlat+  minterval   <- getBuiltinName builtinInterval+  mizero      <- getBuiltinName builtinIZero+  mione       <- getBuiltinName builtinIOne+  misone      <- getBuiltinName builtinIsOne+  mitisone    <- getBuiltinName builtinItIsOne+  misone1     <- getBuiltinName builtinIsOne1+  misone2     <- getBuiltinName builtinIsOne2+  misoneempty <- getBuiltinName builtinIsOneEmpty+  mpathp      <- getBuiltinName builtinPathP+  msub        <- getBuiltinName builtinSub+  msubin      <- getBuiltinName builtinSubIn+  mid         <- getBuiltinName builtinId+  mconid      <- getBuiltinName builtinConId++  istcbuiltin <- do+    builtins <- mapM getBuiltinName+      [ builtinAgdaTCMReturn+      , builtinAgdaTCMBind+      , builtinAgdaTCMUnify+      , builtinAgdaTCMTypeError+      , builtinAgdaTCMInferType+      , builtinAgdaTCMCheckType+      , builtinAgdaTCMNormalise+      , builtinAgdaTCMReduce+      , builtinAgdaTCMCatchError+      , builtinAgdaTCMQuoteTerm+      , builtinAgdaTCMUnquoteTerm+      , builtinAgdaTCMQuoteOmegaTerm+      , builtinAgdaTCMGetContext+      , builtinAgdaTCMExtendContext+      , builtinAgdaTCMInContext+      , builtinAgdaTCMFreshName+      , builtinAgdaTCMDeclareDef+      , builtinAgdaTCMDeclarePostulate+      , builtinAgdaTCMDefineFun+      , builtinAgdaTCMGetType+      , builtinAgdaTCMGetDefinition+      , builtinAgdaTCMBlockOnMeta+      , builtinAgdaTCMCommit+      , builtinAgdaTCMIsMacro+      , builtinAgdaTCMWithNormalisation+      , builtinAgdaTCMWithReconsParams+      , builtinAgdaTCMDebugPrint+      , builtinAgdaTCMOnlyReduceDefs+      , builtinAgdaTCMDontReduceDefs+      , builtinAgdaTCMNoConstraints+      , builtinAgdaTCMRunSpeculative+      , builtinAgdaTCMExec+      ]+    return $+      flip HashSet.member $+      HashSet.fromList $+      catMaybes builtins++  return $ GHCEnv+    { ghcEnvOpts        = ghcOpts+    , ghcEnvBool        = mbool+    , ghcEnvTrue        = mtrue+    , ghcEnvFalse       = mfalse+    , ghcEnvMaybe       = mmaybe+    , ghcEnvNothing     = mnothing+    , ghcEnvJust        = mjust+    , ghcEnvList        = mlist+    , ghcEnvNil         = mnil+    , ghcEnvCons        = mcons+    , ghcEnvNat         = mnat+    , ghcEnvInteger     = minteger+    , ghcEnvWord64      = mword64+    , ghcEnvInf         = minf+    , ghcEnvSharp       = msharp+    , ghcEnvFlat        = mflat+    , ghcEnvInterval    = minterval+    , ghcEnvIZero       = mizero+    , ghcEnvIOne        = mione+    , ghcEnvIsOne       = misone+    , ghcEnvItIsOne     = mitisone+    , ghcEnvIsOne1      = misone1+    , ghcEnvIsOne2      = misone2+    , ghcEnvIsOneEmpty  = misoneempty+    , ghcEnvPathP       = mpathp+    , ghcEnvSub         = msub+    , ghcEnvSubIn       = msubin+    , ghcEnvId          = mid+    , ghcEnvConId       = mconid+    , ghcEnvIsTCBuiltin = istcbuiltin+    }++ghcPostCompile :: GHCEnv -> IsMain -> Map ModuleName GHCModule -> TCM () ghcPostCompile _cenv _isMain mods = do   -- FIXME: @curMName@ and @curIF@ are evil TCM state, but there does not appear to be   --------- another way to retrieve the compilation root ("main" module or interaction focused).@@ -224,13 +328,20 @@ --- Module compilation ---  ghcPreModule-  :: GHCCompileEnv+  :: GHCEnv   -> IsMain      -- ^ Are we looking at the main module?   -> ModuleName   -> Maybe FilePath    -- ^ Path to the @.agdai@ file.   -> TCM (Recompile GHCModuleEnv GHCModule)                  -- ^ Could we confirm the existence of a main function?-ghcPreModule cenv isMain m mifile = ifM uptodate noComp yesComp+ghcPreModule cenv isMain m mifile =+  (do let check = ifM uptodate noComp yesComp+      cubical <- optCubical <$> pragmaOptions+      case cubical of+        -- Code that uses --cubical is not compiled.+        Just CFull   -> noComp+        Just CErased -> check+        Nothing      -> check)     `runReaderT` GHCModuleEnv cenv (HsModuleEnv m (isMain == IsMain))   where     uptodate = case mifile of@@ -253,7 +364,7 @@       asks Recompile  ghcPostModule-  :: GHCCompileEnv+  :: GHCEnv   -> GHCModuleEnv   -> IsMain        -- ^ Are we looking at the main module?   -> ModuleName@@ -285,9 +396,10 @@    return $ GHCModule menv mainDefs -ghcCompileDef :: GHCCompileEnv -> GHCModuleEnv -> IsMain -> Definition -> TCM GHCDefinition+ghcCompileDef :: GHCEnv -> GHCModuleEnv -> IsMain -> Definition -> TCM GHCDefinition ghcCompileDef _cenv menv _isMain def = do-  ((usesFloat, decls, mainFuncDef), (HsCompileState imps)) <- definition def `runHsCompileT` ghcModHsModuleEnv menv+  ((usesFloat, decls, mainFuncDef), (HsCompileState imps)) <-+    definition def `runHsCompileT` menv   return $ GHCDefinition usesFloat decls def (checkedMainDef <$> mainFuncDef) imps  -- | We do not erase types that have a 'HsData' pragma.@@ -365,14 +477,11 @@ definition def@Defn{defName = q, defType = ty, theDef = d} = do   reportSDoc "compile.ghc.definition" 10 $ vcat     [ ("Compiling" <+> prettyTCM q) <> ":"-    , nest 2 $ text (prettyShow d)+    , nest 2 $ pretty d     ]   pragma <- liftTCM $ getHaskellPragma q-  mbool  <- getBuiltinName builtinBool-  mlist  <- getBuiltinName builtinList-  mmaybe <- getBuiltinName builtinMaybe-  minf   <- getBuiltinName builtinInf-  mflat  <- getBuiltinName builtinFlat+  env <- askGHCEnv+  let is p = Just q == p env   typeCheckedMainDef <- checkTypeOfMain def   let mainDecl = maybeToList $ checkedMainDecl <$> typeCheckedMainDef   let retDecls ds = return (mempty, ds)@@ -380,7 +489,7 @@     case d of        _ | Just (HsDefn r hs) <- pragma -> setCurrentRange r $-          if Just q == mflat+          if is ghcEnvFlat           then genericError                 "\"COMPILE GHC\" pragmas are not allowed for the FLAT builtin."           else do@@ -396,60 +505,192 @@             retDecls $ fbWithType hsty (fakeExp hs)        -- Compiling Bool-      Datatype{} | Just q == mbool -> do+      Datatype{} | is ghcEnvBool -> do         _ <- sequence_ [primTrue, primFalse] -- Just to get the proper error for missing TRUE/FALSE-        let d = unqhname "d" q+        let d = dname q         Just true  <- getBuiltinName builtinTrue         Just false <- getBuiltinName builtinFalse-        cs <- mapM compiledcondecl [false, true]+        cs <- mapM (compiledcondecl Nothing) [false, true]         retDecls $ [ compiledTypeSynonym q "Bool" 0                    , HS.FunBind [HS.Match d [] (HS.UnGuardedRhs HS.unit_con) emptyBinds] ] ++                    cs        -- Compiling List-      Datatype{ dataPars = np } | Just q == mlist -> do+      Datatype{ dataPars = np } | is ghcEnvList -> do         _ <- sequence_ [primNil, primCons] -- Just to get the proper error for missing NIL/CONS         caseMaybe pragma (return ()) $ \ p -> setCurrentRange p $ warning . GenericWarning =<< do           fsep $ pwords "Ignoring GHC pragma for builtin lists; they always compile to Haskell lists."-        let d = unqhname "d" q-            t = unqhname "T" q+        let d = dname q+            t = unqhname TypeK q         Just nil  <- getBuiltinName builtinNil         Just cons <- getBuiltinName builtinCons-        let vars f n = map (f . ihname "a") [0 .. n - 1]-        cs <- mapM compiledcondecl [nil, cons]+        let vars f n = map (f . ihname A) [0 .. n - 1]+        cs <- mapM (compiledcondecl Nothing) [nil, cons]         retDecls $ [ HS.TypeDecl t (vars HS.UnkindedVar (np - 1)) (HS.FakeType "[]")                    , HS.FunBind [HS.Match d (vars HS.PVar np) (HS.UnGuardedRhs HS.unit_con) emptyBinds] ] ++                    cs        -- Compiling Maybe-      Datatype{ dataPars = np } | Just q == mmaybe -> do+      Datatype{ dataPars = np } | is ghcEnvMaybe -> do         _ <- sequence_ [primNothing, primJust] -- Just to get the proper error for missing NOTHING/JUST         caseMaybe pragma (return ()) $ \ p -> setCurrentRange p $ warning . GenericWarning =<< do           fsep $ pwords "Ignoring GHC pragma for builtin maybe; they always compile to Haskell lists."-        let d = unqhname "d" q-            t = unqhname "T" q+        let d = dname q+            t = unqhname TypeK q         Just nothing <- getBuiltinName builtinNothing         Just just    <- getBuiltinName builtinJust-        let vars f n = map (f . ihname "a") [0 .. n - 1]-        cs <- mapM compiledcondecl [nothing, just]+        let vars f n = map (f . ihname A) [0 .. n - 1]+        cs <- mapM (compiledcondecl Nothing) [nothing, just]         retDecls $ [ HS.TypeDecl t (vars HS.UnkindedVar (np - 1)) (HS.FakeType "Maybe")                    , HS.FunBind [HS.Match d (vars HS.PVar np) (HS.UnGuardedRhs HS.unit_con) emptyBinds] ] ++                    cs        -- Compiling Inf-      _ | Just q == minf -> do+      _ | is ghcEnvInf -> do         _ <- primSharp -- To get a proper error for missing SHARP.         Just sharp <- getBuiltinName builtinSharp-        sharpC     <- compiledcondecl sharp-        let d   = unqhname "d" q+        sharpC     <- (compiledcondecl Nothing) sharp+        let d   = dname q             err = "No term-level implementation of the INFINITY builtin."         retDecls $ [ compiledTypeSynonym q "MAlonzo.RTE.Infinity" 2-                   , HS.FunBind [HS.Match d [HS.PVar (ihname "a" 0)]+                   , HS.FunBind [HS.Match d [HS.PVar (ihname A 0)]                        (HS.UnGuardedRhs (HS.FakeExp ("error " ++ show err)))                        emptyBinds]                    , sharpC                    ] +      -- The interval is compiled as the type of booleans: 0 is+      -- compiled as False and 1 as True.+      Axiom{} | is ghcEnvInterval -> do+        _       <- sequence_ [primIZero, primIOne]+        Just i0 <- getBuiltinName builtinIZero+        Just i1 <- getBuiltinName builtinIOne+        cs      <- mapM (compiledcondecl (Just 0)) [i0, i1]+        retDecls $+          [ compiledTypeSynonym q "Bool" 0+          , HS.FunBind+              [HS.Match (dname q) []+                 (HS.UnGuardedRhs HS.unit_con) emptyBinds]+          ] +++          cs++      -- IsOne is compiled as the constant function to the unit type.+      -- Partial/PartialP are compiled as functions from the unit type+      -- to the underlying type.+      Axiom{} | is ghcEnvIsOne -> do+        retDecls $+          [ HS.TypeDecl (unqhname TypeK q) [HS.UnkindedVar (ihname A 0)]+              (HS.FakeType "()")+          , HS.FunBind+              [HS.Match (dname q) []+                 (HS.UnGuardedRhs HS.unit_con) emptyBinds]+          ]++      -- itIsOne.+      Axiom{} | is ghcEnvItIsOne -> do+        retDecls $+          [ HS.FunBind+              [HS.Match (dname q) []+                 (HS.UnGuardedRhs HS.unit_con) emptyBinds]+          ]++      -- IsOne1/IsOne2.+      Axiom{} | is ghcEnvIsOne1 || is ghcEnvIsOne2 -> do+        retDecls $+          [ HS.FunBind+              [HS.Match (dname q) []+                 (HS.UnGuardedRhs (HS.FakeExp "\\_ _ _ -> ()"))+                 emptyBinds]+          ]++      -- isOneEmpty.+      Axiom{} | is ghcEnvIsOneEmpty -> do+        retDecls $+          [ HS.FunBind+              [HS.Match (dname q) []+                 (HS.UnGuardedRhs (HS.FakeExp "\\_ x _ -> x ()"))+                 emptyBinds]+          ]++      -- PathP is compiled as a function from the interval (booleans)+      -- to the underlying type.+      Axiom{} | is ghcEnvPathP -> do+        _        <- sequence_ [primInterval]+        Just int <- getBuiltinName builtinInterval+        int      <- xhqn TypeK int+        retDecls $+          [ HS.TypeDecl (unqhname TypeK q)+              [HS.UnkindedVar (ihname A i) | i <- [0..3]]+              (HS.TyFun (HS.TyCon int) mazAnyType)+          , HS.FunBind+              [HS.Match (dname q) []+                 (HS.UnGuardedRhs (HS.FakeExp "\\_ _ _ _ -> ()"))+                 emptyBinds]+          ]++      -- Sub is compiled as the underlying type.+      Axiom{} | is ghcEnvSub -> do+        retDecls $+          [ HS.TypeDecl (unqhname TypeK q)+              [HS.UnkindedVar (ihname A i) | i <- [0..3]]+              (HS.TyVar (ihname A 1))+          , HS.FunBind+              [HS.Match (dname q) []+                 (HS.UnGuardedRhs (HS.FakeExp "\\_ _ _ _ -> ()"))+                 emptyBinds]+          ]++      -- subIn.+      Axiom{} | is ghcEnvSubIn -> do+        retDecls $+          [ HS.FunBind+              [HS.Match (dname q) []+                 (HS.UnGuardedRhs (HS.FakeExp "\\_ _ _ x -> x"))+                 emptyBinds]+          ]++      -- Id x y is compiled as a pair of a boolean and whatever+      -- Path x y is compiled to.+      Axiom{} | is ghcEnvId -> do+        _        <- sequence_ [primInterval]+        Just int <- getBuiltinName builtinInterval+        int      <- xhqn TypeK int+        retDecls $+          [ HS.TypeDecl (unqhname TypeK q)+              [HS.UnkindedVar (ihname A i) | i <- [0..3]]+              (HS.TyApp (HS.FakeType "(,) Bool")+                 (HS.TyFun (HS.TyCon int) mazAnyType))+          , HS.FunBind+              [HS.Match (dname q) []+                 (HS.UnGuardedRhs (HS.FakeExp "\\_ _ _ _ -> ()"))+                 emptyBinds]+          ]++      -- conid.+      Axiom{} | is ghcEnvConId -> do+        strict <- optGhcStrictData <$> askGhcOpts+        let var = (if strict then HS.PBangPat else id) . HS.PVar+        retDecls $+          [ HS.FunBind+              [HS.Match (dname q)+                 [ var (ihname A i) | i <- [0..1] ]+                 (HS.UnGuardedRhs $+                  HS.App (HS.App (HS.FakeExp "(,)")+                            (HS.Var (HS.UnQual (ihname A 0))))+                    (HS.Var (HS.UnQual (ihname A 1))))+                 emptyBinds]+          ]++      -- TC builtins are compiled to erased, which is an ∞-ary+      -- function.+      Axiom{} | ghcEnvIsTCBuiltin env q -> do+        retDecls $+          [ HS.FunBind+              [HS.Match (dname q) []+                 (HS.UnGuardedRhs (HS.FakeExp mazErasedName))+                 emptyBinds]+          ]+       DataOrRecSig{} -> __IMPOSSIBLE__        Axiom{} -> do@@ -462,19 +703,16 @@        Function{} -> function pragma $ functionViaTreeless q -      Datatype{ dataPathCons = _ : _ } -> do-        s <- render <$> prettyTCM q-        typeError $ NotImplemented $-          "Higher inductive types (" ++ s ++ ")"--      Datatype{ dataPars = np, dataIxs = ni, dataClause = cl }-        | Just hsdata@(HsData r ty hsCons) <- pragma -> setCurrentRange r $ do+      Datatype{ dataPars = np, dataIxs = ni, dataClause = cl+              , dataPathCons = pcs+              } | Just hsdata@(HsData r ty hsCons) <- pragma ->+        setCurrentRange r $ do         reportSDoc "compile.ghc.definition" 40 $ hsep $           [ "Compiling data type with COMPILE pragma ...", pretty hsdata ]         liftTCM $ computeErasedConstructorArgs q         cs <- liftTCM $ getNotErasedConstructors q         ccscov <- constructorCoverageCode q (np + ni) cs ty hsCons-        cds <- mapM compiledcondecl cs+        cds <- mapM (compiledcondecl Nothing) cs         let result = concat $               [ tvaldecl q Inductive (np + ni) [] (Just __IMPOSSIBLE__)               , [ compiledTypeSynonym q ty np ]@@ -482,7 +720,9 @@               , ccscov               ]         retDecls result-      Datatype{ dataPars = np, dataIxs = ni, dataClause = cl } -> do+      Datatype{ dataPars = np, dataIxs = ni, dataClause = cl+              , dataPathCons = pcs+              } -> do         liftTCM $ computeErasedConstructorArgs q         cs <- liftTCM $ getNotErasedConstructors q         cds <- mapM (flip condecl Inductive) cs@@ -499,7 +739,7 @@             let cs = [conName con]             liftTCM $ computeErasedConstructorArgs q             ccscov <- constructorCoverageCode q np cs ty hsCons-            cds <- mapM compiledcondecl cs+            cds <- mapM (compiledcondecl Nothing) cs             retDecls $               tvaldecl q inductionKind np [] (Just __IMPOSSIBLE__) ++               [compiledTypeSynonym q ty np] ++ cds ++ ccscov@@ -511,12 +751,11 @@   where   function :: Maybe HaskellPragma -> HsCompileM (UsesFloat, [HS.Decl]) -> HsCompileM (UsesFloat, [HS.Decl])   function mhe fun = do-    (imp, defs) <- fun-    let ccls = mkwhere defs-    mflat <- getBuiltinName builtinFlat+    (imp, ccls) <- fun     case mhe of-      Just (HsExport r name) -> setCurrentRange r $-        if Just q == mflat+      Just (HsExport r name) -> setCurrentRange r $ do+        env <- askGHCEnv+        if Just q == ghcEnvFlat env         then genericError               "\"COMPILE GHC as\" pragmas are not allowed for the FLAT builtin."         else do@@ -530,59 +769,57 @@       _ -> return (imp, ccls)    functionViaTreeless :: QName -> HsCompileM (UsesFloat, [HS.Decl])-  functionViaTreeless q = caseMaybeM (liftTCM $ toTreeless LazyEvaluation q) (pure mempty) $ \ treeless -> do--    used <- fromMaybe [] <$> getCompiledArgUse q-    let dostrip = ArgUnused `elem` used--    -- Compute the type approximation-    def <- getConstInfo q-    (argTypes0, resType) <- hsTelApproximation $ defType def-    let pars = case theDef def of-                 Function{ funProjection = Just Projection{ projIndex = i } } | i > 0 -> i - 1-                 _ -> 0-        argTypes  = drop pars argTypes0-        argTypesS = filterUsed used argTypes+  functionViaTreeless q = do+    strict <- optGhcStrict <$> askGhcOpts+    let eval = if strict then EagerEvaluation else LazyEvaluation+    caseMaybeM (liftTCM $ toTreeless eval q) (pure mempty) $ \ treeless -> do -    (e, useFloat) <- if dostrip then closedTerm (stripUnusedArguments used treeless)-                                else closedTerm treeless-    let (ps, b) = lamView e-        lamView e =-          case e of-            HS.Lambda ps b -> (ps, b)-            b              -> ([], b)+      used <- fromMaybe [] <$> getCompiledArgUse q+      let dostrip = ArgUnused `elem` used -        tydecl  f ts t = HS.TypeSig [f] (foldr HS.TyFun t ts)-        funbind f ps b = HS.FunBind [HS.Match f ps (HS.UnGuardedRhs b) emptyBinds]-        tyfunbind f ts t ps b =-          let ts' = ts ++ (replicate (length ps - length ts) mazAnyType)-          in [tydecl f ts' t, funbind f ps b]+      -- Compute the type approximation+      def <- getConstInfo q+      (argTypes0, resType) <- hsTelApproximation $ defType def+      let pars = case theDef def of+                   Function{ funProjection = Just Projection{ projIndex = i } } | i > 0 -> i - 1+                   _ -> 0+          argTypes  = drop pars argTypes0+          argTypesS = filterUsed used argTypes -    -- The definition of the non-stripped function-    (ps0, _) <- lamView <$> closedTerm_ (foldr ($) T.TErased $ replicate (length used) T.TLam)-    let b0 = foldl HS.App (hsVarUQ $ duname q) [ hsVarUQ x | (~(HS.PVar x), ArgUsed) <- zip ps0 used ]+      (e, useFloat) <- if dostrip then closedTerm (stripUnusedArguments used treeless)+                                  else closedTerm treeless+      let (ps, b) = lamView e+          lamView e =+            case e of+              HS.Lambda ps b -> (ps, b)+              b              -> ([], b) -    return (useFloat,-            if dostrip-              then tyfunbind (dname q) argTypes resType ps0 b0 ++-                   tyfunbind (duname q) argTypesS resType ps b-              else tyfunbind (dname q) argTypes resType ps b)+          tydecl  f ts t = HS.TypeSig [f] (foldr HS.TyFun t ts)+          funbind f ps b = HS.FunBind [HS.Match f ps (HS.UnGuardedRhs b) emptyBinds]+          tyfunbind f ts t ps b =+            let ts' = ts ++ (replicate (length ps - length ts) mazAnyType)+            in [tydecl f ts' t, funbind f ps b] -  mkwhere :: [HS.Decl] -> [HS.Decl]-  mkwhere (HS.FunBind [m0, HS.Match dn ps rhs emptyBinds] : fbs@(_:_)) =-          [HS.FunBind [m0, HS.Match dn ps rhs bindsAux]]-    where-    bindsAux :: Maybe HS.Binds-    bindsAux = Just $ HS.BDecls fbs+      -- The definition of the non-stripped function+      (ps0, _) <- lamView <$> closedTerm_ (foldr ($) T.TErased $ replicate (length used) T.TLam)+      let b0 = foldl HS.App (hsVarUQ $ duname q) [ hsVarUQ x | (~(HS.PVar x), ArgUsed) <- zip ps0 used ]+          ps0' = zipWith (\p u -> case u of+                                    ArgUsed   -> p+                                    ArgUnused -> HS.PIrrPat p)+                   ps0 used -  mkwhere fbs = fbs+      return (useFloat,+              if dostrip+                then tyfunbind (dname q) argTypes resType ps0' b0 +++                     tyfunbind (duname q) argTypesS resType ps b+                else tyfunbind (dname q) argTypes resType ps b)    fbWithType :: HS.Type -> HS.Exp -> [HS.Decl]   fbWithType ty e =-    HS.TypeSig [unqhname "d" q] ty : fb e+    HS.TypeSig [dname q] ty : fb e    fb :: HS.Exp -> [HS.Decl]-  fb e  = [HS.FunBind [HS.Match (unqhname "d" q) []+  fb e  = [HS.FunBind [HS.Match (dname q) []                                 (HS.UnGuardedRhs e) emptyBinds]]    axiomErr :: HS.Exp@@ -615,7 +852,7 @@ -- | Initial environment for expression generation. initCCEnv :: CCEnv initCCEnv = CCEnv-  { _ccNameSupply = map (ihname "v") [0..]  -- DON'T CHANGE THESE NAMES!+  { _ccNameSupply = map (ihname V) [0..]  -- DON'T CHANGE THESE NAMES!   , _ccContext    = []   } @@ -646,8 +883,8 @@ checkConstructorType :: QName -> HaskellCode -> HsCompileM [HS.Decl] checkConstructorType q hs = do   ty <- haskellType q-  return [ HS.TypeSig [unqhname "check" q] ty-         , HS.FunBind [HS.Match (unqhname "check" q) []+  return [ HS.TypeSig [unqhname CheckK q] ty+         , HS.FunBind [HS.Match (unqhname CheckK q) []                                 (HS.UnGuardedRhs $ fakeExp hs) emptyBinds]          ] @@ -662,8 +899,8 @@   cs <- zipWithM makeClause cs hsCons   let rhs = HS.Case (HS.Var $ HS.UnQual $ HS.Ident "x") cs -  return [ HS.TypeSig [unqhname "cover" q] $ fakeType $ unwords (ty : tvs) ++ " -> ()"-         , HS.FunBind [HS.Match (unqhname "cover" q) [HS.PVar $ HS.Ident "x"]+  return [ HS.TypeSig [unqhname CoverK q] $ fakeType $ unwords (ty : tvs) ++ " -> ()"+         , HS.FunBind [HS.Match (unqhname CoverK q) [HS.PVar $ HS.Ident "x"]                                 (HS.UnGuardedRhs rhs) emptyBinds]          ] @@ -678,10 +915,9 @@ -- Translate case on bool to if mkIf :: T.TTerm -> CC T.TTerm mkIf t@(TCase e _ d [TACon c1 0 b1, TACon c2 0 b2]) | T.isUnreachable d = do-  mTrue  <- liftCC $ getBuiltinName builtinTrue-  mFalse <- liftCC $ getBuiltinName builtinFalse-  let isTrue  c = Just c == mTrue-      isFalse c = Just c == mFalse+  env <- liftCC askGHCEnv+  let isTrue  c = Just c == ghcEnvTrue  env+      isFalse c = Just c == ghcEnvFalse env   if | isTrue c1, isFalse c2 -> return $ T.tIfThenElse (TCoerce $ TVar e) b1 b2      | isTrue c2, isFalse c1 -> return $ T.tIfThenElse (TCoerce $ TVar e) b2 b1      | otherwise             -> return t@@ -708,14 +944,16 @@           missing = drop given used       if not isCompiled && ArgUnused `elem` used         then if ArgUnused `elem` missing then term (etaExpand (needed - given) tm0) else do-          f <- liftCC $ HS.Var <$> xhqn "du" f  -- use stripped function+          f <- liftCC $ HS.Var <$> xhqn (FunK NoUnused) f+                                   -- use stripped function           -- Andreas, 2019-11-07, issue #4169.           -- Insert coercion unconditionally as erasure of arguments           -- that are matched upon might remove the unfolding of codomain types.           -- (Hard to explain, see test/Compiler/simple/Issue4169.)           hsCoerce f `apps` filterUsed used ts         else do-          f <- liftCC $ HS.Var <$> xhqn "d" f  -- use original (non-stripped) function+          f <- liftCC $ HS.Var <$> xhqn (FunK PossiblyUnused) f+                                   -- use original (non-stripped) function           coe f `apps` ts      (T.TCon c, ts) -> do@@ -781,12 +1019,13 @@     T.TACon {T.aCon = c} -> do       intros (T.aArity a) $ \ xs -> do         erased <- liftCC $ getErasedConArgs c-        nil  <- liftCC $ getBuiltinName builtinNil-        cons <- liftCC $ getBuiltinName builtinCons+        env    <- liftCC askGHCEnv         hConNm <--          if | Just c == nil  -> return $ HS.UnQual $ HS.Ident "[]"-             | Just c == cons -> return $ HS.UnQual $ HS.Symbol ":"-             | otherwise      -> liftCC $ conhqn c+          if | Just c == ghcEnvNil env ->+               return $ HS.UnQual $ HS.Ident "[]"+             | Just c == ghcEnvCons env ->+               return $ HS.UnQual $ HS.Symbol ":"+             | otherwise -> liftCC $ conhqn c         mkAlt (HS.PApp hConNm $ [HS.PVar x | (x, False) <- zip xs erased])     T.TAGuard g b -> do       g <- term g@@ -892,29 +1131,38 @@  condecl :: QName -> Induction -> HsCompileM HS.ConDecl condecl q _ind = do+  opts <- askGhcOpts   def <- getConstInfo q   let Constructor{ conPars = np, conErased = erased } = theDef def   (argTypes0, _) <- hsTelApproximation (defType def)-  let argTypes   = [ (Just HS.Lazy, t)-                     -- Currently all constructors are lazy.+  let strict     = if conInd (theDef def) == Inductive &&+                      optGhcStrictData opts+                   then HS.Strict+                   else HS.Lazy+      argTypes   = [ (Just strict, t)                    | (t, False) <- zip (drop np argTypes0)                                        (fromMaybe [] erased ++ repeat False)                    ]-  return $ HS.ConDecl (unqhname "C" q) argTypes+  return $ HS.ConDecl (unqhname ConK q) argTypes -compiledcondecl :: QName -> HsCompileM HS.Decl-compiledcondecl q = do-  ar <- liftTCM $ erasedArity q-  hsCon <- liftTCM $ fromMaybe __IMPOSSIBLE__ <$> getHaskellConstructor q-  let patVars = map (HS.PVar . ihname "a") [0 .. ar - 1]-  return $ HS.PatSyn (HS.PApp (HS.UnQual $ unqhname "C" q) patVars) (HS.PApp (hsName hsCon) patVars)+compiledcondecl+  :: Maybe Nat  -- ^ The constructor's arity (after erasure).+  -> QName -> HsCompileM HS.Decl+compiledcondecl mar q = do+  ar <- case mar of+    Nothing -> liftTCM $ erasedArity q+    Just ar -> return ar+  hsCon <- fromMaybe __IMPOSSIBLE__ <$> getHaskellConstructor q+  let patVars = map (HS.PVar . ihname A) [0 .. ar - 1]+  return $ HS.PatSyn (HS.PApp (HS.UnQual $ unqhname ConK q) patVars)+             (HS.PApp (hsName hsCon) patVars)  compiledTypeSynonym :: QName -> String -> Nat -> HS.Decl compiledTypeSynonym q hsT arity =-  HS.TypeDecl (unqhname "T" q) (map HS.UnkindedVar vs)+  HS.TypeDecl (unqhname TypeK q) (map HS.UnkindedVar vs)               (foldl HS.TyApp (HS.FakeType hsT) $ map HS.TyVar vs)   where-    vs = [ ihname "a" i | i <- [0 .. arity - 1]]+    vs = [ ihname A i | i <- [0 .. arity - 1]]  tvaldecl :: QName          -> Induction@@ -925,8 +1173,8 @@   maybe [HS.DataDecl kind tn [] cds' []]         (const []) cl   where-  (tn, vn) = (unqhname "T" q, unqhname "d" q)-  pvs = [ HS.PVar        $ ihname "a" i | i <- [0 .. npar - 1]]+  (tn, vn) = (unqhname TypeK q, dname q)+  pvs = [ HS.PVar $ ihname A i | i <- [0 .. npar - 1]]    -- Inductive data types consisting of a single constructor with a   -- single argument are translated into newtypes.@@ -939,8 +1187,7 @@  infodecl :: QName -> [HS.Decl] -> [HS.Decl] infodecl _ [] = []-infodecl q ds =-  fakeD (unqhname "name" q) (haskellStringLiteral $ prettyShow q) : ds+infodecl q ds = HS.Comment (prettyShow q) : ds  -------------------------------------------------- -- Writing out a haskell module@@ -959,19 +1206,33 @@ writeModule (HS.Module m ps imp ds) = do   -- Note that GHC assumes that sources use ASCII or UTF-8.   out <- snd <$> outFileAndDir m+  strict <- optGhcStrict <$> askGhcOpts+  let p = HS.LanguagePragma $ List.map HS.Ident $+            [ "BangPatterns"+            , "EmptyDataDecls"+            , "EmptyCase"+            , "ExistentialQuantification"+            , "ScopedTypeVariables"+            , "NoMonomorphismRestriction"+            , "RankNTypes"+            , "PatternSynonyms"+            , "OverloadedStrings"+            ] +++            -- If --ghc-strict is used, then the language extension+            -- QualifiedDo is activated. At the time of writing no+            -- code is generated that depends on this extension+            -- (except for the pragmas), but --ghc-strict is broken+            -- with at least some versions of GHC prior to version 9,+            -- and QualifiedDo was introduced with GHC 9.+            if strict+            then ["QualifiedDo"]+            else []   liftIO $ UTF8.writeFile out $ (++ "\n") $ prettyPrint $+    -- TODO: It might make sense to skip bang patterns for the unused+    -- arguments of the "non-stripped" functions.+    (if strict then makeStrict else id) $     HS.Module m (p : ps) imp ds   where-  p = HS.LanguagePragma $ List.map HS.Ident $-        [ "EmptyDataDecls"-        , "EmptyCase"-        , "ExistentialQuantification"-        , "ScopedTypeVariables"-        , "NoMonomorphismRestriction"-        , "RankNTypes"-        , "PatternSynonyms"-        , "OverloadedStrings"-        ]  outFileAndDir :: MonadGHCIO m => HS.ModuleName -> m (FilePath, FilePath) outFileAndDir m = do@@ -985,10 +1246,10 @@   where   repldot c = List.map $ \ c' -> if c' == '.' then c else c' -curOutFileAndDir :: (MonadGHCIO m, ReadHsModuleEnv m) => m (FilePath, FilePath)+curOutFileAndDir :: (MonadGHCIO m, ReadGHCModuleEnv m) => m (FilePath, FilePath) curOutFileAndDir = outFileAndDir =<< curHsMod -curOutFile :: (MonadGHCIO m, ReadHsModuleEnv m) => m FilePath+curOutFile :: (MonadGHCIO m, ReadGHCModuleEnv m) => m FilePath curOutFile = snd <$> curOutFileAndDir  callGHC :: ReaderT GHCModule TCM ()
src/full/Agda/Compiler/MAlonzo/HaskellTypes.hs view
@@ -20,7 +20,6 @@ import Agda.Syntax.Internal import Agda.TypeChecking.Monad import Agda.TypeChecking.Pretty-import Agda.TypeChecking.Primitive (getBuiltinName) import Agda.TypeChecking.Reduce import Agda.TypeChecking.Substitute import Agda.TypeChecking.Free@@ -32,6 +31,7 @@  import qualified Agda.Utils.Haskell.Syntax as HS import Agda.Utils.List+import Agda.Utils.Monad import Agda.Utils.Null import Agda.Utils.Pretty (prettyShow) @@ -65,6 +65,7 @@             | BadLambda Term             | BadMeta Term             | BadDontCare Term+            | NotCompiled QName  type ToHs = ExceptT WhyNot HsCompileM @@ -77,12 +78,15 @@     reason (BadLambda        v) = pwords "the lambda term" ++ [prettyTCM v <> "."]     reason (BadMeta          v) = pwords "a meta variable" ++ [prettyTCM v <> "."]     reason (BadDontCare      v) = pwords "an erased term" ++ [prettyTCM v <> "."]+    reason (NotCompiled      x) = pwords "a name that is not compiled"+                                  ++ [parens (prettyTCM x) <> "."]     reason (NoPragmaFor      x) = prettyTCM x : pwords "which does not have a COMPILE pragma."     reason (WrongPragmaFor _ x) = prettyTCM x : pwords "which has the wrong kind of COMPILE pragma."      possibleFix BadLambda{}     = empty     possibleFix BadMeta{}       = empty     possibleFix BadDontCare{}   = empty+    possibleFix NotCompiled{}   = empty     possibleFix (NoPragmaFor d) = suggestPragma d $ "add a pragma"     possibleFix (WrongPragmaFor r d) = suggestPragma d $       sep [ "replace the value-level pragma at", nest 2 $ pretty r, "by" ]@@ -113,37 +117,52 @@  getHsType :: QName -> ToHs HS.Type getHsType x = do-  d <- liftTCM $ getHaskellPragma x-  list <- liftTCM $ getBuiltinName builtinList-  mayb <- liftTCM $ getBuiltinName builtinMaybe-  inf  <- liftTCM $ getBuiltinName builtinInf-  let namedType = do+  unlessM (isCompiled x) $ throwError $ NotCompiled x++  d   <- liftTCM $ getHaskellPragma x+  env <- askGHCEnv+  let is t p = Just t == p env++      namedType = do         -- For these builtin types, the type name (xhqn ...) refers to the         -- generated, but unused, datatype and not the primitive type.-        nat  <- getBuiltinName builtinNat-        int  <- getBuiltinName builtinInteger-        bool <- getBuiltinName builtinBool-        if  | Just x `elem` [nat, int] -> return $ hsCon "Integer"-            | Just x == bool           -> return $ hsCon "Bool"-            | otherwise                -> lift $ hsCon . prettyShow <$> xhqn "T" x+        if  | x `is` ghcEnvNat ||+              x `is` ghcEnvInteger -> return $ hsCon "Integer"+            | x `is` ghcEnvBool    -> return $ hsCon "Bool"+            | otherwise            ->+              lift $ hsCon . prettyShow <$> xhqn TypeK x   mapExceptT (setCurrentRange d) $ case d of-    _ | Just x == list -> lift $ hsCon . prettyShow <$> xhqn "T" x -- we ignore Haskell pragmas for List-    _ | Just x == mayb -> lift $ hsCon . prettyShow <$> xhqn "T" x -- we ignore Haskell pragmas for Maybe-    _ | Just x == inf  -> return $ hsQCon "MAlonzo.RTE" "Infinity"+    _ | x `is` ghcEnvList ->+        lift $ hsCon . prettyShow <$> xhqn TypeK x+        -- we ignore Haskell pragmas for List+    _ | x `is` ghcEnvMaybe ->+        lift $ hsCon . prettyShow <$> xhqn TypeK x+        -- we ignore Haskell pragmas for Maybe+    _ | x `is` ghcEnvInf ->+        return $ hsQCon "MAlonzo.RTE" "Infinity"     Just HsDefn{}      -> throwError $ WrongPragmaFor (getRange d) x     Just HsType{}      -> namedType     Just HsData{}      -> namedType     _                  -> throwError $ NoPragmaFor x +-- | Is the given thing compiled?++isCompiled :: HasConstInfo m => QName -> m Bool+isCompiled q = usableModality <$> getConstInfo q++-- | Does the name stand for a data or record type?++isData :: HasConstInfo m => QName -> m Bool+isData q = do+  def <- theDef <$> getConstInfo q+  return $ case def of+    Datatype{} -> True+    Record{}   -> True+    _          -> False+ getHsVar :: (MonadFail tcm, MonadTCM tcm) => Nat -> tcm HS.Name-getHsVar i = HS.Ident . encodeName <$> nameOfBV i-  where-    encodeName x = "x" ++ concatMap encode (prettyShow x)-    okChars = ['a'..'z'] ++ ['A'..'Y'] ++ "_'"-    encode 'Z' = "ZZ"-    encode c-      | c `elem` okChars = [c]-      | otherwise        = "Z" ++ show (fromEnum c)+getHsVar i =+  HS.Ident . encodeString (VarK X) . prettyShow <$> nameOfBV i  haskellType' :: Type -> HsCompileM HS.Type haskellType' t = runToHs (unEl t) (fromType t)@@ -227,13 +246,8 @@  hsTypeApproximation :: PolyApprox -> Int -> Type -> HsCompileM HS.Type hsTypeApproximation poly fv t = do-  list <- getBuiltinName builtinList-  mayb <- getBuiltinName builtinMaybe-  bool <- getBuiltinName builtinBool-  int  <- getBuiltinName builtinInteger-  nat  <- getBuiltinName builtinNat-  word <- getBuiltinName builtinWord64-  let is q b = Just q == b+  env <- askGHCEnv+  let is q b = Just q == b env       tyCon  = HS.TyCon . HS.UnQual . HS.Ident       rteCon = HS.TyCon . HS.Qual mazRTE . HS.Ident       tyVar n i = HS.TyVar $ HS.Ident $ "a" ++ show (n - i)@@ -244,24 +258,23 @@           Pi a b -> hsFun <$> go n (unEl $ unDom a) <*> go (n + k) (unEl $ unAbs b)             where k = case b of Abs{} -> 1; NoAbs{} -> 0           Def q els-            | q `is` list, Apply t <- last1 (Proj ProjSystem __IMPOSSIBLE__) els-                        -> HS.TyApp (tyCon "[]") <$> go n (unArg t)-            | q `is` mayb, Apply t <- last1 (Proj ProjSystem __IMPOSSIBLE__) els-                        -> HS.TyApp (tyCon "Maybe") <$> go n (unArg t)-            | q `is` bool -> return $ tyCon "Bool"-            | q `is` int  -> return $ tyCon "Integer"-            | q `is` nat  -> return $ tyCon "Integer"-            | q `is` word -> return $ rteCon "Word64"+            | q `is` ghcEnvList+            , Apply t <- last1 (Proj ProjSystem __IMPOSSIBLE__) els ->+              HS.TyApp (tyCon "[]") <$> go n (unArg t)+            | q `is` ghcEnvMaybe+            , Apply t <- last1 (Proj ProjSystem __IMPOSSIBLE__) els ->+              HS.TyApp (tyCon "Maybe") <$> go n (unArg t)+            | q `is` ghcEnvBool    -> return $ tyCon "Bool"+            | q `is` ghcEnvInteger -> return $ tyCon "Integer"+            | q `is` ghcEnvNat     -> return $ tyCon "Integer"+            | q `is` ghcEnvWord64  -> return $ rteCon "Word64"             | otherwise -> do                 let args = fromMaybe __IMPOSSIBLE__ $ allApplyElims els                 foldl HS.TyApp <$> getHsType' q <*> mapM (go n . unArg) args-              `catchError` \ _ -> do -- Not a Haskell type-                def <- theDef <$> getConstInfo q-                let isData | Datatype{} <- def = True-                           | Record{}   <- def = True-                           | otherwise         = False-                if isData then HS.TyCon <$> xhqn "T" q-                          else return mazAnyType+              `catchError` \ _ -> -- Not a Haskell type+                ifM (and2M (isCompiled q) (isData q))+                  (HS.TyCon <$> xhqn TypeK q)+                  (return mazAnyType)           Sort{} -> return $ HS.FakeType "()"           _ -> return mazAnyType   go fv (unEl t)@@ -275,6 +288,6 @@  hsTelApproximation' :: PolyApprox -> Type -> HsCompileM ([HS.Type], HS.Type) hsTelApproximation' poly t = do-  TelV tel res <- telView t+  TelV tel res <- telViewPath t   let args = map (snd . unDom) (telToList tel)   (,) <$> zipWithM (hsTypeApproximation poly) [0..] args <*> hsTypeApproximation poly (length args) res
src/full/Agda/Compiler/MAlonzo/Misc.hs view
@@ -47,37 +47,105 @@   --   not necessarily whether the GHC module has a `main` function defined.   } --- | Monads that can produce an @HsModuleEnv@-class Monad m => ReadHsModuleEnv m where+-- | The options derived from+-- 'Agda.Compiler.MAlonzo.Compiler.GHCFlags' and other shared options.++data GHCOptions = GHCOptions+  { optGhcCallGhc    :: Bool+  , optGhcBin        :: FilePath+    -- ^ Use the compiler at PATH instead of "ghc"+  , optGhcFlags      :: [String]+  , optGhcCompileDir :: FilePath+  , optGhcStrictData :: Bool+    -- ^ Make inductive constructors strict?+  , optGhcStrict :: Bool+    -- ^ Make functions strict?+  }++-- | A static part of the GHC backend's environment that does not+-- change from module to module.++data GHCEnv = GHCEnv+  { ghcEnvOpts :: GHCOptions+  , ghcEnvBool+  , ghcEnvTrue+  , ghcEnvFalse+  , ghcEnvMaybe+  , ghcEnvNothing+  , ghcEnvJust+  , ghcEnvList+  , ghcEnvNil+  , ghcEnvCons+  , ghcEnvNat+  , ghcEnvInteger+  , ghcEnvWord64+  , ghcEnvInf+  , ghcEnvSharp+  , ghcEnvFlat+  , ghcEnvInterval+  , ghcEnvIZero+  , ghcEnvIOne+  , ghcEnvIsOne+  , ghcEnvItIsOne+  , ghcEnvIsOne1+  , ghcEnvIsOne2+  , ghcEnvIsOneEmpty+  , ghcEnvPathP+  , ghcEnvSub+  , ghcEnvSubIn+  , ghcEnvId+  , ghcEnvConId+    :: Maybe QName+    -- Various (possibly) builtin names.+  , ghcEnvIsTCBuiltin :: QName -> Bool+    -- ^ Is the given name a @TC@ builtin (except for @TC@ itself)?+  }++-- | Module compilation environment, bundling the overall+--   backend session options along with the module's basic+--   readable properties.+data GHCModuleEnv = GHCModuleEnv+  { ghcModEnv         :: GHCEnv+  , ghcModHsModuleEnv :: HsModuleEnv+  }++-- | Monads that can produce a 'GHCModuleEnv'.+class Monad m => ReadGHCModuleEnv m where+  askGHCModuleEnv :: m GHCModuleEnv++  default askGHCModuleEnv+    :: (MonadTrans t, Monad n, m ~ (t n), ReadGHCModuleEnv n)+    => m GHCModuleEnv+  askGHCModuleEnv = lift askGHCModuleEnv+   askHsModuleEnv :: m HsModuleEnv+  askHsModuleEnv = ghcModHsModuleEnv <$> askGHCModuleEnv -  default askHsModuleEnv-    :: (MonadTrans t, Monad n, m ~ (t n), ReadHsModuleEnv n)-    => m HsModuleEnv-  askHsModuleEnv = lift askHsModuleEnv+  askGHCEnv :: m GHCEnv+  askGHCEnv = ghcModEnv <$> askGHCModuleEnv -instance Monad m => ReadHsModuleEnv (ReaderT HsModuleEnv m) where-  askHsModuleEnv = ask+instance Monad m => ReadGHCModuleEnv (ReaderT GHCModuleEnv m) where+  askGHCModuleEnv = ask -instance ReadHsModuleEnv m => ReadHsModuleEnv (ExceptT e m)-instance ReadHsModuleEnv m => ReadHsModuleEnv (IdentityT m)-instance ReadHsModuleEnv m => ReadHsModuleEnv (MaybeT m)-instance ReadHsModuleEnv m => ReadHsModuleEnv (StateT s m)+instance ReadGHCModuleEnv m => ReadGHCModuleEnv (ExceptT e m)+instance ReadGHCModuleEnv m => ReadGHCModuleEnv (IdentityT m)+instance ReadGHCModuleEnv m => ReadGHCModuleEnv (MaybeT m)+instance ReadGHCModuleEnv m => ReadGHCModuleEnv (StateT s m)  newtype HsCompileState = HsCompileState   { mazAccumlatedImports :: Set ModuleName   } deriving (Eq, Semigroup, Monoid)  -- | Transformer adding read-only module info and a writable set of imported modules-type HsCompileT m = ReaderT HsModuleEnv (StateT HsCompileState m)+type HsCompileT m = ReaderT GHCModuleEnv (StateT HsCompileState m)  -- | The default compilation monad is the entire TCM (☹️) enriched with our state and module info type HsCompileM = HsCompileT TCM -runHsCompileT' :: HsCompileT m a -> HsModuleEnv -> HsCompileState -> m (a, HsCompileState)+runHsCompileT' :: HsCompileT m a -> GHCModuleEnv -> HsCompileState -> m (a, HsCompileState) runHsCompileT' t e s = (flip runStateT s) . (flip runReaderT e) $ t -runHsCompileT :: HsCompileT m a -> HsModuleEnv -> m (a, HsCompileState)+runHsCompileT :: HsCompileT m a -> GHCModuleEnv -> m (a, HsCompileState) runHsCompileT t e = runHsCompileT' t e mempty  --------------------------------------------------@@ -87,40 +155,86 @@ -- | Whether the current module is expected to have the `main` function. --   This corresponds to the @IsMain@ flag provided to the backend, --   not necessarily whether the GHC module actually has a `main` function defined.-curIsMainModule :: ReadHsModuleEnv m => m Bool+curIsMainModule :: ReadGHCModuleEnv m => m Bool curIsMainModule = mazIsMainModule <$> askHsModuleEnv  -- | This is the same value as @curMName@, but does not rely on the TCM's state. --   (@curMName@ and co. should be removed, but the current @Backend@ interface --   is not sufficient yet to allow that)-curAgdaMod :: ReadHsModuleEnv m => m ModuleName+curAgdaMod :: ReadGHCModuleEnv m => m ModuleName curAgdaMod = mazModuleName <$> askHsModuleEnv  -- | Get the Haskell module name of the currently-focused Agda module-curHsMod :: ReadHsModuleEnv m => m HS.ModuleName+curHsMod :: ReadGHCModuleEnv m => m HS.ModuleName curHsMod = mazMod <$> curAgdaMod --- The following naming scheme seems to be used:------ * Types coming from Agda are named "T\<number\>".------ * Other definitions coming from Agda are named "d\<number\>".---   Exception: the main function is named "main".+-- | There are two kinds of functions: those definitely without unused+-- arguments, and those that might have unused arguments.++data FunctionKind = NoUnused | PossiblyUnused++-- | Different kinds of variables: those starting with @a@, those+-- starting with @v@, and those starting with @x@.++data VariableKind = A | V | X++-- | Different kinds of names.++data NameKind+  = TypeK+    -- ^ Types.+  | ConK+    -- ^ Constructors.+  | VarK VariableKind+    -- ^ Variables.+  | CoverK+    -- ^ Used for coverage checking.+  | CheckK+    -- ^ Used for constructor type checking.+  | FunK FunctionKind+    -- ^ Other functions.++-- | Turns strings into valid Haskell identifiers. ----- * Names coming from Haskell must always be used qualified.---   Exception: names from the Prelude.+-- In order to avoid clashes with names of regular Haskell definitions+-- (those not generated from Agda definitions), make sure that the+-- Haskell names are always used qualified, with the exception of+-- names from the prelude. -ihname :: String -> Nat -> HS.Name-ihname s i = HS.Ident $ s ++ show i+encodeString :: NameKind -> String -> String+encodeString k s = prefix ++ concatMap encode s+  where+  encode '\'' = "''"+  encode c+    | isLower c || isUpper c || c == '_' ||+      generalCategory c == DecimalNumber =+      [c]+    | otherwise =+      "'" ++ show (fromEnum c) ++ "'" -unqhname :: String -> QName -> HS.Name-{- NOT A GOOD IDEA, see Issue 728-unqhname s q | ("d", "main") == (s, show(qnameName q)) = HS.Ident "main"-             | otherwise = ihname s (idnum $ nameId $ qnameName $ q)--}-unqhname s q = ihname s (idnum $ nameId $ qnameName $ q)-   where idnum (NameId x _) = fromIntegral x+  prefix = case k of+    TypeK               -> "T"+    ConK                -> "C"+    VarK A              -> "a"+    VarK V              -> "v"+    VarK X              -> "x"+    CoverK              -> "cover"+    CheckK              -> "check"+    FunK NoUnused       -> "du"+    FunK PossiblyUnused -> "d" +ihname :: VariableKind -> Nat -> HS.Name+ihname k i = HS.Ident $ encodeString (VarK k) (show i)++unqhname :: NameKind -> QName -> HS.Name+unqhname k q =+  HS.Ident $ encodeString k $+    "_" ++ prettyShow (nameCanonical n) ++ "_" ++ idnum (nameId n)+  where+  n = qnameName q++  idnum (NameId x _) = show (fromIntegral x)+ -- the toplevel module containing the given one tlmodOf :: ReadTCState m => ModuleName -> m HS.ModuleName tlmodOf = fmap mazMod . topLevelModuleName@@ -138,15 +252,15 @@       modify (HsCompileState . Set.insert m1 . mazAccumlatedImports)       return (HS.Qual (mazMod m1) n) -xhqn :: String -> QName -> HsCompileM HS.QName-xhqn s q = xqual q (unqhname s q)+xhqn :: NameKind -> QName -> HsCompileM HS.QName+xhqn k q = xqual q (unqhname k q)  hsName :: String -> HS.QName hsName s = HS.UnQual (HS.Ident s)  -- always use the original name for a constructor even when it's redefined. conhqn :: QName -> HsCompileM HS.QName-conhqn q = xhqn "C" =<< canonicalName q+conhqn q = xhqn ConK =<< canonicalName q  -- qualify name s by the module of builtin b bltQual :: String -> String -> HsCompileM HS.QName@@ -155,11 +269,11 @@   xqual q (HS.Ident s)  dname :: QName -> HS.Name-dname q = unqhname "d" q+dname q = unqhname (FunK PossiblyUnused) q  -- | Name for definition stripped of unused arguments duname :: QName -> HS.Name-duname q = unqhname "du" q+duname q = unqhname (FunK NoUnused) q  hsPrimOp :: String -> HS.QOp hsPrimOp s = HS.QVarOp $ HS.UnQual $ HS.Symbol s@@ -178,7 +292,7 @@  hsLet :: HS.Name -> HS.Exp -> HS.Exp -> HS.Exp hsLet x e b =-  HS.Let (HS.BDecls [HS.FunBind [HS.Match x [] (HS.UnGuardedRhs e) emptyBinds]]) b+  HS.Let (HS.BDecls [HS.LocalBind HS.Lazy x (HS.UnGuardedRhs e)]) b  hsVarUQ :: HS.Name -> HS.Exp hsVarUQ = HS.Var . HS.UnQual@@ -234,13 +348,6 @@ -- mazCoerce = HS.Var $ HS.Qual mazRTE $ HS.Ident mazCoerceName mazCoerce = HS.Var $ HS.UnQual $ HS.Ident mazCoerceName --- Andreas, 2011-11-16: error incomplete match now RTE-call-mazIncompleteMatch :: HS.Exp-mazIncompleteMatch = HS.Var $ HS.Qual mazRTE $ HS.Ident "mazIncompleteMatch"--rtmIncompleteMatch :: QName -> HS.Exp-rtmIncompleteMatch q = mazIncompleteMatch `HS.App` hsVarUQ (unqhname "name" q)- mazUnreachableError :: HS.Exp mazUnreachableError = HS.Var $ HS.Qual mazRTE $ HS.Ident "mazUnreachableError" @@ -286,7 +393,7 @@ fakeDS = fakeD . HS.Ident  fakeDQ :: QName -> String -> HS.Decl-fakeDQ = fakeD . unqhname "d"+fakeDQ = fakeD . dname  fakeType :: String -> HS.Type fakeType = HS.FakeType
src/full/Agda/Compiler/MAlonzo/Pragmas.hs view
@@ -17,6 +17,7 @@ import Agda.Utils.Three  import Agda.Compiler.Common+import Agda.Compiler.MAlonzo.Misc  import Agda.Utils.Impossible @@ -148,27 +149,24 @@  -- TODO: cache this to avoid parsing the pragma for every constructor --       occurrence!-getHaskellConstructor :: QName -> TCM (Maybe HaskellCode)+getHaskellConstructor :: QName -> HsCompileM (Maybe HaskellCode) getHaskellConstructor c = do-  c       <- canonicalName c-  cDef    <- theDef <$> getConstInfo c-  true    <- getBuiltinName builtinTrue-  false   <- getBuiltinName builtinFalse-  nil     <- getBuiltinName builtinNil-  cons    <- getBuiltinName builtinCons-  nothing <- getBuiltinName builtinNothing-  just    <- getBuiltinName builtinJust-  sharp   <- getBuiltinName builtinSharp+  c    <- canonicalName c+  cDef <- theDef <$> getConstInfo c+  env  <- askGHCEnv+  let is c p = Just c == p env   case cDef of-    _ | Just c == true    -> return $ Just "True"-      | Just c == false   -> return $ Just "False"-      | Just c == nil     -> return $ Just "[]"-      | Just c == cons    -> return $ Just "(:)"-      | Just c == nothing -> return $ Just "Nothing"-      | Just c == just    -> return $ Just "Just"-      | Just c == sharp   -> return $ Just "MAlonzo.RTE.Sharp"+    _ | c `is` ghcEnvTrue    -> return $ Just "True"+      | c `is` ghcEnvFalse   -> return $ Just "False"+      | c `is` ghcEnvNil     -> return $ Just "[]"+      | c `is` ghcEnvCons    -> return $ Just "(:)"+      | c `is` ghcEnvNothing -> return $ Just "Nothing"+      | c `is` ghcEnvJust    -> return $ Just "Just"+      | c `is` ghcEnvSharp   -> return $ Just "MAlonzo.RTE.Sharp"+      | c `is` ghcEnvIZero   -> return $ Just "False"+      | c `is` ghcEnvIOne    -> return $ Just "True"     Constructor{conData = d} -> do-      mp <- getHaskellPragma d+      mp <- liftTCM $ getHaskellPragma d       case mp of         Just (HsData _ _ hsCons) -> do           cons <- defConstructors . theDef <$> getConstInfo d
src/full/Agda/Compiler/MAlonzo/Pretty.hs view
@@ -63,8 +63,13 @@       sep [ hsep (punctuate comma (map pretty fs)) <+> "::"           , nest 2 $ pretty t ]     HS.FunBind ms -> vcat $ map pretty ms+    HS.LocalBind s f rhs ->+      sep [ pretty s <> pretty f+          , nest 2 $ prettyRhs "=" rhs+          ]     HS.PatSyn p1 p2 -> sep [ "pattern" <+> pretty p1 <+> "=" <+> pretty p2 ]     HS.FakeDecl s -> text s+    HS.Comment s -> vcat $ map (("--" <+>) . text) (lines s)  instance Pretty HS.ConDecl where   pretty (HS.ConDecl c sts) =@@ -90,7 +95,7 @@   prettyPrec pr pat =     case pat of       HS.PVar x         -> pretty x-      HS.PLit l         -> pretty l+      HS.PLit l         -> prettyPrec pr l       HS.PAsPat x p     -> mparens (pr > 10) $ pretty x <> "@" <> prettyPrec 11 p       HS.PWildCard      -> "_"       HS.PBangPat p     -> "!" <> prettyPrec 11 p@@ -146,10 +151,17 @@   pretty (HS.Generator p e) = sep [ pretty p <+> "<-", nest 2 $ pretty e ]  instance Pretty HS.Literal where-  pretty (HS.Int n)    = integer n-  pretty (HS.Frac x)   = double (fromRational x)-  pretty (HS.Char c)   = text (show c)-  pretty (HS.String s) = text (show s)+  prettyPrec pr = \case+    HS.Int n    -> parensIfNeg n $ integer n+    HS.Frac x   -> parensIfNeg d $ double d+                   where+                   d = fromRational x+    HS.Char c   -> text (show c)+    HS.String s -> text (show s)+    where+    parensIfNeg :: (Ord n, Num n) => n -> Doc -> Doc+    parensIfNeg x =+      if x < 0 then mparens (pr > 10) else id  instance Pretty HS.Exp where   prettyPrec pr e =
src/full/Agda/Compiler/MAlonzo/Primitives.hs view
@@ -5,6 +5,7 @@ import Control.Monad.Trans.Maybe ( MaybeT(MaybeT, runMaybeT) )  import qualified Data.List as List+import           Data.Map (Map) import qualified Data.Map as Map import qualified Data.Set as Set import qualified Data.HashMap.Strict as HMap@@ -85,7 +86,7 @@   where     mainAlias = HS.FunBind [HS.Match mainLHS [] mainRHS emptyBinds ]     mainLHS   = HS.Ident "main"-    mainRHS   = HS.UnGuardedRhs $ HS.App mazCoerce (HS.Var $ HS.UnQual $ unqhname "d" $ defName def)+    mainRHS   = HS.UnGuardedRhs $ HS.App mazCoerce (HS.Var $ HS.UnQual $ dname $ defName def)  treelessPrimName :: TPrim -> String treelessPrimName p =@@ -120,44 +121,47 @@ importsForPrim :: BuiltinThings PrimFun -> [Definition] -> [HS.ModuleName] importsForPrim builtinThings defs = xForPrim table builtinThings defs ++ [HS.ModuleName "Data.Text"]   where-  table = Map.fromList $ second (HS.ModuleName <$>) <$>-    [ "CHAR"                       |-> ["Data.Char"]-    , "primIsAlpha"                |-> ["Data.Char"]-    , "primIsAscii"                |-> ["Data.Char"]-    , "primIsDigit"                |-> ["Data.Char"]-    , "primIsHexDigit"             |-> ["Data.Char"]-    , "primIsLatin1"               |-> ["Data.Char"]-    , "primIsLower"                |-> ["Data.Char"]-    , "primIsPrint"                |-> ["Data.Char"]-    , "primIsSpace"                |-> ["Data.Char"]-    , "primToLower"                |-> ["Data.Char"]-    , "primToUpper"                |-> ["Data.Char"]-    , "primFloatInequality"        |-> ["MAlonzo.RTE.Float"]-    , "primFloatEquality"          |-> ["MAlonzo.RTE.Float"]-    , "primFloatLess"              |-> ["MAlonzo.RTE.Float"]-    , "primFloatIsSafeInteger"     |-> ["MAlonzo.RTE.Float"]-    , "primFloatToWord64"          |-> ["MAlonzo.RTE.Float"]-    , "primFloatRound"             |-> ["MAlonzo.RTE.Float"]-    , "primFloatFloor"             |-> ["MAlonzo.RTE.Float"]-    , "primFloatCeiling"           |-> ["MAlonzo.RTE.Float"]-    , "primFloatToRatio"           |-> ["MAlonzo.RTE.Float"]-    , "primRatioToFloat"           |-> ["MAlonzo.RTE.Float"]-    , "primFloatDecode"            |-> ["MAlonzo.RTE.Float"]-    , "primFloatEncode"            |-> ["MAlonzo.RTE.Float"]+  table = Map.fromDistinctAscList $ map (second HS.ModuleName)+    -- KEEP THIS LIST IN ALPHABETICAL ORDER!+    -- Otherwise, Map.fromDistinctAscList will produce garbage.+    [ "CHAR"                       |-> "Data.Char"+    , "primFloatCeiling"           |-> "MAlonzo.RTE.Float"+    , "primFloatDecode"            |-> "MAlonzo.RTE.Float"+    , "primFloatEncode"            |-> "MAlonzo.RTE.Float"+    , "primFloatEquality"          |-> "MAlonzo.RTE.Float"+    , "primFloatFloor"             |-> "MAlonzo.RTE.Float"+    , "primFloatInequality"        |-> "MAlonzo.RTE.Float"+    , "primFloatIsSafeInteger"     |-> "MAlonzo.RTE.Float"+    , "primFloatLess"              |-> "MAlonzo.RTE.Float"+    , "primFloatRound"             |-> "MAlonzo.RTE.Float"+    , "primFloatToRatio"           |-> "MAlonzo.RTE.Float"+    , "primFloatToWord64"          |-> "MAlonzo.RTE.Float"+    , "primIsAlpha"                |-> "Data.Char"+    , "primIsAscii"                |-> "Data.Char"+    , "primIsDigit"                |-> "Data.Char"+    , "primIsHexDigit"             |-> "Data.Char"+    , "primIsLatin1"               |-> "Data.Char"+    , "primIsLower"                |-> "Data.Char"+    , "primIsPrint"                |-> "Data.Char"+    , "primIsSpace"                |-> "Data.Char"+    , "primRatioToFloat"           |-> "MAlonzo.RTE.Float"+    , "primToLower"                |-> "Data.Char"+    , "primToUpper"                |-> "Data.Char"     ]   (|->) = (,)  -------------- -xForPrim :: Map.Map String [a] -> BuiltinThings PrimFun -> [Definition] -> [a]-xForPrim table builtinThings defs =-  let qs = Set.fromList $ defName <$> defs-      bs = Map.toList builtinThings-      getName (Builtin t)            = getPrimName t-      getName (Prim (PrimFun q _ _)) = q-  in-  concat [ fromMaybe [] $ Map.lookup s table-         | (s, def) <- bs, getName def `Set.member` qs ]+xForPrim :: Map String a -> BuiltinThings PrimFun -> [Definition] -> [a]+xForPrim table builtinThings defs = catMaybes+    [ Map.lookup s table+    | (s, def) <- Map.toList builtinThings+    , getName def `Set.member` qs+    ]+  where+  qs = Set.fromList $ map defName defs+  getName (Builtin t)            = getPrimName t+  getName (Prim (PrimFun q _ _)) = q   -- | Definition bodies for primitive functions@@ -199,7 +203,7 @@   -- Machine word functions   , "primWord64ToNat"   |-> return "MAlonzo.RTE.word64ToNat"   , "primWord64FromNat" |-> return "MAlonzo.RTE.word64FromNat"-  , "primWord64ToNatInjective" |-> return "erased"+  , "primWord64ToNatInjective" |-> return mazErasedName    -- Floating point functions   , "primFloatEquality"          |-> return "MAlonzo.RTE.Float.doubleEq"@@ -210,7 +214,7 @@   , "primFloatIsNegativeZero"    |-> return "(isNegativeZero :: Double -> Bool)"   , "primFloatIsSafeInteger"     |-> return "MAlonzo.RTE.Float.isSafeInteger"   , "primFloatToWord64"          |-> return "MAlonzo.RTE.Float.doubleToWord64"-  , "primFloatToWord64Injective" |-> return "erased"+  , "primFloatToWord64Injective" |-> return mazErasedName   , "primNatToFloat"             |-> return "(MAlonzo.RTE.Float.intToDouble :: Integer -> Double)"   , "primIntToFloat"             |-> return "(MAlonzo.RTE.Float.intToDouble :: Integer -> Double)"   , "primFloatRound"             |-> return "MAlonzo.RTE.Float.doubleRound"@@ -259,7 +263,7 @@   , "primCharToNat" |-> return "(fromIntegral . fromEnum :: Char -> Integer)"   , "primNatToChar" |-> return "MAlonzo.RTE.natToChar"   , "primShowChar"  |-> return "(Data.Text.pack . show :: Char -> Data.Text.Text)"-  , "primCharToNatInjective" |-> return "erased"+  , "primCharToNatInjective" |-> return mazErasedName    -- String functions   , "primStringUncons"   |-> return "Data.Text.uncons"@@ -268,8 +272,8 @@   , "primStringAppend"   |-> binAsis "Data.Text.append" "Data.Text.Text"   , "primStringEquality" |-> rel "(==)" "Data.Text.Text"   , "primShowString"     |-> return "(Data.Text.pack . show :: Data.Text.Text -> Data.Text.Text)"-  , "primStringToListInjective" |-> return "erased"-  , "primStringFromListInjective" |-> return "erased"+  , "primStringToListInjective" |-> return mazErasedName+  , "primStringFromListInjective" |-> return mazErasedName    -- Reflection   , "primQNameEquality"   |-> rel "(==)" "MAlonzo.RTE.QName"@@ -277,19 +281,41 @@   , "primShowQName"       |-> return "Data.Text.pack . MAlonzo.RTE.qnameString"   , "primQNameFixity"     |-> return "MAlonzo.RTE.qnameFixity"   , "primQNameToWord64s"  |-> return "\\ qn -> (MAlonzo.RTE.nameId qn, MAlonzo.RTE.moduleId qn)"-  , "primQNameToWord64sInjective" |-> return "erased"+  , "primQNameToWord64sInjective" |-> return mazErasedName   , "primMetaEquality"    |-> rel "(==)" "Integer"   , "primMetaLess"        |-> rel "(<)" "Integer"   , "primShowMeta"        |-> return "\\ x -> Data.Text.pack (\"_\" ++ show (x :: Integer))"   , "primMetaToNat"       |-> return "(id :: Integer -> Integer)"-  , "primMetaToNatInjective" |-> return "erased"+  , "primMetaToNatInjective" |-> return mazErasedName    -- Seq   , "primForce"      |-> return "\\ _ _ _ _ x f -> f $! x"-  , "primForceLemma" |-> return "erased"+  , "primForceLemma" |-> return mazErasedName    -- Erase-  , "primEraseEquality" |-> return "erased"+  , "primEraseEquality" |-> return mazErasedName++  -- Cubical+  , builtinIMin       |-> return "(&&)"+  , builtinIMax       |-> return "(||)"+  , builtinINeg       |-> return "not"+  , "primPartial"     |-> return "\\_ _ x -> x"+  , "primPartialP"    |-> return "\\_ _ x -> x"+  , builtinPOr        |-> return "\\_ i _ _ x y -> if i then x else y"+  , builtinComp       |-> return "\\_ _ _ _ x -> x"+  , builtinTrans      |-> return "\\_ _ _ x -> x"+  , builtinHComp      |-> return "\\_ _ _ _ x -> x"+  , builtinSubOut     |-> return "\\_ _ _ _ x -> x"+  , builtin_glueU     |-> return "\\_ _ _ _ _ x -> x"+  , builtin_unglueU   |-> return "\\_ _ _ _ x -> x"+  , builtinFaceForall |-> return+                            "\\f -> f True == True && f False == True"+  , "primDepIMin"     |-> return "\\i f -> if i then f () else False"+  , "primIdFace"      |-> return "\\_ _ _ _ -> fst"+  , "primIdPath"      |-> return "\\_ _ _ _ -> snd"+  , "primIdJ"         |-> return "\\_ _ _ _ _ x _ _ -> x"+  , builtinIdElim     |-> return+                            "\\_ _ _ _ _ f x y -> f (fst y) x (snd y)"   ]   where   x |-> s = (x, Left <$> s)
+ src/full/Agda/Compiler/MAlonzo/Strict.hs view
@@ -0,0 +1,89 @@+------------------------------------------------------------------------+-- | Strictification of Haskell code+------------------------------------------------------------------------++module Agda.Compiler.MAlonzo.Strict where++import Agda.Utils.Haskell.Syntax++-- | The function 'makeStrict' makes every function argument, case and+-- generator pattern, and 'LocalBind' binding strict (except for those+-- patterns that are marked as irrefutable, and anything in a+-- 'FakeDecl' or 'FakeExp'). Note that only the outermost patterns are+-- made strict.++class MakeStrict a where+  makeStrict :: a -> a++instance MakeStrict a => MakeStrict [a] where+  makeStrict = map makeStrict++instance MakeStrict a => MakeStrict (Maybe a) where+  makeStrict = fmap makeStrict++instance MakeStrict Module where+  makeStrict (Module m pragmas imps decls) =+    Module m pragmas imps (makeStrict decls)++instance MakeStrict Decl where+  makeStrict = \case+    d@TypeDecl{}      -> d+    d@DataDecl{}      -> d+    d@TypeSig{}       -> d+    FunBind ms        -> FunBind (makeStrict ms)+    LocalBind s f rhs -> LocalBind Strict f (makeStrict rhs)+    d@PatSyn{}        -> d+    d@FakeDecl{}      -> d+    d@Comment{}       -> d++instance MakeStrict Match where+  makeStrict (Match f ps rhs wh) =+    Match f (makeStrict ps) (makeStrict rhs) (makeStrict wh)++instance MakeStrict Pat where+  makeStrict = \case+    p@PVar{}       -> PBangPat p+    p@PLit{}       -> PBangPat p+    PAsPat x p     -> PAsPat x (makeStrict p)+    p@PWildCard{}  -> PBangPat p+    p@PBangPat{}   -> p+    p@PApp{}       -> PBangPat p+    PatTypeSig p t -> PatTypeSig (makeStrict p) t+    p@PIrrPat{}    -> p++instance MakeStrict Binds where+  makeStrict (BDecls ds) = BDecls (makeStrict ds)++instance MakeStrict Rhs where+  makeStrict (UnGuardedRhs e) = UnGuardedRhs (makeStrict e)+  makeStrict (GuardedRhss rs) = GuardedRhss (makeStrict rs)++instance MakeStrict GuardedRhs where+  makeStrict (GuardedRhs ss e) =+    GuardedRhs (makeStrict ss) (makeStrict e)++instance MakeStrict Stmt where+  makeStrict = \case+    Qualifier e   -> Qualifier (makeStrict e)+    Generator p e -> Generator (makeStrict p) (makeStrict e)++instance MakeStrict Exp where+  makeStrict e =+    case e of+      Var{}           -> e+      Con{}           -> e+      Lit{}           -> e+      InfixApp a op b -> InfixApp (makeStrict a) op (makeStrict b)+      Ann e ty        -> Ann (makeStrict e) ty+      App a b         -> App (makeStrict a) (makeStrict b)+      Lambda ps e     -> Lambda (makeStrict ps) (makeStrict e)+      Let bs e        -> Let (makeStrict bs) (makeStrict e)+      If a b c        -> If (makeStrict a) (makeStrict b) (makeStrict c)+      Case e bs       -> Case (makeStrict e) (makeStrict bs)+      ExpTypeSig e t  -> ExpTypeSig (makeStrict e) t+      NegApp e        -> NegApp (makeStrict e)+      FakeExp s       -> FakeExp s++instance MakeStrict Alt where+  makeStrict (Alt pat rhs wh) =+    Alt (makeStrict pat) (makeStrict rhs) (makeStrict wh)
src/full/Agda/Compiler/ToTreeless.hs view
@@ -252,7 +252,7 @@       mkRecord =<< traverse casetree (CC.content <$> conBrs)     CC.Case (Arg i n) (CC.Branches False conBrs etaBr litBrs catchAll _ lazy) -> lambdasUpTo (n + 1) $ do                     -- We can treat eta-matches as regular matches here.-      let conBrs' = Map.union conBrs $ Map.fromList $ map (first conName) $ maybeToList etaBr+      let conBrs' = caseMaybe etaBr conBrs $ \ (c, br) -> Map.insertWith (\ new old -> old) (conName c) br conBrs       if Map.null conBrs' && Map.null litBrs then do         -- there are no branches, just return default         updateCatchAll catchAll fromCatchAll
src/full/Agda/Interaction/Base.hs view
@@ -27,6 +27,7 @@                                                defaultOptions)  import           Agda.Utils.FileName          (AbsolutePath, mkAbsolute)+import           Agda.Utils.Pretty            (Pretty(..), prettyShow, text) import           Agda.Utils.Time              (ClockTime)  ------------------------------------------------------------------------@@ -392,10 +393,15 @@ data CompilerBackend = LaTeX | QuickLaTeX | OtherBackend String     deriving (Eq) +-- TODO 2021-08-25 get rid of custom Show instance instance Show CompilerBackend where-  show LaTeX            = "LaTeX"-  show QuickLaTeX       = "QuickLaTeX"-  show (OtherBackend s) = s+  show = prettyShow++instance Pretty CompilerBackend where+  pretty = \case+    LaTeX          -> "LaTeX"+    QuickLaTeX     -> "QuickLaTeX"+    OtherBackend s -> text s  instance Read CompilerBackend where   readsPrec _ s = do
src/full/Agda/Interaction/BasicOps.hs view
@@ -162,7 +162,7 @@         unless (force == WithForce) $ redoChecks mii         wakeupConstraints mi         solveSizeConstraints DontDefaultToInfty-        cubical <- optCubical <$> pragmaOptions+        cubical <- isJust . optCubical <$> pragmaOptions         -- don't double check with cubical, because it gets in the way too often.         unless (cubical || force == WithForce) $ do           -- Double check.@@ -1031,7 +1031,7 @@         TelV tel' t <- telViewUpTo' (-1) notVisible t         -- if we cannot introduce a constructor, we try a lambda         let fallback = do-              cubical <- optCubical <$> pragmaOptions+              cubical <- isJust . optCubical <$> pragmaOptions               TelV tel _ <- (if cubical then telViewPath else telView) t               reportSDoc "interaction.intro" 20 $ TP.sep                 [ "introTactic/fallback"
src/full/Agda/Interaction/EmacsTop.hs view
@@ -108,14 +108,17 @@  lispifyDisplayInfo :: DisplayInfo -> TCM [Lisp String] lispifyDisplayInfo info = case info of-    Info_CompilationOk ws -> do+    Info_CompilationOk backend ws -> do       warnings <- prettyTCWarnings (tcWarnings ws)       errors <- prettyTCWarnings (nonFatalErrors ws)+      let+        msg = concat+          [ "The module was successfully compiled with backend "+          , prettyShow backend+          , ".\n"+          ]       -- abusing the goals field since we ignore the title-      let (body, _) = formatWarningsAndErrors-                        "The module was successfully compiled.\n"-                        warnings-                        errors+        (body, _) = formatWarningsAndErrors msg warnings errors       format body "*Compilation result*"     Info_Constraints s -> format (show $ vcat $ map pretty s) "*Constraints*"     Info_AllGoalsWarnings ms ws -> do
src/full/Agda/Interaction/FindFile.hs view
@@ -50,7 +50,7 @@ import Agda.Utils.List1 ( List1, pattern (:|) ) import qualified Agda.Utils.List1 as List1 import Agda.Utils.Monad ( ifM, unlessM )-import Agda.Utils.Pretty ( prettyShow )+import Agda.Utils.Pretty ( Pretty(..), prettyShow ) import Agda.Utils.Singleton  import Agda.Utils.Impossible@@ -63,6 +63,9 @@ -- @AbsolutePath@ does exist. newtype SourceFile    = SourceFile    { srcFilePath :: AbsolutePath } deriving (Eq, Ord) newtype InterfaceFile = InterfaceFile { intFilePath :: AbsolutePath }++instance Pretty SourceFile    where pretty = pretty . srcFilePath+instance Pretty InterfaceFile where pretty = pretty . intFilePath  -- | Makes an interface file from an AbsolutePath candidate. --   If the file does not exist, then fail by returning @Nothing@.
src/full/Agda/Interaction/Highlighting/FromAbstract.hs view
@@ -261,7 +261,6 @@       A.Quote _r                    -> mempty       A.QuoteTerm _r                -> mempty       A.Unquote _r                  -> mempty-      A.Tactic _r e es              -> hl e <> hl es       A.DontCare e                  -> hl e     where     hl a = hilite a
src/full/Agda/Interaction/Highlighting/Generate.hs view
@@ -497,6 +497,7 @@     W.ShadowingInTelescope nrs       -> foldMap                                           (shadowingTelHighlighting . snd)                                           nrs+    MissingDeclarations{}            -> missingDefinitionHighlighting w     MissingDefinitions{}             -> missingDefinitionHighlighting w     -- TODO: explore highlighting opportunities here!     InvalidCatchallPragma{}           -> mempty
src/full/Agda/Interaction/Highlighting/HTML/Base.hs view
@@ -67,6 +67,11 @@  import Agda.Utils.Impossible +-- | The Agda data directory containing the files for the HTML backend.++htmlDataDir :: FilePath+htmlDataDir = "html"+ -- | The name of the default CSS file.  defaultCSSFile :: FilePath@@ -196,13 +201,14 @@   -- the output directory.   let cssFile = htmlOptCssFile options   when (isNothing $ cssFile) $ do-    defCssFile <- getDataFileName defaultCSSFile+    defCssFile <- getDataFileName $+      htmlDataDir </> defaultCSSFile     copyFile defCssFile (htmlDir </> defaultCSSFile)    let highlightOccurrences = htmlOptHighlightOccurrences options   when highlightOccurrences $ do     highlightJsFile <- getDataFileName $-      "JS" </> occurrenceHighlightJsFile+      htmlDataDir </> occurrenceHighlightJsFile     copyFile highlightJsFile (htmlDir </> occurrenceHighlightJsFile)  -- | Converts module names to the corresponding HTML file names.
src/full/Agda/Interaction/Highlighting/JSON.hs view
@@ -12,7 +12,6 @@ import Agda.Utils.FileName (filePath) import Agda.Utils.IO.TempFile (writeToTempFile) -import Data.Aeson import qualified Data.ByteString.Lazy.Char8 as BS import qualified Data.Map as Map 
src/full/Agda/Interaction/Highlighting/LaTeX/Base.hs view
@@ -16,17 +16,30 @@   ) where  import Prelude hiding (log)++import Data.Bifunctor (second) import Data.Char import Data.Maybe import Data.Function import Data.Foldable (toList)-import Control.Monad.Trans.Reader as R ( ReaderT(runReaderT) )+#if !(MIN_VERSION_base(4,11,0))+import Data.Semigroup (Semigroup(..))+#endif++import Control.Monad (forM_, mapM_, unless, when)+import Control.Monad.Trans.Reader as R ( ReaderT(runReaderT)) import Control.Monad.RWS.Strict-import Control.Arrow (second)+  ( MonadIO(..), RWST(runRWST)+  , MonadReader(..), asks+  , MonadState(..), gets, modify+  , lift, tell+  )+ import System.Directory import System.Exit import System.FilePath import System.Process+ import Data.Text (Text) import qualified Data.Text               as T #ifdef COUNT_CLUSTERS@@ -55,7 +68,10 @@ import Agda.TypeChecking.Monad (Interface(..))  import Agda.Utils.FileName (AbsolutePath)-import Agda.Utils.List     (last1)+import Agda.Utils.Function (applyWhen)+import Agda.Utils.Functor  ((<&>))+import Agda.Utils.List     (last1, updateHead, updateLast)+import Agda.Utils.Maybe    (whenJust) import qualified Agda.Utils.List1 as List1  import Agda.Utils.Impossible@@ -72,7 +88,7 @@ -- into a WriterT, but that becomes slightly more complicated to reason about in -- the presence of IO exceptions. ----- We want the logging to be reasonbly polymorphic, avoid space leaks that can occur+-- We want the logging to be reasonably polymorphic, avoid space leaks that can occur -- with WriterT, and also be usable during outer phases such as directory preparation. -- -- I'm not certain this is the best way to do it, but whatever.@@ -217,12 +233,7 @@ -- locale is used), and otherwise the number of code points.  size :: Text -> LaTeX Int-size t = do-  f <- estimateTextWidth <$> ask-  return $ f t--(<+>) :: Text -> Text -> Text-(<+>) = T.append+size t = asks estimateTextWidth <&> ($ t)  -- | Does the string consist solely of whitespace? @@ -244,12 +255,13 @@ -- | If the `Token` consists of spaces, the internal column counter is advanced --   by the length of the token. Otherwise, `moveColumnForToken` is a no-op. moveColumnForToken :: Token -> LaTeX ()-moveColumnForToken t = do-  unless (isSpaces (text t)) $ do-    log MoveColumn $ text t+moveColumnForToken Token{ text = t } = do+  unless (isSpaces t) $ do+    log MoveColumn t     -- ASR (2021-02-07). The eta-expansion is required by GHC >= 9.0.1     -- (see Issue #4955).-    (\n -> moveColumn n) =<< size (text t)+    n <- size t+    moveColumn n  -- | Merges 'columns' into 'columnsPrev', resets 'column' and -- 'columns'@@ -293,10 +305,8 @@ -- column).  useColumn :: AlignmentColumn -> LaTeX ()-useColumn c = case columnKind c of-  Nothing -> return ()-  Just i  -> modify $ \s ->-               s { usedColumns = Set.insert i (usedColumns s) }+useColumn c = whenJust (columnKind c) $ \ i ->+  modify $ \ s -> s { usedColumns = Set.insert i (usedColumns s) }  -- | Alignment column zero in the current code block. @@ -355,7 +365,7 @@  output :: Output -> LaTeX () output item = do-  log Output (T.pack $ show item)+  log Output $ tshow item   tell [item]  ------------------------------------------------------------------------@@ -371,7 +381,7 @@ -- in the same column.  agdaSpace :: Text-agdaSpace = cmdPrefix <+> "Space" <+> cmdArg T.empty <+> nl+agdaSpace = cmdPrefix <> "Space" <> cmdArg T.empty <> nl  -- | The column's name. --@@ -386,7 +396,7 @@ -- | Opens a column with the given name.  ptOpen' :: Text -> Text-ptOpen' name = "\\>[" <+> name <+> "]"+ptOpen' name = "\\>[" <> name <> "]"  -- | Opens the given column. @@ -397,7 +407,7 @@ -- lines.  ptOpenBeginningOfLine :: Text-ptOpenBeginningOfLine = ptOpen' "." <+> "[@{}l@{}]"+ptOpenBeginningOfLine = ptOpen' "." <> "[@{}l@{}]"  -- | Opens the given column, and inserts an indentation instruction -- with the given argument at the end of it.@@ -407,34 +417,34 @@   -> Int              -- ^ Indentation instruction argument.   -> Text ptOpenIndent c delta =-  ptOpen c <+> "[@{}l@{"-           <+> cmdPrefix-           <+> "Indent"-           <+> cmdArg (T.pack $ show delta)-           <+> "}]"+  ptOpen c <> "[@{}l@{"+           <> cmdPrefix+           <> "Indent"+           <> cmdArg (T.pack $ show delta)+           <> "}]"  ptClose :: Text ptClose = "\\<"  ptClose' :: AlignmentColumn -> Text ptClose' c =-  ptClose <+> "[" <+> columnName c <+> "]"+  ptClose <> "[" <> columnName c <> "]"  ptNL :: Text-ptNL = nl <+> "\\\\\n"+ptNL = nl <> "\\\\\n"  ptEmptyLine :: Text ptEmptyLine =-  nl <+> "\\\\["-     <+> cmdPrefix-     <+> "EmptyExtraSkip"-     <+> "]%\n"+  nl <> "\\\\["+     <> cmdPrefix+     <> "EmptyExtraSkip"+     <> "]%\n"  cmdPrefix :: Text cmdPrefix = "\\Agda"  cmdArg :: Text -> Text-cmdArg x = "{" <+> x <+> "}"+cmdArg x = "{" <> x <> "}"  ------------------------------------------------------------------------ -- * Output generation from a stream of labelled tokens.@@ -442,51 +452,50 @@ processLayers :: [(LayerRole, Tokens)] -> LaTeX () -- ASR (2021-02-07). The eta-expansion on @lt@ is required by GHC >= -- 9.0.1 (see Issue #4955).-processLayers lt = (mapM_ $ \(layerRole,toks) -> do+processLayers lt = forM_ lt $ \ (layerRole,toks) -> do   case layerRole of     L.Markup  -> processMarkup  toks     L.Comment -> processComment toks-    L.Code    -> processCode    toks) lt--processMarkup, processComment, processCode :: Tokens -> LaTeX ()+    L.Code    -> processCode    toks  -- | Deals with markup, which is output verbatim.--- ASR (2021-02-07). The eta-expansion on @t@ is required by GHC >=+processMarkup :: Tokens -> LaTeX ()+-- ASR (2021-02-07). The eta-expansion on @ts@ is required by GHC >= -- 9.0.1 (see Issue #4955).-processMarkup t = (mapM_ $ \t' -> do+processMarkup ts = forM_ ts $ \ t' -> do   moveColumnForToken t'-  output (Text (text t'))) t+  output (Text (text t'))  -- | Deals with literate text, which is output verbatim--- ASR (2021-02-07). The eta-expansion with @t@ is required by GHC >=+processComment :: Tokens -> LaTeX ()+-- ASR (2021-02-07). The eta-expansion with @ts@ is required by GHC >= -- 9.0.1 (see Issue #4955).-processComment t = (mapM_ $ \t' -> do+processComment ts = forM_ ts $ \ t' -> do   unless ("%" == T.take 1 (T.stripStart (text t'))) $ do     moveColumnForToken t'-  output (Text (text t'))) t+  output (Text (text t'))  -- | Deals with code blocks. Every token, except spaces, is pretty -- printed as a LaTeX command.+processCode :: Tokens -> LaTeX () processCode toks' = do   output $ Text nl   enterCode   mapM_ go toks'   ptOpenWhenColumnZero =<< gets column-  output $ Text $ ptClose <+> nl+  output $ Text $ ptClose <> nl   leaveCode    where-    go tok' = do+    go tok'@Token{ text = tok } = do       -- Get the column information before grabbing the token, since       -- grabbing (possibly) moves the column.       col  <- gets column        moveColumnForToken tok'-      let tok = text tok'       log Code tok -      if (tok == T.empty) then return ()-      else do+      unless (T.null tok) $         if (isSpaces tok) then do             spaces $ T.group $ replaceSpaces tok         else do@@ -494,7 +503,7 @@           output $ Text $             -- we return the escaped token wrapped in commands corresponding             -- to its aspect (if any) and other aspects (e.g. error, unsolved meta)-            foldr (\c t -> cmdPrefix <+> T.pack c <+> cmdArg t)+            foldr (\c t -> cmdPrefix <> T.pack c <> cmdArg t)                   (escape tok)                   $ map fromOtherAspect (toList $ otherAspects $ info tok') ++                     concatMap fromAspect (toList $ aspect $ info tok')@@ -556,7 +565,7 @@ -- | Escapes special characters. escape :: Text -> Text escape (T.uncons -> Nothing)     = T.empty-escape (T.uncons -> Just (c, s)) = T.pack (replace c) <+> escape s+escape (T.uncons -> Just (c, s)) = T.pack (replace c) <> escape s   where   replace :: Char -> String   replace char = case char of@@ -592,7 +601,7 @@     -- ASR (2021-02-07). The eta-expansion @\o -> output o@ is     -- required by GHC >= 9.0.1 (see Issue #4955).     (\o -> output o) . Text . ptOpen =<< columnZero-  output $ Text $ ptClose <+> ptNL <+>+  output $ Text $ ptClose <> ptNL <>                   T.replicate (T.length s - 1) ptEmptyLine   resetColumn   spaces ss@@ -619,7 +628,7 @@     codeBlock  <- gets codeBlock      log Spaces $-      "col == 0: " <+> T.pack (show (len, columns))+      "col == 0: " <> T.pack (show (len, columns))      case filter ((<= len) . columnColumn) columns of       c : _ | columnColumn c == len, isJust (columnKind c) -> do@@ -652,9 +661,32 @@  stringLiteral t = [t] +-- | Split multi-line comments into several tokens.+-- See issue #5398.+multiLineComment :: Token -> Tokens+multiLineComment Token{ text = s, info = i } | aspect i == Just Comment =+  map (`Token` i)+    $ List.intersperse "\n"+    $ T.lines s+-- multiLineComment Token{ text = s, info = i } | aspect i == Just Comment =+--   map emptyToPar+--     $ List1.groupBy ((==) `on` T.null)+--     $ T.lines s+--   where+--   emptyToPar :: List1 Text -> Token+--   emptyToPar ts@(t :| _)+--     | T.null t  = Token{ text = "\n", info = mempty }+--     | otherwise = Token{ text = sconcat $ List1.intersperse "\n" ts, info = i }+multiLineComment t = [t]+ ------------------------------------------------------------------------ -- * Main. +-- | The Agda data directory containing the files for the LaTeX backend.++latexDataDir :: FilePath+latexDataDir = "latex"+ defaultStyFile :: String defaultStyFile = "agda.sty" @@ -695,7 +727,8 @@       (T.pack $ unwords [defaultStyFile, "was not found. Copying a default version of", defaultStyFile, "into", dir])       []     liftIO $ do-      styFile <- getDataFileName defaultStyFile+      styFile <- getDataFileName $+        latexDataDir </> defaultStyFile       copyFile styFile (dir </> defaultStyFile)  -- | Generates a LaTeX file for the given interface.@@ -741,13 +774,13 @@       ( ( \(role, tokens) ->             (role,) $               -- This bit fixes issue 954-              ( if L.isCode role-                  then-- Remove trailing whitespace from the+              ( applyWhen (L.isCode role) $+                  -- Remove trailing whitespace from the                   -- final line; the function spaces                   -- expects trailing whitespace to be                   -- followed by a newline character.                     whenMoreThanOne-                      ( withLast+                      ( updateLast                           $ withTokenText                           $ \suf ->                             maybe@@ -755,8 +788,8 @@                               (T.dropWhileEnd isSpaceNotNewline)                               (T.stripSuffix "\n" suf)                       )-                      . withLast (withTokenText $ T.dropWhileEnd isSpaceNotNewline)-                      . withFirst+                      . updateLast (withTokenText $ T.dropWhileEnd isSpaceNotNewline)+                      . updateHead                         ( withTokenText $                             \pre ->                               fromMaybe pre $ T.stripPrefix "\n" $@@ -764,19 +797,16 @@                                   isSpaceNotNewline                                   pre                         )-                  else-- do nothing-                    id               )                 tokens         ) . ( second                 ( -- Split tokens at newlines-                  concatMap-                    ( stringLiteral-                        . ( \(mi, cs) ->+                  concatMap stringLiteral+                . concatMap multiLineComment+                . map ( \(mi, cs) ->                               Token {text = T.pack cs, info = fromMaybe mempty mi}-                          )-                    )-                    . groupByFst+                      )+                . groupByFst                 )             )       )@@ -792,17 +822,6 @@   where   infoMap = toMap hi -  -- This function preserves laziness of the list-  withLast :: (a -> a) -> [a] -> [a]-  withLast _ [] = []-  withLast f [a] = [f a]-  withLast f (a:as) = a:withLast f as--  -- This function preserves laziness of the list-  withFirst :: (a -> a) -> [a] -> [a]-  withFirst _ [] = []-  withFirst f (a:as) = f a:as-   whenMoreThanOne :: ([a] -> [a]) -> [a] -> [a]   whenMoreThanOne f xs@(_:_:_) = f xs   whenMoreThanOne _ xs         = xs@@ -820,5 +839,5 @@     render _ (Text s)        = s     render s (MaybeColumn c)       | Just i <- columnKind c,-        not (Set.member i (usedColumns s)) = agdaSpace-      | otherwise                          = nl <+> ptOpen c+        not (i `Set.member` usedColumns s) = agdaSpace+      | otherwise                          = nl <> ptOpen c
src/full/Agda/Interaction/Imports.hs view
@@ -126,9 +126,7 @@   (parsedMod, fileType) <- runPM $                            parseFile moduleParser f $ TL.unpack source   parsedModName         <- moduleName f parsedMod-  let sourceDir = takeDirectory $ filePath f-  useLibs <- optUseLibs <$> commandLineOptions-  libs <- getAgdaLibFiles sourceDir+  libs <- getAgdaLibFiles $ takeDirectory $ filePath f   return Source     { srcText        = source     , srcFileType    = fileType@@ -195,24 +193,22 @@ mergeInterface :: Interface -> TCM () mergeInterface i = do     let sig     = iSignature i-        builtin = Map.toList $ iBuiltin i+        builtin = Map.toAscList $ iBuiltin i         prim    = [ x | (_,Prim x) <- builtin ]-        bi      = Map.fromList [ (x,Builtin t) | (x,Builtin t) <- builtin ]+        bi      = Map.fromDistinctAscList [ (x, Builtin t) | (x, Builtin t) <- builtin ]+                    -- Andreas, 2021-08-19: this seeming identity filters out the @Prim@s+                    -- and converts the type.         warns   = iWarnings i     bs <- getsTC stBuiltinThings     reportSLn "import.iface.merge" 10 "Merging interface"     reportSLn "import.iface.merge" 20 $       "  Current builtins " ++ show (Map.keys bs) ++ "\n" ++       "  New builtins     " ++ show (Map.keys bi)-    let check b = case (b1, b2) of-            (Builtin x, Builtin y)-              | x == y    -> return ()-              | otherwise -> typeError $ DuplicateBuiltinBinding b x y-            _ -> __IMPOSSIBLE__-          where-            Just b1 = Map.lookup b bs-            Just b2 = Map.lookup b bi-    mapM_ (check . fst) (Map.toList $ Map.intersection bs bi)+    let check b (Builtin x) (Builtin y)+              | x == y    = return ()+              | otherwise = typeError $ DuplicateBuiltinBinding b x y+        check _ _ _ = __IMPOSSIBLE__+    sequence_ $ Map.intersectionWithKey check bs bi     addImportedThings sig bi       (iPatternSyns i)       (iDisplayForms i)@@ -462,7 +458,24 @@        setCommandLineOptions . stPersistentOptions . stPersistentState =<< getTC       alreadyVisited x isMain currentOptions $ do-      file <- maybe (findFile x) (pure . srcOrigin) msrc -- may require source to exist+      file <- case msrc of+        Nothing  -> findFile x+        Just src -> do+          -- Andreas, 2021-08-17, issue #5508.+          -- So it happened with @msrc == Just{}@ that the file was not added to @ModuleToSource@,+          -- only with @msrc == Nothing@ (then @findFile@ does it).+          -- As a consequence, the file was added later, but with a file name constructed+          -- from a module name.  As #5508 shows, this can be fatal in case-insensitive file systems.+          -- The file name (with case variant) then no longer maps to the module name.+          -- To prevent this, we register the connection in @ModuleToSource@ here,+          -- where we have the correct spelling of the file name.+          let file = srcOrigin src+          modifyTCLens stModuleToSource $ Map.insert x (srcFilePath file)+          pure file+      reportSLn "import.iface" 15 $ List.intercalate "\n" $ map ("  " ++)+        [ "module: " ++ prettyShow x+        , "file:   " ++ prettyShow file+        ]        reportSLn "import.iface" 10 $ "  Check for cycle"       checkForImportCycle@@ -919,8 +932,7 @@     let srcPath = srcFilePath $ srcOrigin src      fileTokenInfo <- Bench.billTo [Bench.Highlighting] $-                       generateTokenInfoFromSource-                         srcPath (TL.unpack $ srcText src)+      generateTokenInfoFromSource srcPath (TL.unpack $ srcText src)     stTokens `modifyTCLens` (fileTokenInfo <>)      setOptionsFromSourcePragmas src
src/full/Agda/Interaction/InteractionTop.hs view
@@ -506,7 +506,7 @@           QuickLaTeX               -> callBackend "LaTeX" IsMain checkResult           OtherBackend "GHCNoMain" -> callBackend "GHC" NotMain checkResult   -- for backwards compatibility           OtherBackend b           -> callBackend b IsMain checkResult-        display_info . Info_CompilationOk =<< lift B.getWarningsAndNonFatalErrors+        display_info . Info_CompilationOk backend =<< lift B.getWarningsAndNonFatalErrors       w@(_:_) -> display_info $ Info_Error $ Info_CompilationError w   where   allowUnsolved = backend `elem` [LaTeX, QuickLaTeX]
src/full/Agda/Interaction/JSON.hs view
@@ -4,16 +4,22 @@ -- | Encoding stuff into JSON values in TCM  module Agda.Interaction.JSON-  ( EncodeTCM(..)+  ( module Export+  , EncodeTCM(..)   , obj, kind, kind'+  , (.=)   , (@=), (#=)-  , (>=>), (<=<)-  -- , ToRep(..), rep   ) where -import Control.Monad ((>=>), (<=<))-import Data.Aeson-import Data.Aeson.Types (Pair)+import Control.Monad as Export ((>=>), (<=<))+import Data.Aeson    as Export hiding (Result(..), (.=))++import qualified Data.Aeson+import Data.Aeson.Types ( Pair )+#if MIN_VERSION_aeson(2,0,0)+import qualified Data.Aeson.Key as Key+#endif+ import Data.Text (Text) import GHC.Int (Int32) @@ -27,6 +33,16 @@ import qualified Agda.Utils.FileName as File import qualified Agda.Utils.Maybe.Strict as Strict +#if MIN_VERSION_aeson(2,0,0)+toKey :: Text -> Key+toKey = Key.fromText+#else+type Key = Text++toKey :: Text -> Key+toKey = id+#endif+ --------------------------------------------------------------------------- -- * The EncodeTCM class @@ -39,6 +55,10 @@ -- | TCM monadic version of object obj :: [TCM Pair] -> TCM Value obj = (object <$>) . sequence++-- | A key-value pair for encoding a JSON object.+(.=) :: ToJSON a => Text -> a -> Pair+(.=) = (Data.Aeson..=) . toKey  -- | Pairs a key with a value wrapped in TCM (#=) :: (ToJSON a) => Text -> TCM a -> TCM Pair
src/full/Agda/Interaction/JSONTop.hs view
@@ -3,7 +3,6 @@     ) where import Control.Monad.State -import Data.Aeson hiding (Result(..)) import Data.ByteString.Lazy (ByteString) import qualified Data.ByteString.Lazy.Char8 as BS import qualified Data.Text as T@@ -252,8 +251,9 @@   encodeTCM (UnblockOnAny us)    = kind "UnblockOnAny" [ "blockers" @= Set.toList us ]  instance EncodeTCM DisplayInfo where-  encodeTCM (Info_CompilationOk wes) = kind "CompilationOk"-    [ "warnings"          #= encodeTCM (filterTCWarnings (tcWarnings wes))+  encodeTCM (Info_CompilationOk backend wes) = kind "CompilationOk"+    [ "backend"           @= encodePretty backend+    , "warnings"          #= encodeTCM (filterTCWarnings (tcWarnings wes))     , "errors"            #= encodeTCM (filterTCWarnings (nonFatalErrors wes))     ]   encodeTCM (Info_Constraints constraints) = kind "Constraints"
src/full/Agda/Interaction/Options/Base.hs view
@@ -63,6 +63,7 @@   ) import Agda.Interaction.Options.Warnings import Agda.Syntax.Concrete.Glyph ( unsafeSetUnicodeOrAscii, UnicodeOrAscii(..) )+import Agda.Syntax.Common (Cubical(..))  import Agda.Utils.FileName      ( AbsolutePath ) import Agda.Utils.Functor       ( (<&>) )@@ -156,7 +157,7 @@   , optForcing                   :: Bool  -- ^ Perform the forcing analysis on data constructors?   , optProjectionLike            :: Bool  -- ^ Perform the projection-likeness analysis on functions?   , optRewriting                 :: Bool  -- ^ Can rewrite rules be added and used?-  , optCubical                   :: Bool+  , optCubical                   :: Maybe Cubical   , optGuarded                   :: Bool   , optFirstOrder                :: Bool  -- ^ Should we speculatively unify function applications as if they were injective?   , optPostfixProjections        :: Bool@@ -286,7 +287,7 @@   , optForcing                   = True   , optProjectionLike            = True   , optRewriting                 = False-  , optCubical                   = False+  , optCubical                   = Nothing   , optGuarded                   = False   , optFirstOrder                = False   , optPostfixProjections        = False@@ -359,8 +360,10 @@   [ "--irrelevant-projections"                   | optIrrelevantProjections opts     ] ++   [ "--experimental-irrelevance"                 | optExperimentalIrrelevance opts   ] ++   [ "--rewriting"                                | optRewriting opts                 ] ++-  [ "--cubical and --with-K"                     | optCubical opts+  [ "--cubical and --with-K"                     | optCubical opts == Just CFull                                                  , not (collapseDefault $ optWithoutK opts) ] +++  [ "--erased-cubical and --with-K"              | optCubical opts == Just CErased+                                                 , not (collapseDefault $ optWithoutK opts) ] ++   [ "--cumulativity"                             | optCumulativity opts              ] ++   [ "--allow-exec"                               | optAllowExec opts                 ] ++   []@@ -393,7 +396,8 @@   , (B . optExactSplit, "--exact-split")   , (B . not . optEta, "--no-eta-equality")   , (B . optRewriting, "--rewriting")-  , (B . optCubical, "--cubical")+  , (B . (== Just CFull) . optCubical, "--cubical")+  , (B . (== Just CErased) . optCubical, "--erased-cubical")   , (B . optGuarded, "--guarded")   , (B . optOverlappingInstances, "--overlapping-instances")   , (B . optQualifiedInstances, "--qualified-instances")@@ -419,10 +423,14 @@  -- | An infective option is an option that if used in one module, must --   be used in all modules that depend on this module.+--+-- Note that @--cubical@ and @--erased-cubical@ are \"jointly+-- infective\": if one of them is used in one module, then one or the+-- other must be used in all modules that depend on this module.  infectiveOptions :: [(PragmaOptions -> Bool, String)] infectiveOptions =-  [ (optCubical, "--cubical")+  [ (isJust . optCubical, "--cubical/--erased-cubical")   , (optGuarded, "--guarded")   , (optProp, "--prop")   , (collapseDefault . optTwoLevel, "--two-level")@@ -698,10 +706,13 @@ firstOrderFlag :: Flag PragmaOptions firstOrderFlag o = return $ o { optFirstOrder = True } -cubicalFlag :: Flag PragmaOptions-cubicalFlag o = do+cubicalFlag+  :: Cubical  -- ^ Which variant of Cubical Agda?+  -> Flag PragmaOptions+cubicalFlag CErased _ = throwError "--erased-cubical is not available."+cubicalFlag variant o = do   let withoutK = optWithoutK o-  return $ o { optCubical  = True+  return $ o { optCubical  = Just variant              , optWithoutK = setDefault True withoutK              , optTwoLevel = setDefault True $ optTwoLevel o              }@@ -963,8 +974,10 @@                     "enable global confluence checking of REWRITE rules (more restrictive than --local-confluence-check)"     , Option []     ["no-confluence-check"] (NoArg noConfluenceCheckFlag)                     "disable confluence checking of REWRITE rules (default)"-    , Option []     ["cubical"] (NoArg cubicalFlag)+    , Option []     ["cubical"] (NoArg $ cubicalFlag CFull)                     "enable cubical features (e.g. overloads lambdas for paths), implies --without-K"+    , Option []     ["erased-cubical"] (NoArg $ cubicalFlag CErased)+                    "enable cubical features (some only in erased settings), implies --without-K"     , Option []     ["guarded"] (NoArg guardedFlag)                     "enable @lock/@tick attributes"     , Option []     ["experimental-lossy-unification"] (NoArg firstOrderFlag)
src/full/Agda/Interaction/Options/Warnings.hs view
@@ -124,6 +124,7 @@   [ CoverageIssue_   , GenericNonFatalError_   , MissingDefinitions_+  , MissingDeclarations_   , NotAllowedInMutual_   , NotStrictlyPositive_   , OverlappingTokensWarning_@@ -195,6 +196,7 @@   | InvalidNoUniverseCheckPragma_   | InvalidRecordDirective_   | InvalidTerminationCheckPragma_+  | MissingDeclarations_   | MissingDefinitions_   | NotAllowedInMutual_   | OpenPublicAbstract_@@ -351,6 +353,7 @@   InvalidNoUniverseCheckPragma_    -> "No universe checking pragmas before non-`data' or `record' declaration."   InvalidRecordDirective_          -> "No record directive outside of record definition / below field declarations."   InvalidTerminationCheckPragma_   -> "Termination checking pragmas before non-function or `mutual' blocks."+  MissingDeclarations_             -> "Definitions not associated to a declaration."   MissingDefinitions_              -> "Declarations not associated to a definition."   NotAllowedInMutual_              -> "Declarations not allowed in a mutual block."   OpenPublicAbstract_              -> "'open public' directive in an 'abstract' block."
src/full/Agda/Interaction/Response.hs view
@@ -20,7 +20,14 @@   ) where  import Agda.Interaction.Base-  (CommandState, OutputForm, ComputeMode, Rewrite, OutputConstraint, OutputConstraint')+  ( CommandState+  , CompilerBackend+  , ComputeMode+  , OutputConstraint+  , OutputConstraint'+  , OutputForm+  , Rewrite+  ) import Agda.Interaction.Highlighting.Precise import qualified Agda.Syntax.Abstract as A import Agda.Syntax.Common   (InteractionId(..), Arg)@@ -87,7 +94,7 @@ -- | Info to display at the end of an interactive command  data DisplayInfo-    = Info_CompilationOk WarningsAndNonFatalErrors+    = Info_CompilationOk CompilerBackend WarningsAndNonFatalErrors     | Info_Constraints [OutputForm Expr Expr]     | Info_AllGoalsWarnings Goals WarningsAndNonFatalErrors     | Info_Time CPUTime
src/full/Agda/Syntax/Abstract.hs view
@@ -110,8 +110,6 @@   | Quote ExprInfo                     -- ^ Quote an identifier 'QName'.   | QuoteTerm ExprInfo                 -- ^ Quote a term.   | Unquote ExprInfo                   -- ^ The splicing construct: unquote ...-  | Tactic ExprInfo Expr [NamedArg Expr]-                                       -- ^ @tactic e x1 .. xn@   | DontCare Expr                      -- ^ For printing @DontCare@ from @Syntax.Internal@.   deriving (Data, Show, Generic) @@ -557,7 +555,6 @@   Quote a1                   == Quote a2                   = a1 == a2   QuoteTerm a1               == QuoteTerm a2               = a1 == a2   Unquote a1                 == Unquote a2                 = a1 == a2-  Tactic a1 b1 c1            == Tactic a2 b2 c2            = (a1, b1, c1) == (a2, b2, c2)   DontCare a1                == DontCare a2                = a1 == a2    _                          == _                          = False@@ -640,7 +637,6 @@     getRange (Quote i)               = getRange i     getRange (QuoteTerm i)           = getRange i     getRange (Unquote i)             = getRange i-    getRange (Tactic i _ _)          = getRange i     getRange (DontCare{})            = noRange     getRange (PatternSyn x)          = getRange x     getRange (Macro x)               = getRange x@@ -771,7 +767,6 @@   killRange (Quote i)                = killRange1 Quote i   killRange (QuoteTerm i)            = killRange1 QuoteTerm i   killRange (Unquote i)              = killRange1 Unquote i-  killRange (Tactic i e xs)          = killRange3 Tactic i e xs   killRange (DontCare e)             = killRange1 DontCare e   killRange (PatternSyn x)           = killRange1 PatternSyn x   killRange (Macro x)                = killRange1 Macro x@@ -1052,7 +1047,6 @@     Quote{}         -> __IMPOSSIBLE__     QuoteTerm{}     -> __IMPOSSIBLE__     Unquote{}       -> __IMPOSSIBLE__-    Tactic{}        -> __IMPOSSIBLE__     DontCare{}      -> __IMPOSSIBLE__     Macro{}         -> __IMPOSSIBLE__ 
src/full/Agda/Syntax/Abstract/Name.hs view
@@ -239,7 +239,7 @@ qualifyM m1 m2 = mnameFromList $ mnameToList m1 ++ mnameToList m2  qualifyQ :: ModuleName -> QName -> QName-qualifyQ m x = qnameFromList $ mnameToList m `List1.prepend` qnameToList x+qualifyQ m x = qnameFromList $ mnameToList m `List1.prependList` qnameToList x  qualify :: ModuleName -> Name -> QName qualify = QName
src/full/Agda/Syntax/Abstract/PatternSynonyms.hs view
@@ -14,7 +14,6 @@ import Data.Map (Map) import qualified Data.Map as Map import Data.Traversable (forM)-import Data.List import Data.Void  import Agda.Syntax.Common
src/full/Agda/Syntax/Abstract/Views.hs view
@@ -166,7 +166,6 @@       Unquote{}                  -> pure e0       DontCare e                 -> DontCare <$> recurse e       PatternSyn{}               -> pure e0-      Tactic ei e xs             -> Tactic ei <$> recurse e <*> recurse xs       Macro{}                    -> pure e0    foldExpr :: forall m. FoldExprFn m Expr@@ -198,7 +197,6 @@       Quote{}                -> m       QuoteTerm{}            -> m       Unquote{}              -> m-      Tactic _ e xs          -> m `mappend` fold e `mappend` fold xs       DontCare e             -> m `mappend` fold e    where      m = f e@@ -235,7 +233,6 @@       Quote{}                    -> f e       QuoteTerm{}                -> f e       Unquote{}                  -> f e-      Tactic ei e xs             -> f =<< Tactic ei <$> trav e <*> trav xs       DontCare e                 -> f =<< DontCare <$> trav e       PatternSyn{}               -> f e       Macro{}                    -> f e@@ -585,7 +582,6 @@ --     Quote{}               -> mempty --     QuoteTerm{}           -> mempty --     Unquote{}             -> mempty---     Tactic _ e xs         -> declaredNames e <> declaredNames xs --     DontCare{}            -> mempty --     PatternSyn{}          -> mempty --     Macro{}               -> mempty
src/full/Agda/Syntax/Common.hs view
@@ -75,6 +75,32 @@ instance NFData FileType  ---------------------------------------------------------------------------+-- * Agda variants+---------------------------------------------------------------------------++-- | Variants of Cubical Agda.++data Cubical = CErased | CFull+    deriving (Eq, Show, Generic)++instance NFData Cubical++-- | Agda variants.+--+-- Only some variants are tracked.++data Language+  = WithoutK+  | WithK+  | Cubical Cubical+    deriving (Eq, Show, Generic)++instance KillRange Language where+  killRange = id++instance NFData Language++--------------------------------------------------------------------------- -- * Record Directives --------------------------------------------------------------------------- @@ -976,12 +1002,20 @@ defaultErased :: Erased defaultErased = NotErased QωInferred --- 'Erased' can be converted into 'Quantity'.+-- | 'Erased' can be embedded into 'Quantity'.  asQuantity :: Erased -> Quantity asQuantity (Erased    o) = Quantity0 o asQuantity (NotErased o) = Quantityω o +-- | 'Quantity' can be projected onto 'Erased'.++erasedFromQuantity :: Quantity -> Maybe Erased+erasedFromQuantity = \case+  Quantity1{} -> Nothing+  Quantity0 o -> Just $ Erased    o+  Quantityω o -> Just $ NotErased o+ -- | Equality ignoring origin.  sameErased :: Erased -> Erased -> Bool@@ -2859,6 +2893,15 @@ instance Null ExpandedEllipsis where   null  = (== NoEllipsis)   empty = NoEllipsis++instance Semigroup ExpandedEllipsis where+  NoEllipsis <> e          = e+  e          <> NoEllipsis = e+  (ExpandedEllipsis r1 k1) <> (ExpandedEllipsis r2 k2) = ExpandedEllipsis (r1 <> r2) (k1 + k2)++instance Monoid ExpandedEllipsis where+  mempty  = NoEllipsis+  mappend = (<>)  instance KillRange ExpandedEllipsis where   killRange (ExpandedEllipsis _ k) = ExpandedEllipsis noRange k
src/full/Agda/Syntax/Concrete.hs view
@@ -444,8 +444,8 @@  data Declaration   = TypeSig ArgInfo TacticAttribute Name Expr+      -- ^ Axioms and functions can be irrelevant. (Hiding should be NotHidden)   | FieldSig IsInstance TacticAttribute Name (Arg Expr)-  -- ^ Axioms and functions can be irrelevant. (Hiding should be NotHidden)   | Generalize Range [TypeSignature] -- ^ Variables to be generalized, can be hidden and/or irrelevant.   | Field Range [FieldSignature]   | FunClause LHS RHS WhereClause Bool
src/full/Agda/Syntax/Concrete/Attribute.hs view
@@ -19,7 +19,7 @@ import Agda.Utils.List1 (List1, pattern (:|)) import Agda.Utils.Pretty (prettyShow) --- import Agda.Utils.Functor+import Agda.Utils.Impossible  -- | An attribute is a modifier for `ArgInfo`. @@ -105,7 +105,7 @@ -- | Concrete syntax for all attributes.  attributesMap :: Map String Attribute-attributesMap = Map.fromList $ concat+attributesMap = Map.fromListWith __IMPOSSIBLE__ $ concat   [ map (second RelevanceAttribute) relevanceAttributeTable   , map (second QuantityAttribute)  quantityAttributeTable   , map (second CohesionAttribute)  cohesionAttributeTable
src/full/Agda/Syntax/Concrete/Definitions.hs view
@@ -89,7 +89,7 @@ import Agda.Utils.Functor import Agda.Utils.Lens import Agda.Utils.List (isSublistOf, spanJust)-import Agda.Utils.List1 (List1, pattern (:|))+import Agda.Utils.List1 (List1, pattern (:|), (<|)) import qualified Agda.Utils.List1 as List1 import Agda.Utils.Maybe import Agda.Utils.Null@@ -814,8 +814,8 @@          ------------------------------------------------------------------------------         -- Adding Signatures-        addType :: Name -> (Int -> a) -> MutualChecks-                -> StateT (Map Name a, MutualChecks, Int) Nice ()+        addType :: Name -> (DeclNum -> a) -> MutualChecks+                -> StateT (Map Name a, MutualChecks, DeclNum) Nice ()         addType n c mc = do           (m, checks, i) <- get           when (isJust $ Map.lookup n m) $ lift $ declarationException $ DuplicateDefinition n@@ -823,37 +823,42 @@          addFunType d@(FunSig _ _ _ _ _ _ tc cc n _) = do            let checks = MutualChecks [tc] [cc] []-           addType n (\ i -> InterleavedFun (i, d) Nothing) checks+           addType n (\ i -> InterleavedFun i d Nothing) checks         addFunType _ = __IMPOSSIBLE__          addDataType d@(NiceDataSig _ _ _ pc uc n _ _) = do           let checks = MutualChecks [] [] [pc]-          addType n (\ i -> InterleavedData (i, d) Nothing) checks+          addType n (\ i -> InterleavedData i d Nothing) checks         addDataType _ = __IMPOSSIBLE__          ------------------------------------------------------------------------------         -- Adding constructors & clauses -        addDataConstructors :: Maybe Name         -- Data type the constructors belong to+        addDataConstructors :: Maybe Range        -- Range of the `data A where` (if any)+                            -> Maybe Name         -- Data type the constructors belong to                             -> [NiceConstructor]  -- Constructors to add-                            -> StateT (InterleavedMutual, MutualChecks, Int) Nice ()+                            -> StateT (InterleavedMutual, MutualChecks, DeclNum) Nice ()         -- if we know the type's name, we can go ahead-        addDataConstructors (Just n) ds = do+        addDataConstructors mr (Just n) ds = do           (m, checks, i) <- get           case Map.lookup n m of-            Just (InterleavedData (i0, sig) cs) -> do+            Just (InterleavedData i0 sig cs) -> do               lift $ removeLoneSig n               -- add the constructors to the existing ones (if any)               let (cs', i') = case cs of-                    Nothing        -> ((i, [ds])   , i+1)-                    Just (i1, ds1) -> ((i1, ds:ds1), i)-              put (Map.insert n (InterleavedData (i0, sig) (Just cs')) m, checks, i')-            _ -> __IMPOSSIBLE__ -- we have resolved the name `n` already and it comes from a DataSig!+                    Nothing        -> ((i , ds :| [] ), i+1)+                    Just (i1, ds1) -> ((i1, ds <| ds1), i)+              put (Map.insert n (InterleavedData i0 sig (Just cs')) m, checks, i')+            _ -> lift $ declarationWarning $ MissingDeclarations $ case mr of+                   Just r -> [(n, r)]+                   Nothing -> flip foldMap ds $ \case+                     Axiom r _ _ _ _ n _ -> [(n, r)]+                     _ -> __IMPOSSIBLE__ -        addDataConstructors Nothing [] = pure ()+        addDataConstructors mr Nothing [] = pure ()          -- Otherwise we try to guess which datasig the constructor is referring to-        addDataConstructors Nothing (d : ds) = do+        addDataConstructors mr Nothing (d : ds) = do           -- get the candidate data types that are in this interleaved mutual block           (m, _, _) <- get           let sigs = mapMaybe (\ (n, d) -> n <$ isInterleavedData d) $ Map.toList m@@ -862,26 +867,26 @@             Right n -> do               -- if so grab the whole block that may work and add them               let (ds0, ds1) = span (isRight . isConstructor [n]) ds-              addDataConstructors (Just n) (d : ds0)+              addDataConstructors Nothing (Just n) (d : ds0)               -- and then repeat the process for the rest of the block-              addDataConstructors Nothing ds1+              addDataConstructors Nothing Nothing ds1             Left (n, ns) -> lift $ declarationException $ AmbiguousConstructor (getRange d) n ns -        addFunDef :: NiceDeclaration -> StateT (InterleavedMutual, MutualChecks, Int) Nice ()+        addFunDef :: NiceDeclaration -> StateT (InterleavedMutual, MutualChecks, DeclNum) Nice ()         addFunDef (FunDef _ ds _ _ tc cc n cs) = do           let check = MutualChecks [tc] [cc] []           (m, checks, i) <- get           case Map.lookup n m of-            Just (InterleavedFun (i0, sig) cs0) -> do+            Just (InterleavedFun i0 sig cs0) -> do               let (cs', i') = case cs0 of-                    Nothing        -> ((i, [(ds, cs)]) , i+1)-                    Just (i1, cs1) -> ((i1, (ds, cs):cs1), i)-              put (Map.insert n (InterleavedFun (i0, sig) (Just cs')) m, check <> checks, i')+                    Nothing        -> ((i,  (ds, cs) :| [] ), i+1)+                    Just (i1, cs1) -> ((i1, (ds, cs) <| cs1), i)+              put (Map.insert n (InterleavedFun i0 sig (Just cs')) m, check <> checks, i')             _ -> __IMPOSSIBLE__ -- A FunDef always come after an existing FunSig!         addFunDef _ = __IMPOSSIBLE__          addFunClauses :: Range -> [NiceDeclaration]-                      -> StateT (InterleavedMutual, MutualChecks, Int) Nice [(Int, NiceDeclaration)]+                      -> StateT (InterleavedMutual, MutualChecks, DeclNum) Nice [(DeclNum, NiceDeclaration)]         addFunClauses r (nd@(NiceFunClause _ _ _ tc cc _ d@(FunClause lhs _ _ _)) : ds) = do           -- get the candidate functions that are in this interleaved mutual block           (m, checks, i) <- get@@ -903,12 +908,12 @@               ds <- lift $ expandEllipsis fits               cs <- lift $ mkClauses n ds False               case Map.lookup n m of-                Just (InterleavedFun (i0, sig) cs0) -> do+                Just (InterleavedFun i0 sig cs0) -> do                   let (cs', i') = case cs0 of-                        Nothing        -> ((i, [(fits,cs)]), i+1)-                        Just (i1, cs1) -> ((i1, (fits,cs):cs1), i)+                        Nothing        -> ((i,  (fits,cs) :| [] ), i+1)+                        Just (i1, cs1) -> ((i1, (fits,cs) <| cs1), i)                   let checks' = Fold.fold checkss-                  put (Map.insert n (InterleavedFun (i0, sig) (Just cs')) m, checks' <> checks, i')+                  put (Map.insert n (InterleavedFun i0 sig (Just cs')) m, checks' <> checks, i')                 _ -> __IMPOSSIBLE__               groupByBlocks r rest             -- more than one candidate: fail, complaining about the ambiguity!@@ -918,15 +923,15 @@         addFunClauses _ _ = __IMPOSSIBLE__          groupByBlocks :: Range -> [NiceDeclaration]-                      -> StateT (InterleavedMutual, MutualChecks, Int) Nice [(Int, NiceDeclaration)]+                      -> StateT (InterleavedMutual, MutualChecks, DeclNum) Nice [(DeclNum, NiceDeclaration)]         groupByBlocks r []       = pure []         groupByBlocks r (d : ds) = do           -- for most branches we deal with the one declaration and move on           let oneOff act = act >>= \ ns -> (ns ++) <$> groupByBlocks r ds           case d of             NiceDataSig{}                -> oneOff $ [] <$ addDataType d-            NiceDataDef _ _ _ _ _ n _ ds -> oneOff $ [] <$ addDataConstructors (Just n) ds-            NiceLoneConstructor r ds     -> oneOff $ [] <$ addDataConstructors Nothing ds+            NiceDataDef r _ _ _ _ n _ ds -> oneOff $ [] <$ addDataConstructors (Just r) (Just n) ds+            NiceLoneConstructor r ds     -> oneOff $ [] <$ addDataConstructors Nothing Nothing ds             FunSig{}                     -> oneOff $ [] <$ addFunType d             FunDef _ _ _  _ _ _ n cs                       | not (isNoName n) -> oneOff $ [] <$ addFunDef d
src/full/Agda/Syntax/Concrete/Definitions/Errors.hs view
@@ -90,6 +90,8 @@   | InvalidTerminationCheckPragma Range       -- ^ A {-\# TERMINATING \#-} and {-\# NON_TERMINATING \#-} pragma       --   that does not apply to any function.+  | MissingDeclarations [(Name, Range)]+      -- ^ Definitions (e.g. constructors or functions) without a declaration.   | MissingDefinitions [(Name, Range)]       -- ^ Declarations (e.g. type signatures) without a definition.   | NotAllowedInMutual Range String@@ -139,6 +141,7 @@   InvalidRecordDirective{}          -> InvalidRecordDirective_   InvalidTerminationCheckPragma{}   -> InvalidTerminationCheckPragma_   InvalidCoverageCheckPragma{}      -> InvalidCoverageCheckPragma_+  MissingDeclarations{}             -> MissingDeclarations_   MissingDefinitions{}              -> MissingDefinitions_   NotAllowedInMutual{}              -> NotAllowedInMutual_   OpenPublicPrivate{}               -> OpenPublicPrivate_@@ -179,6 +182,7 @@   InvalidRecordDirective{}          -> False   InvalidTerminationCheckPragma{}   -> False   InvalidCoverageCheckPragma{}      -> False+  MissingDeclarations{}             -> True  -- not safe   MissingDefinitions{}              -> True  -- not safe   NotAllowedInMutual{}              -> False -- really safe?   OpenPublicPrivate{}               -> False@@ -223,6 +227,7 @@   getRange (UnknownFixityInMixfixDecl xs)       = getRange xs   getRange (UnknownNamesInPolarityPragmas xs)   = getRange xs   getRange (PolarityPragmasButNotPostulates xs) = getRange xs+  getRange (MissingDeclarations xs)             = getRange xs   getRange (MissingDefinitions xs)              = getRange xs   getRange (UselessPrivate r)                   = r   getRange (NotAllowedInMutual r x)             = r@@ -308,6 +313,9 @@   pretty (UnknownNamesInPolarityPragmas xs) = fsep $     pwords "The following names are not declared in the same scope as their polarity pragmas (they could for instance be out of scope, imported from another module, or declared in a super module):"     ++ punctuate comma  (map pretty xs)+  pretty (MissingDeclarations xs) = fsep $+   pwords "The following names are defined but not accompanied by a declaration:"+   ++ punctuate comma (map (pretty . fst) xs)   pretty (MissingDefinitions xs) = fsep $    pwords "The following names are declared but not accompanied by a definition:"    ++ punctuate comma (map (pretty . fst) xs)
src/full/Agda/Syntax/Concrete/Definitions/Monad.hs view
@@ -16,6 +16,8 @@ import Agda.Utils.CallStack ( CallStack, HasCallStack, withCallerCallStack ) import Agda.Utils.Lens +import Agda.Utils.Impossible+ -- | Nicifier monad. --   Preserve the state when throwing an exception. @@ -155,7 +157,7 @@ -- | Create a 'LoneSigs' map from an association list.  loneSigsFromLoneNames :: [(Range, Name, DataRecOrFun)] -> LoneSigs-loneSigsFromLoneNames = Map.fromList . map (\(r,x,k) -> (x, LoneSig r x k))+loneSigsFromLoneNames = Map.fromListWith __IMPOSSIBLE__ . map (\(r,x,k) -> (x, LoneSig r x k))  -- | Lens for field '_termChk'. 
src/full/Agda/Syntax/Concrete/Definitions/Types.hs view
@@ -17,6 +17,8 @@  import Agda.Utils.Pretty import Agda.Utils.Impossible+import Agda.Utils.List1 (List1)+import qualified Agda.Utils.List1 as List1  {--------------------------------------------------------------------------     Types@@ -142,14 +144,25 @@  data InterleavedDecl   = InterleavedData-    { infixDataSig  :: (Int, NiceDeclaration)           -- a data signature-    , infixDataCons :: Maybe (Int, [[NiceConstructor]]) -- and associated constructors+    { interleavedDeclNum  :: DeclNum+        -- ^ Internal number of the data signature.+    , interleavedDeclSig  :: NiceDeclaration+        -- ^ The data signature.+    , interleavedDataCons :: Maybe (DeclNum, List1 [NiceConstructor])+        -- ^ Constructors associated to the data signature.     }   | InterleavedFun-    { infixFunSig     :: (Int, NiceDeclaration)                  -- a fun signature-    , infixFunClauses :: Maybe (Int, [([Declaration],[Clause])]) -- and associated fun clauses+    { interleavedDeclNum  :: DeclNum+        -- ^ Internal number of the function signature.+    , interleavedDeclSig  :: NiceDeclaration+        -- ^ The function signature.+    , interleavedFunClauses :: Maybe (DeclNum, List1 ([Declaration],[Clause]))+        -- ^ Function clauses associated to the function signature.     } +-- | Numbering declarations in an @interleaved mutual@ block.+type DeclNum = Int+ isInterleavedFun :: InterleavedDecl -> Maybe () isInterleavedFun InterleavedFun{} = Just () isInterleavedFun _ = Nothing@@ -158,16 +171,16 @@ isInterleavedData InterleavedData{} = Just () isInterleavedData _ = Nothing -interleavedDecl :: Name -> InterleavedDecl -> [(Int, NiceDeclaration)]+interleavedDecl :: Name -> InterleavedDecl -> [(DeclNum, NiceDeclaration)] interleavedDecl k = \case-  InterleavedData (i, d@(NiceDataSig _ acc abs pc uc _ pars _)) ds ->+  InterleavedData i d@(NiceDataSig _ acc abs pc uc _ pars _) ds ->     let fpars = concatMap dropTypeAndModality pars         ddef  = NiceDataDef noRange UserWritten abs pc uc k fpars-    in (i,d) : maybe [] (\ (j, dss) -> [(j, ddef (concat (reverse dss)))]) ds-  InterleavedFun (i, d@(FunSig r acc abs inst mac info tc cc n e)) dcs ->-    let fdef dcss = let (dss, css) = unzip dcss in-                    FunDef r (concat dss) abs inst tc cc n (concat css)-    in (i,d) : maybe [] (\ (j, dcss) -> [(j, fdef (reverse dcss))]) dcs+    in (i,d) : maybe [] (\ (j, dss) -> [(j, ddef (sconcat (List1.reverse dss)))]) ds+  InterleavedFun i d@(FunSig r acc abs inst mac info tc cc n e) dcs ->+    let fdef dcss = let (dss, css) = List1.unzip dcss in+                    FunDef r (sconcat dss) abs inst tc cc n (sconcat css)+    in (i,d) : maybe [] (\ (j, dcss) -> [(j, fdef (List1.reverse dcss))]) dcs   _ -> __IMPOSSIBLE__ -- someone messed up and broke the invariant  -- | Several declarations expect only type signatures as sub-declarations.  These are:
src/full/Agda/Syntax/Concrete/Operators.hs view
@@ -147,7 +147,7 @@   , flattenedScope :: FlatScope     -- ^ A flattened scope that only contains those names that are     -- unqualified or qualified by qualifiers that occur in the list-    -- of names given to 'buildParser'.+    -- of names given to 'buildParsers'.   }  -- | Builds parsers for operator applications from all the operators@@ -782,7 +782,7 @@   loop acc = \case     AppP p a         -> loop (namedArg a : acc) p     OpAppP _ op _ ps -> (IdentP op :| fmap namedArg ps)-                          `List1.append`+                          `List1.appendList`                         reverse acc     ParenP _ p       -> loop acc p     RawAppP _ _      -> __IMPOSSIBLE__
src/full/Agda/Syntax/Concrete/Pattern.hs view
@@ -377,7 +377,7 @@ --  Pattern needs to be parsed already (operators resolved). patternAppView :: Pattern -> List1 (NamedArg Pattern) patternAppView = \case-    AppP p arg      -> patternAppView p `List1.append` [arg]+    AppP p arg      -> patternAppView p `List1.appendList` [arg]     OpAppP _ x _ ps -> defaultNamedArg (IdentP x) :| ps     ParenP _ p      -> patternAppView p     RawAppP _ _     -> __IMPOSSIBLE__
src/full/Agda/Syntax/Parser.hs view
@@ -141,7 +141,7 @@   let (terms, overlaps) = interleaveRanges (map Left code) (map Right literate)    forM_ (map fst overlaps) $ \c ->-    warning$ OverlappingTokensWarning { warnRange = getRange c }+    warning $ OverlappingTokensWarning { warnRange = getRange c }    return $ forMaybe terms $ \case     Left t                           -> Just t
src/full/Agda/Syntax/Parser/LexActions.hs view
@@ -23,7 +23,7 @@  import Data.Bifunctor import Data.Char-import Data.List+import Data.Foldable (foldl') import Data.Maybe  import Agda.Syntax.Common (pattern Ranged)
src/full/Agda/Syntax/Parser/Lexer.x view
@@ -151,46 +151,46 @@ <empty_layout_> ()              { emptyLayout }  -- Keywords-<0,code> let            { keyword KwLet }-<0,code> in             { keyword KwIn }-<0,code> where          { keyword KwWhere }-<0,code> do             { keyword KwDo }-<0,code> field          { keyword KwField }-<0,code> with           { keyword KwWith }-<0,code> rewrite        { keyword KwRewrite }-<0,code> postulate      { keyword KwPostulate }-<0,code> primitive      { keyword KwPrimitive }-<0,code> open           { keyword KwOpen }-<0,code> import         { keyword KwImport }-<0,code> module         { keyword KwModule }-<0,code> data           { keyword KwData }-<0,code> codata         { keyword KwCoData }-<0,code> record         { keyword KwRecord }-<0,code> constructor    { keyword KwConstructor }-<0,code> inductive      { keyword KwInductive }-<0,code> coinductive    { keyword KwCoInductive }+<0,code> abstract          { keyword KwAbstract }+<0,code> codata            { keyword KwCoData }+<0,code> coinductive       { keyword KwCoInductive }+<0,code> constructor       { keyword KwConstructor }+<0,code> data              { keyword KwData }+<0,code> do                { keyword KwDo } <0,code> "eta-equality"    { keyword KwEta }+<0,code> field             { keyword KwField }+<0,code> forall            { keyword KwForall }+<0,code> import            { keyword KwImport }+<0,code> in                { keyword KwIn }+<0,code> inductive         { keyword KwInductive }+<0,code> infix             { keyword KwInfix }+<0,code> infixl            { keyword KwInfixL }+<0,code> infixr            { keyword KwInfixR }+<0,code> instance          { keyword KwInstance }+<0,code> interleaved       { keyword KwInterleaved }+<0,code> let               { keyword KwLet }+<0,code> macro             { keyword KwMacro }+<0,code> module            { keyword KwModule }+<0,code> mutual            { keyword KwMutual } <0,code> "no-eta-equality" { keyword KwNoEta }-<0,code> infix          { keyword KwInfix }-<0,code> infixl         { keyword KwInfixL }-<0,code> infixr         { keyword KwInfixR }-<0,code> interleaved    { keyword KwInterleaved }-<0,code> mutual         { keyword KwMutual }-<0,code> abstract       { keyword KwAbstract }-<0,code> private        { keyword KwPrivate }-<0,code> instance       { keyword KwInstance }-<0,code> overlap        { keyword KwOverlap }-<0,code> macro          { keyword KwMacro }-<0,code> forall         { keyword KwForall }-<0,code> quote          { keyword KwQuote }-<0,code> quoteTerm      { keyword KwQuoteTerm }-<0,code> unquote        { keyword KwUnquote }-<0,code> unquoteDecl    { keyword KwUnquoteDecl }-<0,code> unquoteDef     { keyword KwUnquoteDef  }-<0,code> tactic         { keyword KwTactic }-<0,code> syntax         { keyword KwSyntax }-<0,code> pattern        { keyword KwPatternSyn }-<0,code> variable       { keyword KwVariable }+<0,code> open              { keyword KwOpen }+<0,code> overlap           { keyword KwOverlap }+<0,code> pattern           { keyword KwPatternSyn }+<0,code> postulate         { keyword KwPostulate }+<0,code> primitive         { keyword KwPrimitive }+<0,code> private           { keyword KwPrivate }+<0,code> quote             { keyword KwQuote }+<0,code> quoteTerm         { keyword KwQuoteTerm }+<0,code> record            { keyword KwRecord }+<0,code> rewrite           { keyword KwRewrite }+<0,code> syntax            { keyword KwSyntax }+<0,code> tactic            { keyword KwTactic }+<0,code> unquote           { keyword KwUnquote }+<0,code> unquoteDecl       { keyword KwUnquoteDecl }+<0,code> unquoteDef        { keyword KwUnquoteDef  }+<0,code> variable          { keyword KwVariable }+<0,code> where             { keyword KwWhere }+<0,code> with              { keyword KwWith }  -- The parser is responsible to put the lexer in the imp_dir_ state when it -- expects an import directive keyword. This means that if you run the
src/full/Agda/Syntax/Parser/Literate.hs view
@@ -21,16 +21,20 @@   )   where -import Prelude hiding (getLine) import Control.Monad ((<=<)) import Data.Char (isSpace) import Data.List (isPrefixOf) import Text.Regex.TDFA+  ( Regex, getAllTextSubmatches, match, matchM+  , makeRegexOpts, blankCompOpt, blankExecOpt, newSyntax, caseSensitive+  )  import Agda.Syntax.Common import Agda.Syntax.Position  import Agda.Utils.List+import qualified Agda.Utils.List1 as List1+ import Agda.Utils.Impossible  -- | Role of a character in the file.@@ -127,10 +131,7 @@ -- | Replaces non-space characters in a string with spaces.  bleach :: String -> String-bleach s = map go s-  where-  go c | isSpace c = c-  go _             = ' '+bleach = map $ \ c -> if isSpace c && c /= '\t' then c else ' '  -- | Check if a character is a blank character. @@ -143,22 +144,15 @@ literateExtsShortList :: [String] literateExtsShortList = [".lagda"] --- | Breaks a list just /after/ an element satisfying the predicate is---   found.------   >>> break1 even [1,3,5,2,4,7,8]---   ([1,3,5,2],[4,7,8])--break1 :: (a -> Bool) -> [a] -> ([a],[a])-break1 _ []           =  ([], [])-break1 p (x:xs) | p x = (x:[],xs)-break1 p (x:xs)       = let (ys,zs) = break1 p xs in (x:ys,zs)- -- | Returns a tuple consisting of the first line of the input, and the rest --   of the input. -getLine :: String -> (String, String)-getLine = break1 (== '\n')+caseLine :: a -> (String -> String -> a) -> String -> a+caseLine a k = \case+  []   -> a+  x:xs -> k (List1.toList line) rest+    where+    (line, rest) = breakAfter1 (== '\n') x xs  -- | Canonical decomposition of an empty literate file. @@ -180,22 +174,18 @@ literateTeX pos s = mkLayers pos (tex s)   where   tex :: String -> [(LayerRole, String)]-  tex [] = []-  tex s  =-    let (line, rest) = getLine s in+  tex = caseLine [] $ \ line rest ->     case r_begin `matchM` line of       Just (getAllTextSubmatches -> [_, pre, _, markup, whitespace]) ->         (Comment, pre) : (Markup, markup) :         (Code, whitespace) : code rest       Just _  -> __IMPOSSIBLE__-      Nothing -> (Comment, line):tex rest+      Nothing -> (Comment, line) : tex rest    r_begin = rex "(([^\\%]|\\\\.)*)(\\\\begin\\{code\\}[^\n]*)(\n)?"    code :: String -> [(LayerRole, String)]-  code [] = []-  code s  =-    let (line, rest) = getLine s in+  code = caseLine [] $ \ line rest ->     case r_end `matchM` line of       Just (getAllTextSubmatches -> [_, code, markup, post]) ->         (Code, code) : (Markup, markup) : (Comment, post) : tex rest@@ -207,12 +197,10 @@ -- | Preprocessor for Markdown.  literateMd :: Position -> String -> [Layer]-literateMd pos s = mkLayers pos$ md s+literateMd pos s = mkLayers pos $ md s   where   md :: String -> [(LayerRole, String)]-  md [] = []-  md s  =-    let (line, rest) = getLine s in+  md = caseLine [] $ \ line rest ->     case md_begin `matchM` line of       Just (getAllTextSubmatches -> [_, pre, markup, _]) ->         (Comment, pre) : (Markup, markup) : code rest@@ -227,9 +215,7 @@   md_begin_other = rex "[[:space:]]*```[a-zA-Z0-9-]*[[:space:]]*"    code :: String -> [(LayerRole, String)]-  code [] = []-  code s  =-    let (line, rest) = getLine s in+  code = caseLine [] $ \ line rest ->     case md_end `matchM` line of       Just (getAllTextSubmatches -> [_, markup]) ->         (Markup, markup) : md rest@@ -238,9 +224,7 @@    -- A non-Agda code block.   code_other :: String -> [(LayerRole, String)]-  code_other [] = []-  code_other s  =-    let (line, rest) = getLine s in+  code_other = caseLine [] $ \ line rest ->     (Comment, line) :     if md_end `match` line     then md rest@@ -251,13 +235,12 @@ -- | Preprocessor for reStructuredText.  literateRsT :: Position -> String -> [Layer]-literateRsT pos s = mkLayers pos$ rst s+literateRsT pos s = mkLayers pos $ rst s   where   rst :: String -> [(LayerRole, String)]-  rst [] = []-  rst s  = maybe_code s+  rst = caseLine [] maybe_code -  maybe_code s =+  maybe_code line rest =     if r_comment `match` line then       not_code     else case r_code `match` line of@@ -270,30 +253,25 @@           (Comment, before ++ ":") : (Markup, ":" ++ after) : code rest       _ -> __IMPOSSIBLE__     where-    (line, rest) = getLine s     not_code     = (Comment, line) : rst rest    -- Finds the next indented block in the input.   code :: String -> [(LayerRole, String)]-  code [] = []-  code s  =-    let (line, rest) = getLine s in+  code = caseLine [] $ \ line rest ->     if all isSpace line then       (Markup, line) : code rest     else       let xs = takeWhile isBlank line in       if null xs-      then maybe_code s+      then maybe_code line rest       else (Code, line) : indented xs rest    -- Process an indented block.   indented :: String -> String -> [(LayerRole, String)]-  indented _ [] = []-  indented ind s =-    let (line, rest) = getLine s-    in  if all isSpace line || (ind `isPrefixOf` line)+  indented ind = caseLine [] $ \ line rest ->+    if all isSpace line || (ind `isPrefixOf` line)           then (Code, line) : indented ind rest-          else maybe_code s+          else maybe_code line rest    -- Beginning of a code block.   r_code = rex "(.*)(::)([[:space:]]*)"@@ -304,12 +282,10 @@ -- | Preprocessor for Org mode documents.  literateOrg :: Position -> String -> [Layer]-literateOrg pos s = mkLayers pos$ org s+literateOrg pos s = mkLayers pos $ org s   where   org :: String -> [(LayerRole, String)]-  org [] = []-  org s  =-    let (line, rest) = getLine s in+  org = caseLine [] $ \ line rest ->     if org_begin `match` line then       (Markup, line) : code rest     else@@ -321,9 +297,7 @@   org_begin = rex' "\\`(.*)([[:space:]]*\\#\\+begin_src agda2[[:space:]]+)"    code :: String -> [(LayerRole, String)]-  code [] = []-  code s  =-    let (line, rest) = getLine s in+  code = caseLine [] $ \ line rest ->     if org_end `match` line then       (Markup, line) : org rest     else
src/full/Agda/Syntax/Parser/LookAhead.hs view
@@ -24,6 +24,9 @@ import Agda.Syntax.Parser.Alex import Agda.Syntax.Parser.Monad +import Agda.Utils.Null (ifNull)+import Agda.Utils.Maybe (caseMaybeM, fromMaybeM)+ {--------------------------------------------------------------------------     The look-ahead monad  --------------------------------------------------------------------------}@@ -67,13 +70,17 @@  -- | Look at the next character. Fails if there are no more characters. nextChar :: LookAhead Char-nextChar =+nextChar = fromMaybeM (lookAheadError "unexpected end of file") nextCharMaybe++-- | Look at the next character. Return 'Nothing' if there are no more characters.+nextCharMaybe :: LookAhead (Maybe Char)+nextCharMaybe =     do  inp <- getInput         case alexGetChar inp of-            Nothing         -> lookAheadError "unexpected end of file"+            Nothing         -> return Nothing             Just (c,inp')   ->                 do  setInput inp'-                    return c+                    return $ Just c   -- | Consume all the characters up to the current look-ahead position.@@ -113,17 +120,42 @@     the input is not advanced. -} match' :: Char -> [(String, LookAhead a)] -> LookAhead a -> LookAhead a-match' c xs def =-    do  inp <- getInput-        match'' inp xs c-    where-        match'' inp bs c =-            case bs' of-                []          -> setInput inp >> def-                [("",p)]    -> p-                _           -> match'' inp bs' =<< nextChar-            where-                bs' = [ (s, p) | (c':s, p) <- bs, c == c' ]+match' c xs def = do++  -- Set the error continuation to the default @def@, but make sure we reset+  -- the input to where we started speculative matching.+  inp <- getInput+  let fallback = setInput inp >> def++  -- Find the longest match from the table.+  match'' fallback xs c++  where+  match'' fallback bs c =++    -- Match the first character, dropping entries that do not match.+    ifNull [ (s, p) | (c':s, p) <- bs, c == c' ]++      -- If no alternatives are left, fall back to the failure continuation.+      {-then-} fallback++      -- Otherwise:+      {-else-} $ \ bs' -> do++        -- If we have a successful match, store it in the failure continuation.+        fallback' <- do+          case lookup "" bs' of++            -- No match yet.+            Nothing -> pure fallback++            -- Match found!  Remember it, and the state of the input where we found it.+            Just p  -> do+              inp <- getInput+              pure $ setInput inp >> p++        -- Keep trying to find a (longer) match.+        maybe fallback' (match'' fallback' bs') =<< nextCharMaybe  -- | Run a 'LookAhead' computation. The first argument is the error function. runLookAhead :: (forall b. String -> LookAhead b) -> LookAhead a -> Parser a
src/full/Agda/Syntax/Parser/Parser.y view
@@ -916,8 +916,8 @@    | AbsurdLamClause semi LamClause { $3 <| singleton $1 }    | NonAbsurdLamClause { singleton $1 } --- Parses all extended lambda clauses including a single absurd clause. For λ--- where this is not taken care of in AbsurdLambda+-- Parses all extended lambda clauses including a single absurd clause.+-- For lambda-where this is not[sic!, now?] taken care of in AbsurdLambda. LamWhereClauses :: { List1 LamClause } LamWhereClauses    : LamWhereClauses semi LamClause { $3 <| $1 }@@ -2015,10 +2015,7 @@     CohesionAttribute{}  -> unsup "Cohesion"     LockAttribute{}      -> unsup "Lock"     TacticAttribute{}    -> unsup "Tactic"-    QuantityAttribute q  -> case q of-      Quantity1{} -> unsup "Linearity"-      Quantity0 o -> return $ Just (Erased    o)-      Quantityω o -> return $ Just (NotErased o)+    QuantityAttribute q  -> maybe (unsup "Linearity") (return . Just) $ erasedFromQuantity q     where     unsup s = do       parseWarning $ UnsupportedAttribute (attrRange a) (Just s)@@ -2115,14 +2112,15 @@       arr : _ -> parseError' (rStart' $ getRange arr) $ "Unexpected " ++ prettyShow arr       [] ->         -- Andreas, 2021-05-06, issue #5365-        -- Handle pathological cases like @do ←@ and @do x ←@.+        -- Handle pathological cases like @do <-@ and @do x <-@.         case (es1, es2) of           (e1:rest1, e2:rest2) -> do             p <- exprToPattern $ rawApp $ e1 :| rest1             pure $ Just (p, getRange arr, rawApp (e2 :| rest2))           _ -> parseError' (rStart' $ getRange e) $ "Incomplete binding " ++ prettyShow e   where-    isLeftArrow (Ident (QName (Name _ _ (Id arr :| [])))) = arr `elem` ["<-", "←"]+    isLeftArrow (Ident (QName (Name _ _ (Id arr :| [])))) =+      arr `elem` ["<-", "\x2190"]  -- \leftarrow [issue #5465, unicode might crash happy]     isLeftArrow _ = False exprToAssignment _ = pure Nothing 
src/full/Agda/Syntax/Scope/Base.hs view
@@ -925,7 +925,7 @@           :: forall a. SetBindingSite a           => (C.Name -> Maybe C.Name)           -> ThingsInScope a -> ThingsInScope a-        updateThingsInScope f = Map.fromList . mapMaybe upd . Map.toAscList+        updateThingsInScope f = Map.fromListWith __IMPOSSIBLE__ . mapMaybe upd . Map.toAscList           where           upd :: (C.Name, [a]) -> Maybe (C.Name, [a])           upd (x, ys) = f x <&> \ x' -> (x', setBindingSite (getRange x') ys)
src/full/Agda/Syntax/Translation/AbstractToConcrete.hs view
@@ -126,7 +126,7 @@     Env { takenVarNames = Set.fromList vars         , takenDefNames = defs         , currentScope = scope-        , builtins     = Map.fromList builtinList+        , builtins     = Map.fromListWith __IMPOSSIBLE__ builtinList         , preserveIIds = False         , foldPatternSynonyms = foldPatSyns         }@@ -835,7 +835,7 @@          bindToConcrete tel $ \ tel' ->            C.makePi (List1.catMaybes tel') <$> toConcreteTop e       where-        piTel1 tel e         = first (List1.append tel) $ piTel e+        piTel1 tel e         = first (List1.appendList tel) $ piTel e         piTel (A.Pi _ tel e) = first List1.toList $ piTel1 tel e         piTel e              = ([], e) @@ -880,12 +880,6 @@     toConcrete (A.Quote i) = return $ C.Quote (getRange i)     toConcrete (A.QuoteTerm i) = return $ C.QuoteTerm (getRange i)     toConcrete (A.Unquote i) = return $ C.Unquote (getRange i)-    toConcrete (A.Tactic i e xs) = do-      e' <- toConcrete e-      xs' <- toConcrete xs-      let r      = getRange i-          rawtac = foldl (C.App r) e' xs'-      return $ C.Tactic (getRange i) rawtac      -- Andreas, 2012-04-02: TODO!  print DontCare as irrAxiom     -- Andreas, 2010-10-05 print irrelevant things as ordinary things
src/full/Agda/Syntax/Translation/ConcreteToAbstract.hs view
@@ -1035,11 +1035,7 @@       C.QuoteTerm r -> return $ A.QuoteTerm (ExprRange r)       C.Unquote r -> return $ A.Unquote (ExprRange r) -      C.Tactic r e -> do-        let AppView e' args = appView e-        e'   <- toAbstract e'-        args <- toAbstract args-        return $ A.Tactic (ExprRange r) e' args+      C.Tactic r e -> genericError "Syntax error: 'tactic' can only appear in attributes"    -- DontCare       C.DontCare e -> A.DontCare <$> toAbstract e@@ -2715,7 +2711,7 @@   C.LHSProj{}       -> hasExpandedEllipsis $ namedArg $ C.lhsFocus core -- can this ever be ExpandedEllipsis?   C.LHSWith{}       -> hasExpandedEllipsis $ C.lhsHead core   C.LHSEllipsis r p -> case p of-    C.LHSWith _ wps _ -> ExpandedEllipsis r (length wps)+    C.LHSWith p wps _ -> hasExpandedEllipsis p <> ExpandedEllipsis r (length wps)     C.LHSHead{}       -> ExpandedEllipsis r 0     C.LHSProj{}       -> ExpandedEllipsis r 0     C.LHSEllipsis{}   -> __IMPOSSIBLE__
src/full/Agda/Syntax/Translation/InternalToAbstract.hs view
@@ -1051,7 +1051,6 @@     A.Quote {}               -> __IMPOSSIBLE__     A.QuoteTerm {}           -> __IMPOSSIBLE__     A.Unquote {}             -> __IMPOSSIBLE__-    A.Tactic {}              -> __IMPOSSIBLE__     A.DontCare v             -> A.DontCare $ blank bound v     A.PatternSyn {}          -> e     A.Macro {}               -> e
src/full/Agda/Termination/RecCheck.hs view
@@ -65,7 +65,7 @@   -- Mark individual clauses of recursive functions:   --------------------------------------------------   -- Map names to clause numbers to sets of mentioned names.-  let clMap = Map.fromList $ zip names perClauses+  let clMap = Map.fromListWith __IMPOSSIBLE__ $ zip names perClauses   -- Walk through SCCs.   forM_ recs $ \ scc -> do     -- Does a set of names have an overlap with the current scc?
src/full/Agda/Termination/TermCheck.hs view
@@ -255,7 +255,7 @@        -- could be turned into actual splits, because no-confusion        -- would make the other cases impossible, so I do not disable        -- this for --without-K entirely.-       ifM (optCubical <$> pragmaOptions) (return r) {- else -} $+       ifM (isJust . optCubical <$> pragmaOptions) (return r) {- else -} $        case r of          r@Right{} -> return r          Left{}    -> do
src/full/Agda/TypeChecking/Abstract.hs view
@@ -136,7 +136,7 @@         , nest 2 $ sep [ (text . show) v <+> ":", nest 2 $ (text . show) b ] ]    hole <- qualify <$> currentModule <*> freshName_ ("hole" :: String)-  noMutualBlock $ addConstant hole $ defaultDefn defaultArgInfo hole a defaultAxiom+  noMutualBlock $ addConstant' hole defaultArgInfo hole a defaultAxiom    args <- map Apply <$> getContextArgs   let n = length args
src/full/Agda/TypeChecking/CompiledClause/Match.hs view
@@ -3,6 +3,8 @@  import qualified Data.Map as Map +import Agda.Interaction.Options (optRewriting)+ import Agda.Syntax.Internal import Agda.Syntax.Common @@ -13,6 +15,7 @@ import Agda.TypeChecking.Substitute  import Agda.Utils.Maybe+import Agda.Utils.Monad import Agda.Utils.Pretty (prettyShow)  import Agda.Utils.Impossible@@ -197,6 +200,8 @@     if f `elem` pds     then return (NoReduction $ NotBlocked MissingClauses [])     else do-      traceSLn "impossible" 10+      ifM (optRewriting <$> pragmaOptions)+      {-then-} (return (NoReduction $ NotBlocked ReallyNotBlocked [])) -- See #5396+      {-else-} $ traceSLn "impossible" 10         ("Incomplete pattern matching when applying " ++ prettyShow f)         __IMPOSSIBLE__
src/full/Agda/TypeChecking/Coverage.hs view
@@ -202,7 +202,7 @@   -- Storing the covering clauses so that checkIApplyConfluence_ can   -- find them later.   -- Andreas, 2019-03-27, only needed when --cubical-  whenM (optCubical <$> pragmaOptions) $ do+  whenM (isJust . optCubical <$> pragmaOptions) $ do     modifySignature $ updateDefinition f $ updateTheDef $ updateCovering $ const qss  @@ -948,7 +948,8 @@       ]      -- We update the target quantity to 0 for erased constructors, but-    -- not if the match is made in an erased position.+    -- not if the match is made in an erased position, or if the+    -- original constructor definition is not erased.     updQuant <- do       let erased = case q of             Quantity0{} -> True@@ -956,7 +957,7 @@             Quantityω{} -> False       if erased then return id else case tag of         SplitCon c -> do-          q <- getQuantity <$> getConstInfo c+          q <- getQuantity <$> getOriginalConstInfo c           case q of             Quantity0{} -> return $ mapQuantity (composeQuantity q)             Quantity1{} -> return id
src/full/Agda/TypeChecking/Errors.hs view
@@ -290,9 +290,13 @@ dropTopLevelModule q = ($ q) <$> topLevelModuleDropper  -- | Produces a function which drops the filename component of the qualified name.-topLevelModuleDropper :: (MonadTCEnv m, ReadTCState m) => m (QName -> QName)+topLevelModuleDropper :: (MonadDebug m, MonadTCEnv m, ReadTCState m) => m (QName -> QName) topLevelModuleDropper = do   caseMaybeM (asksTC envCurrentPath) (return id) $ \ f -> do+  reportSDoc "err.dropTopLevel" 60 $ vcat+    [ "current path =" <+> (text . filePath) f+    , "moduleToSource =" <+> do text . show =<< useR stModuleToSource+    ]   m <- fromMaybe __IMPOSSIBLE__ <$> lookupModuleFromSource f   return $ dropTopLevelModule' $ size m 
src/full/Agda/TypeChecking/Errors.hs-boot view
@@ -3,9 +3,10 @@ import Agda.Syntax.Abstract.Name  import Agda.TypeChecking.Monad.Base+import {-# SOURCE #-} Agda.TypeChecking.Monad.Debug (MonadDebug)  -- Misplaced SPECIALISE pragma: -- {-# SPECIALIZE prettyError :: TCErr -> TCM String #-} prettyError :: MonadTCM tcm => TCErr -> tcm String -topLevelModuleDropper :: (MonadTCEnv m, ReadTCState m) => m (QName -> QName)+topLevelModuleDropper :: (MonadDebug m, MonadTCEnv m, ReadTCState m) => m (QName -> QName)
src/full/Agda/TypeChecking/Free.hs view
@@ -44,6 +44,7 @@     , IgnoreSorts(..)     , freeVars, freeVars', filterVarMap, filterVarMapToList     , runFree, rigidVars, stronglyRigidVars, unguardedVars, allVars+    , flexibleVars     , allFreeVars     , allRelevantVars, allRelevantVarsIgnoring     , freeVarsIgnore@@ -303,15 +304,14 @@ rigidVars = filterVarMap $ \case   VarOcc o _ -> o `elem` [ WeaklyRigid, Unguarded, StronglyRigid ] --- UNUSED Liang-Ting Chen 2019-07-16 -- | Variables occuring in arguments of metas.---   These are only potentially free, depending how the meta variable is instantiated.---   The set contains the id's of the meta variables that this variable is an argument to.---flexibleVars :: VarMap -> IntMap MetaSet---flexibleVars (VarMap m) = (`IntMap.mapMaybe` m) $ \case---  VarOcc (Flexible ms) _ -> Just ms---  _ -> Nothing---+--  These are only potentially free, depending how the meta variable is instantiated.+--  The set contains the id's of the meta variables that this variable is an argument to.+flexibleVars :: VarMap -> IntMap MetaSet+flexibleVars (VarMap m) = (`IntMap.mapMaybe` m) $ \case+ VarOcc (Flexible ms) _ -> Just ms+ _ -> Nothing+ ---- | Variables in irrelevant arguments and under a @DontCare@, i.e., ----   in irrelevant positions. --irrelevantVars :: VarMap -> VarSet
src/full/Agda/TypeChecking/Generalize.hs view
@@ -265,7 +265,7 @@   -- generalizing over, since they will need to be pruned appropriately (see   -- Issue 3672).   allSortedMetas <- fromMaybeM (typeError GeneralizeCyclicDependency) $-    dependencySortMetas (generalizeOver ++ reallyDontGeneralize)+    dependencySortMetas (generalizeOver ++ reallyDontGeneralize ++ map fst openSortMetas)   let sortedMetas = filter shouldGeneralize allSortedMetas    let dropCxt err = updateContext (strengthenS err 1) (drop 1)@@ -317,9 +317,9 @@   -- Now we need to prune the unsolved metas to make sure they respect the new   -- dependencies (#3672). Also update interaction points to point to pruned metas.   let inscope (ii, InteractionPoint{ipMeta = Just x})-        | IntSet.member (metaId x) allmetas = [(x, ii)]-      inscope _ = []-  ips <- Map.fromList . concatMap inscope . BiMap.toList <$> useTC stInteractionPoints+        | IntSet.member (metaId x) allmetas = Just (x, ii)+      inscope _ = Nothing+  ips <- Map.fromDistinctAscList . mapMaybe inscope . fst . BiMap.toDistinctAscendingLists <$> useTC stInteractionPoints   pruneUnsolvedMetas genRecName genRecCon genTel genRecFields ips shouldGeneralize allSortedMetas    -- Fill in the missing details of the telescope record.@@ -685,9 +685,9 @@ createGenValues :: Set QName -> TCM (Map MetaId QName, Map QName GeneralizedValue) createGenValues s = do   genvals <- locallyTC eGeneralizeMetas (const YesGeneralizeVar) $-               forM (sortBy (compare `on` getRange) $ Set.toList s) createGenValue-  let metaMap = Map.fromList [ (m, x) | (x, m, _) <- genvals ]-      nameMap = Map.fromList [ (x, v) | (x, _, v) <- genvals ]+               mapM createGenValue $ sortBy (compare `on` getRange) $ Set.toList s+  let metaMap = Map.fromListWith __IMPOSSIBLE__ [ (m, x) | (x, m, _) <- genvals ]+      nameMap = Map.fromListWith __IMPOSSIBLE__ [ (x, v) | (x, _, v) <- genvals ]   return (metaMap, nameMap)  -- | Create a generalisable meta for a generalisable variable.@@ -765,7 +765,7 @@   inTopContext $ forM_ (zip sortedMetas genRecFields) $ \ (meta, fld) -> do     fieldTy <- getMetaType meta     let field = unDom fld-    addConstant field $ defaultDefn (getArgInfo fld) field fieldTy $+    addConstant' field (getArgInfo fld) field fieldTy $       let proj = Projection { projProper   = Just genRecName                             , projOrig     = field                             , projFromType = defaultArg genRecName@@ -786,7 +786,7 @@                , funWith         = Nothing                , funCovering     = []                }-  addConstant (conName genRecCon) $ defaultDefn defaultArgInfo (conName genRecCon) __DUMMY_TYPE__ $ -- Filled in later+  addConstant' (conName genRecCon) defaultArgInfo (conName genRecCon) __DUMMY_TYPE__ $ -- Filled in later     Constructor { conPars   = 0                 , conArity  = length genRecFields                 , conSrcCon = genRecCon@@ -800,7 +800,7 @@                 }   let dummyTel 0 = EmptyTel       dummyTel n = ExtendTel (defaultDom __DUMMY_TYPE__) $ Abs "_" $ dummyTel (n - 1)-  addConstant genRecName $ defaultDefn defaultArgInfo genRecName (sort genRecSort) $+  addConstant' genRecName defaultArgInfo genRecName (sort genRecSort) $     Record { recPars         = 0            , recClause       = Nothing            , recConHead      = genRecCon
src/full/Agda/TypeChecking/IApplyConfluence.hs view
@@ -37,10 +37,12 @@   checkIApplyConfluence_ :: QName -> TCM ()-checkIApplyConfluence_ f = whenM (optCubical <$> pragmaOptions) $ do-  -- Andreas, 2019-03-27, iapply confluence should only be checked when --cubical.-  -- See test/Succeed/CheckIApplyConfluence.agda.-  -- We cannot reach the following crash point unless --cubical.+checkIApplyConfluence_ f = whenM (isJust . optCubical <$> pragmaOptions) $ do+  -- Andreas, 2019-03-27, iapply confluence should only be checked+  -- when --cubical or --erased-cubical is active. See+  -- test/Succeed/CheckIApplyConfluence.agda.+  -- We cannot reach the following crash point unless+  -- --cubical/--erased-cubical is active.   __CRASH_WHEN__ "tc.cover.iapply.confluence.crash" 666   reportSDoc "tc.cover.iapply" 10 $ text "Checking IApply confluence of" <+> pretty f   inConcreteOrAbstractMode f $ \ d -> do@@ -206,7 +208,7 @@ -- | Like @unifyElims@ but @Γ@ is from the the meta's @MetaInfo@ and -- the context extension @Δ@ is taken from the @Closure@. unifyElimsMeta :: MetaId -> Args -> Closure Constraint -> ([(Term,Term)] -> Constraint -> TCM a) -> TCM a-unifyElimsMeta m es_m cl k = ifM (not . optCubical <$> pragmaOptions) (enterClosure cl $ k []) $ do+unifyElimsMeta m es_m cl k = ifM (isNothing . optCubical <$> pragmaOptions) (enterClosure cl $ k []) $ do                   mv <- lookupMeta m                   enterClosure (getMetaInfo mv) $ \ _ -> do -- mTel ⊢                   ty <- metaType m
src/full/Agda/TypeChecking/Implicit.hs view
@@ -63,7 +63,7 @@          ]   hs <- insImp b tel   -- Continue with implicit binders inserted before @b@.-  let bs0@(b1 :| bs1) = List1.prepend hs bs+  let bs0@(b1 :| bs1) = List1.prependList hs bs   reduce a >>= piOrPath >>= \case     -- If @a@ is a function (or path) type, continue inserting after @b1@.     Left (_, ty) -> (b1 :|) <$> insertImplicitBindersT bs1 (absBody ty)
src/full/Agda/TypeChecking/Lock.hs view
@@ -9,8 +9,9 @@  import Control.Monad.Reader ---import qualified Data.IntMap as IMap+import qualified Data.IntMap as IMap import qualified Data.IntSet as ISet+import qualified Data.Set as Set   import Agda.Syntax.Common@@ -28,7 +29,7 @@ import Agda.Utils.Maybe import Agda.Utils.Monad import Agda.Utils.Size-import Agda.Utils.VarSet as Set+import Agda.Utils.VarSet as VSet  import Agda.Utils.Impossible @@ -59,10 +60,8 @@      ]    -- Strategy: compute allowed variables, check that @t@ doesn't use more.-  mv <- isVar (unArg lk)-  caseMaybe mv noVar $ \ i -> do--  isLock i+  mi <- getLockVar (unArg lk)+  caseMaybe mi (return ()) $ \ i -> do    cxt <- getContext   let toCheck = zip [0..] $ zipWith raise [1..] (take i cxt)@@ -94,20 +93,32 @@     patternViolation alwaysUnblock   else do     notAllowedVarsError (unArg lk) (ISet.toList illegalVars)- where-   noVar = typeError $ GenericError "lock should be a var"+++getLockVar :: Term -> TCMT IO (Maybe Int)+getLockVar lk = do+  let+    fv = freeVarsIgnore IgnoreInAnnotations lk+    flex = flexibleVars fv++  unless (IMap.null flex) $ do+    let metas = Set.unions $ map (foldrMetaSet Set.insert Set.empty) $ IMap.elems flex+    patternViolation $ unblockOnAnyMeta $ metas++  is <- filterM isLock $ ISet.toList $ rigidVars fv++  -- Out of the lock variables that appear in @lk@ the one in the+  -- left-most position in the context is what will determine the+  -- available context for the head.+  let mi | Prelude.null is   = Nothing+         | otherwise = Just $ maximum is++  return $ mi++  where    isLock i = do      islock <- getLock . domInfo <$> lookupBV i-     unless (islock == IsLock) $-       typeError $ GenericError "Cannot eliminate with non-lock variable."---- to use only on lock terms-isVar :: Term -> TCMT IO (Maybe Int)-isVar t = do-  t <- abortIfBlocked t-  case t of-    (Var l []) -> return $ Just l-    _          -> return $ Nothing+     return $ islock == IsLock  isTimeless :: Type -> TCM Bool isTimeless t = do@@ -125,9 +136,9 @@  checkEarlierThan :: Term -> VarSet -> TCM () checkEarlierThan lk fvs = do-  mv <- isVar lk-  caseMaybe mv __IMPOSSIBLE__ $ \ i -> do-    let problems = filter (<= i) $ Set.toList fvs+  mv <- getLockVar lk+  caseMaybe mv (return ()) $ \ i -> do+    let problems = filter (<= i) $ VSet.toList fvs     forM_ problems $ \ j -> do       ty <- typeOfBV j       unlessM (isTimeless ty) $
src/full/Agda/TypeChecking/MetaVars.hs view
@@ -57,7 +57,7 @@ import Agda.Utils.Size import Agda.Utils.Tuple import Agda.Utils.Permutation-import Agda.Utils.Pretty ( prettyShow )+import Agda.Utils.Pretty ( Pretty, prettyShow ) import Agda.Utils.Singleton import qualified Agda.Utils.Graph.TopSort as Graph import Agda.Utils.VarSet (VarSet)@@ -362,24 +362,136 @@ newQuestionMark :: InteractionId -> Comparison -> Type -> TCM (MetaId, Term) newQuestionMark ii cmp = newQuestionMark' (newValueMeta' RunMetaOccursCheck) ii cmp ++-- Since we are type-checking some code twice, e.g., record declarations+-- for the sake of the record constructor type and then again for the sake+-- of the record module (issue #434), we may encounter an interaction point+-- for which we already have a meta.  In this case, we want to reuse the meta.+-- Otherwise we get two meta for one interaction point which are not connected,+-- and e.g. Agda might solve one in some way+-- and the user the other in some other way...+--+-- New reference: Andreas, 2021-07-21, issues #5478 and #5463+-- Old reference: Andreas, 2016-07-29, issue 1720-2+-- See also: issue #2257 newQuestionMark'   :: (Comparison -> Type -> TCM (MetaId, Term))   -> InteractionId -> Comparison -> Type -> TCM (MetaId, Term)-newQuestionMark' new ii cmp t = do-  -- Andreas, 2016-07-29, issue 1720-2-  -- This is slightly risky, as the same interaction id-  -- maybe be shared between different contexts.-  -- Blame goes to the record processing hack, see issue #424-  -- and @ConcreteToAbstract.recordConstructorType@.-  let existing x = (x,) . MetaV x . map Apply <$> getContextArgs-  flip (caseMaybeM $ lookupInteractionMeta ii) existing $ {-else-} do+newQuestionMark' new ii cmp t = lookupInteractionMeta ii >>= \case -  -- Do not run check for recursive occurrence of meta in definitions,-  -- because we want to give the recursive solution interactively (Issue 589)-  (x, m) <- new cmp t-  connectInteractionPoint ii x-  return (x, m)+  -- Case: new meta.+  Nothing -> do+    -- Do not run check for recursive occurrence of meta in definitions,+    -- because we want to give the recursive solution interactively (Issue 589)+    (x, m) <- new cmp t+    connectInteractionPoint ii x+    return (x, m) +  -- Case: existing meta.+  Just x -> do+    -- Get the context Γ in which the meta was created.+    MetaVar+      { mvInfo = MetaInfo{ miClosRange = Closure{ clEnv = TCEnv{ envContext = gamma }}}+      , mvPermutation = p+      } <- fromMaybe __IMPOSSIBLE__ <$> lookupMeta' x+    -- Get the current context Δ.+    delta <- getContext+    -- A bit hazardous:+    -- we base our decisions on the names of the context entries.+    -- Ideally, Agda would organize contexts in ancestry trees+    -- with substitutions to move between parent and child.+    let glen = length gamma+    let dlen = length delta+    let gxs  = map (fst . unDom) gamma+    let dxs  = map (fst . unDom) delta+    reportSDoc "tc.interaction" 20 $ vcat+      [ "reusing meta"+      , nest 2 $ "creation context:" <+> pretty gxs+      , nest 2 $ "reusage  context:" <+> pretty dxs+      ]++    -- When checking a record declaration (e.g. Σ), creation context Γ+    -- might be of the forms Γ₀,Γ₁ or Γ₀,fst,Γ₁ or Γ₀,fst,snd,Γ₁ whereas+    -- Δ is of the form Γ₀,r,Γ₁,{Δ₂} for record variable r.+    -- So first find the record variable in Δ.+    rev_args <- case List.findIndex nameIsRecordName dxs of++      -- Case: no record variable in the context.+      -- Test whether Δ is an extension of Γ.+      Nothing -> do+        unless (gxs `List.isSuffixOf` dxs) $ do+          reportSDoc "impossible" 10 $ vcat+            [ "expecting meta-creation context"+            , nest 2 $ pretty gxs+            , "to be a suffix of the meta-reuse context"+            , nest 2 $ pretty dxs+            ]+          reportSDoc "impossible" 70 $ vcat+            [ "expecting meta-creation context"+            , nest 2 $ (text . show) gxs+            , "to be a suffix of the meta-reuse context"+            , nest 2 $ (text . show) dxs+            ]+          __IMPOSSIBLE__+        -- Apply the meta to |Γ| arguments from Δ.+        return $ map var [dlen - glen .. dlen - 1]++      -- Case: record variable in the context.+      Just k -> do+        -- Verify that the contexts relate as expected.+        let g0len = length dxs - k - 1+        -- Find out the Δ₂ and Γ₁ parts.+        -- However, as they do not share common ancestry, the @nameId@s differ,+        -- so we consider only the original concrete names.+        -- This is a bit risky... blame goes to #434.+        let gys = map nameCanonical gxs+        let dys = map nameCanonical dxs+        let (d2len, g1len) = findOverlap (take k dys) gys+        reportSDoc "tc.interaction" 30 $ vcat $ map (nest 2)+          [ "glen  =" <+> pretty glen+          , "g0len =" <+> pretty g0len+          , "g1len =" <+> pretty g1len+          , "d2len =" <+> pretty d2len+          ]+        -- The Γ₀ part should match.+        unless (drop (glen - g0len) gxs == drop (k + 1) dxs) $ do+          reportSDoc "impossible" 10 $ vcat+            [ "expecting meta-creation context (with fields instead of record var)"+            , nest 2 $ pretty gxs+            , "to share ancestry (suffix) with the meta-reuse context (with record var)"+            , nest 2 $ pretty dxs+            ]+          __IMPOSSIBLE__+        -- The Γ₁ part should match.+        unless ( ((==) `on` take g1len) gys (drop d2len dys) ) $ do+          reportSDoc "impossible" 10 $ vcat+            [ "expecting meta-creation context (with fields instead of record var)"+            , nest 2 $ pretty gxs+            , "to be an expansion of the meta-reuse context (with record var)"+            , nest 2 $ pretty dxs+            ]+          __IMPOSSIBLE__+        let (vs1, v : vs0) = splitAt g1len $ map var [d2len..dlen-1]+        -- We need to expand the record var @v@ into the correct number of fields.+        let numFields = glen - g1len - g0len+        if numFields <= 0 then return $ vs1 ++ vs0 else do+          -- Get the record type.+          let t = snd . unDom . fromMaybe __IMPOSSIBLE__ $ delta !!! k+          -- Get the record field names.+          fs <- getRecordTypeFields t+          -- Field arguments to the original meta are projections from the record var.+          let vfs = map ((\ x -> v `applyE` [Proj ProjSystem x]) . unDom) fs+          -- These are the final args to the original meta:+          return $ vs1 ++ reverse (take numFields vfs) ++ vs0++    -- Use ArgInfo from Γ.+    let args = reverse $ zipWith (<$) rev_args $ map argFromDom gamma+    -- Take the permutation into account (see TC.Monad.MetaVars.getMetaContextArgs).+    let vs = permute (takeP (length args) p) args+    reportSDoc "tc.interaction" 20 $ vcat+      [ "meta reuse arguments:" <+> prettyTCM vs ]+    return (x, MetaV x $ map Apply vs)+ -- | Construct a blocked constant if there are constraints. blockTerm   :: (MonadMetaSolver m, MonadConstraint m, MonadFresh Nat m, MonadFresh ProblemId m)@@ -677,8 +789,8 @@   reportSDoc "tc.meta.assign" 45 $     "MetaVars.assign: type of meta: " <+> prettyTCM t -  reportSLn "tc.meta.assign" 75 $-    "MetaVars.assign: assigning meta  " ++ show x ++ "  with args  " ++ show args ++ "  to  " ++ show v+  reportSDoc "tc.meta.assign" 75 $+    text "MetaVars.assign: assigning meta  " <> pretty x <> text "  with args  " <> pretty args <> text "  to  " <> pretty v    case (v, mvJudgement mvar) of       (Sort s, HasType{}) -> hasBiggerSort s@@ -1280,7 +1392,7 @@  -- | Eta-expand bound variables like @z@ in @X (fst z)@. expandProjectedVars-  :: ( Show a, PrettyTCM a, NoProjectedVar a+  :: ( Pretty a, PrettyTCM a, NoProjectedVar a      -- , Normalise a, TermLike a, Subst Term a      , ReduceAndEtaContract a      , PrettyTCM b, TermSubst b@@ -1294,7 +1406,7 @@     reportSDoc "tc.meta.assign.proj" 45 $ "meta args: " <+> prettyTCM args     args <- callByName $ reduceAndEtaContract args     reportSDoc "tc.meta.assign.proj" 45 $ "norm args: " <+> prettyTCM args-    reportSDoc "tc.meta.assign.proj" 85 $ "norm args: " <+> text (show args)+    reportSDoc "tc.meta.assign.proj" 85 $ "norm args: " <+> pretty args     let done = ret args v     case noProjectedVar args of       Right ()              -> do@@ -1576,7 +1688,7 @@         ]        -- Add the new postulate to the signature.-      addConstant q $ defaultDefn defaultArgInfo q t defaultAxiom+      addConstant' q defaultArgInfo q t defaultAxiom        -- Solve the meta.       let inst = InstV [] $ Def q []
src/full/Agda/TypeChecking/MetaVars/Occurs.hs view
@@ -175,8 +175,16 @@       m   = occMeta $ feExtra cxt   -- Anything goes if we are both irrelevant and erased.   -- Otherwise, have to check the modality of the defined name.-  unless (irr && er) $ do-    dmod <- modalityOfConst d+  unless (irr && er) $ getConstInfo' d >>= \case+   Left _ -> do+    -- Andreas, 2021-07-29.+    -- The definition is not in scope.+    -- This shouldn't happen, but does so in issue #5492.+    -- Let's bail out...+    patternViolation' alwaysUnblock 35 $+      unwords ["occursCheck: definition", prettyShow d, "not in scope" ]+   Right def -> do+    let dmod = getModality def     unless (irr || usableRelevance dmod) $ do       reportSDoc "tc.meta.occurs" 35 $ hsep         [ "occursCheck: definition"@@ -284,6 +292,15 @@   NoUnfold  -> flexibly m   YesUnfold -> weakly m +-- | For a path constructor `c : ... -> Path D a b`, we have that e.g. `c es i0` reduces to `a`.+--   So we have to consider its arguments as flexible when we do not actually unfold.+conArgs :: Elims -> OccursM a -> OccursM a+conArgs es m = asks (occUnfold . feExtra) >>= \case+  YesUnfold -> m+  NoUnfold | null [ () | IApply{} <- es ]+            -> m+  NoUnfold  -> flexibly m+ unfoldB :: (Instantiate t, Reduce t) => t -> OccursM (Blocked t) unfoldB v = do   unfold <- asks $ occUnfold . feExtra@@ -437,7 +454,7 @@         reportSDoc "tc.meta.occurs" 45 $           text ("occursCheck " ++ prettyShow m ++ " (" ++ show (feFlexRig ctx) ++ ") of ") <+> prettyTCM v         reportSDoc "tc.meta.occurs" 70 $-          nest 2 $ text $ show v+          nest 2 $ pretty v         case v of           Var i es   -> do             allowed <- getAll . ($ unitModality) <$> variable i@@ -469,7 +486,7 @@             Def d <$> occDef d es           Con c ci vs -> do             definitionCheck (conName c)-            Con c ci <$> occurs vs  -- if strongly rigid, remain so+            Con c ci <$> conArgs vs (occurs vs)  -- if strongly rigid, remain so, except with unreduced IApply arguments.           Pi a b      -> uncurry Pi <$> occurs (a,b)           Sort s      -> Sort <$> do underRelevance NonStrict $ occurs s           MetaV m' es -> do
src/full/Agda/TypeChecking/Monad/Base.hs view
@@ -838,7 +838,7 @@  sourceToModule :: TCM SourceToModule sourceToModule =-  Map.fromList+  Map.fromListWith __IMPOSSIBLE__      .  List.map (\(m, f) -> (f, m))      .  Map.toList     <$> useTC stModuleToSource@@ -1794,6 +1794,8 @@     -- ^ What blocking tag to use when we cannot reduce this def?     --   Used when checking a function definition is blocked on a meta     --   in the type.+  , defLanguage       :: !Language+    -- ^ The language used for the definition.   , theDef            :: Defn   }     deriving (Show, Generic)@@ -1817,8 +1819,9 @@ theDefLens f d = f (theDef d) <&> \ df -> d { theDef = df }  -- | Create a definition with sensible defaults.-defaultDefn :: ArgInfo -> QName -> Type -> Defn -> Definition-defaultDefn info x t def = Defn+defaultDefn ::+  ArgInfo -> QName -> Type -> Language -> Defn -> Definition+defaultDefn info x t lang def = Defn   { defArgInfo        = info   , defName           = x   , defType           = t@@ -1836,6 +1839,7 @@   , defInjective      = False   , defCopatternLHS   = False   , defBlocked        = NotBlocked ReallyNotBlocked ()+  , defLanguage       = lang   , theDef            = def   } @@ -2201,8 +2205,8 @@     "Constructor {" <?> vcat       [ "conPars   =" <?> pshow conPars       , "conArity  =" <?> pshow conArity-      , "conSrcCon =" <?> pshow conSrcCon-      , "conData   =" <?> pshow conData+      , "conSrcCon =" <?> pretty conSrcCon+      , "conData   =" <?> pretty conData       , "conAbstr  =" <?> pshow conAbstr       , "conInd    =" <?> pshow conInd       , "conErased =" <?> pshow conErased ] <?> "}"@@ -4513,8 +4517,8 @@   killRange (Section tel) = killRange1 Section tel  instance KillRange Definition where-  killRange (Defn ai name t pols occs gens gpars displ mut compiled inst copy ma nc inj copat blk def) =-    killRange18 Defn ai name t pols occs gens gpars displ mut compiled inst copy ma nc inj copat blk def+  killRange (Defn ai name t pols occs gens gpars displ mut compiled inst copy ma nc inj copat blk lang def) =+    killRange19 Defn ai name t pols occs gens gpars displ mut compiled inst copy ma nc inj copat blk lang def     -- TODO clarify: Keep the range in the defName field?  instance KillRange NumGeneralizableArgs where
+ src/full/Agda/TypeChecking/Monad/Debug.hs-boot view
@@ -0,0 +1,5 @@+module Agda.TypeChecking.Monad.Debug where++import Data.Kind (Type)++class MonadDebug (m :: Type -> Type)
src/full/Agda/TypeChecking/Monad/Options.hs view
@@ -12,6 +12,7 @@ import System.Directory import System.FilePath +import Agda.Syntax.Common import Agda.TypeChecking.Monad.Debug (reportSDoc) import Agda.TypeChecking.Warnings import Agda.TypeChecking.Monad.Base@@ -290,3 +291,14 @@  maxInversionDepth :: HasOptions m => m Int maxInversionDepth = optInversionMaxDepth <$> pragmaOptions++-- | Returns the 'Language' currently in effect.++getLanguage :: HasOptions m => m Language+getLanguage = do+  opts <- pragmaOptions+  return $+    if not (collapseDefault (optWithoutK opts)) then WithK else+    case optCubical opts of+      Just variant -> Cubical variant+      Nothing      -> WithoutK
src/full/Agda/TypeChecking/Monad/Signature.hs view
@@ -23,6 +23,8 @@ import Data.Maybe import Data.Semigroup ((<>)) +import Agda.Interaction.Options+ import Agda.Syntax.Abstract.Name import Agda.Syntax.Abstract (Ren, ScopeCopyInfo(..)) import Agda.Syntax.Common@@ -38,6 +40,7 @@ import Agda.TypeChecking.Monad.Env import Agda.TypeChecking.Monad.Mutual import Agda.TypeChecking.Monad.Open+import Agda.TypeChecking.Monad.Options import Agda.TypeChecking.Monad.State import Agda.TypeChecking.Monad.Trace import Agda.TypeChecking.DropArgs@@ -95,6 +98,15 @@     new +++ old = new { defDisplay = defDisplay new ++ defDisplay old                       , defInstance = defInstance new `mplus` defInstance old } +-- | A combination of 'addConstant' and 'defaultDefn'. The 'Language'+-- does not need to be supplied.++addConstant' ::+  QName -> ArgInfo -> QName -> Type -> Defn -> TCM ()+addConstant' q info x t def = do+  lang <- getLanguage+  addConstant q $ defaultDefn info x t lang def+ -- | Set termination info of a defined function symbol. setTerminates :: QName -> Bool -> TCM () setTerminates q b = modifySignature $ updateDefinition q $ updateTheDef $ \case@@ -450,7 +462,11 @@             inst = defInstance d             -- the name is set by the addConstant function             nd :: QName -> TCM Definition-            nd y = for def $ \ df -> Defn+            nd y = do+              -- The arguments may use some feature of the current+              -- language.+              lang <- getLanguage+              for def $ \ df -> Defn                     { defArgInfo        = defArgInfo d                     , defName           = y                     , defType           = t@@ -468,6 +484,14 @@                     , defInjective      = False                     , defCopatternLHS   = isCopatternLHS [cl]                     , defBlocked        = defBlocked d+                    , defLanguage       =+                      case defLanguage d of+                        -- Note that Cubical Agda code can be imported+                        -- when --erased-cubical is used.+                        l@(Cubical CFull) -> l+                        Cubical CErased   -> lang+                        WithoutK          -> lang+                        WithK             -> lang                     , theDef            = df }             oldDef = theDef d             isCon  = case oldDef of { Constructor{} -> True ; _ -> False }@@ -725,6 +749,24 @@  {-# SPECIALIZE getConstInfo :: QName -> TCM Definition #-} +-- | The computation 'getConstInfo' sometimes tweaks the returned+-- 'Definition', depending on the current 'Language' and the+-- 'Language' of the 'Definition'. This variant of 'getConstInfo' does+-- not perform any tweaks.++getOriginalConstInfo ::+  (ReadTCState m, HasConstInfo m) => QName -> m Definition+getOriginalConstInfo q = do+  def  <- getConstInfo q+  lang <- getLanguage+  case (lang, defLanguage def) of+    (Cubical CErased, Cubical CFull) ->+      locallyTCState+        stPragmaOptions+        (\opts -> opts { optCubical = Just CFull })+        (getConstInfo q)+    _ -> return def+ defaultGetRewriteRulesFor :: (ReadTCState m, MonadTCEnv m) => QName -> m RewriteRules defaultGetRewriteRulesFor q = ifNotM (shouldReduceDef q) (return []) $ do   st <- getTCState@@ -757,7 +799,7 @@         idefs = st^.(stImports . sigDefinitions)     case catMaybes [HMap.lookup q defs, HMap.lookup q idefs] of         []  -> return $ Left $ SigUnknown $ "Unbound name: " ++ prettyShow q ++ showQNameId q-        [d] -> mkAbs env d+        [d] -> mkAbs env =<< fixQuantity d         ds  -> __IMPOSSIBLE_VERBOSE__ $ "Ambiguous name: " ++ prettyShow q     where       mkAbs env d@@ -780,6 +822,16 @@                  initWithDefault __IMPOSSIBLE__ $ mnameToList m              } +      -- Names defined when --cubical is active are (to a large+      -- degree) treated as erased when --erased-cubical is used.+      fixQuantity d = do+        current <- getLanguage+        return $+          if defLanguage d == Cubical CFull &&+             current == Cubical CErased+          then setQuantity zeroQuantity d+          else d+ -- HasConstInfo lifts through monad transformers -- (see default signatures in HasConstInfo class). @@ -939,6 +991,12 @@                 => QName -> m Args freeVarsToApply q = do   vs <- moduleParamsToApply $ qnameModule q+  -- Andreas, 2021-07-14, issue #5470+  -- getConstInfo will fail if q is not in scope,+  -- but in this case there are no free vars to apply, since+  -- we cannot be in a child module of its defining module.+  -- So if we short cut the nil-case here, we avoid the internal error of #5470.+  if null vs then return [] else do   t <- defType <$> getConstInfo q   let TelV tel _ = telView'UpTo (size vs) t   unless (size tel == size vs) __IMPOSSIBLE__
src/full/Agda/TypeChecking/Names.hs view
@@ -26,7 +26,7 @@ import Control.Monad.Reader import Control.Monad.State -import Data.List+import Data.List (isSuffixOf)  import Agda.Syntax.Common hiding (Nat) import Agda.Syntax.Internal@@ -79,7 +79,7 @@ cxtSubst ctx = do   ctx' <- currentCxt   if (ctx `isSuffixOf` ctx')-     then return $ raiseS (genericLength ctx' - genericLength ctx)+     then return $ raiseS (length ctx' - length ctx)      else fail $ "thing out of context (" ++ show ctx ++ " is not a sub context of " ++ show ctx' ++ ")"  inCxt :: (MonadFail m, Subst a) => Names -> a -> NamesT m a
src/full/Agda/TypeChecking/Positivity/Occurrence.hs view
@@ -182,7 +182,7 @@  boundToEverySome ::   Map Occurrence [(Occurrence -> Bool, Occurrence -> Bool)]-boundToEverySome = Map.fromList+boundToEverySome = Map.fromListWith __IMPOSSIBLE__   [ ( JustPos     , [((/= Unused), (`elem` [Mixed, JustNeg, JustPos]))]     )
src/full/Agda/TypeChecking/Primitive.hs view
@@ -796,7 +796,7 @@ type Pred a = a -> Bool  primitiveFunctions :: Map String (TCM PrimitiveImpl)-primitiveFunctions = localTCStateSavingWarnings <$> Map.fromList+primitiveFunctions = localTCStateSavingWarnings <$> Map.fromListWith __IMPOSSIBLE__   -- Issue #4375          ^^^^^^^^^^^^^^^^^^^^^^^^^^   --   Without this the next fresh checkpoint id gets changed building the primitive functions. This   --   is bad for caching since it happens when scope checking import declarations (rebinding
src/full/Agda/TypeChecking/Primitive/Cubical.hs view
@@ -36,18 +36,31 @@ import Agda.Utils.Null import Agda.Utils.Tuple -requireCubical :: String -> TCM ()-requireCubical s = do-  cubical <- optCubical <$> pragmaOptions-  unless cubical $-    typeError $ GenericError $ "Missing option --cubical" ++ s+-- | Checks that the correct variant of Cubical Agda is activated.+-- Note that @--erased-cubical@ \"counts as\" @--cubical@ in erased+-- contexts. +requireCubical+  :: Cubical -- ^ Which variant of Cubical Agda is required?+  -> String -> TCM ()+requireCubical wanted s = do+  cubical         <- optCubical <$> pragmaOptions+  inErasedContext <- hasQuantity0 <$> getEnv+  case cubical of+    Just CFull -> return ()+    Just CErased | wanted == CErased || inErasedContext -> return ()+    _ -> typeError $ GenericError $ "Missing option " ++ opt ++ s+  where+  opt = case wanted of+    CFull   -> "--cubical"+    CErased -> "--cubical or --erased-cubical"+ primIntervalType :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Type primIntervalType = El (SSet $ ClosedLevel 0) <$> primInterval  primINeg' :: TCM PrimitiveImpl primINeg' = do-  requireCubical ""+  requireCubical CErased ""   t <- primIntervalType --> primIntervalType   return $ PrimImpl t $ primFun __IMPOSSIBLE__ 1 $ \ ts -> do     case ts of@@ -73,7 +86,7 @@  primDepIMin' :: TCM PrimitiveImpl primDepIMin' = do-  requireCubical ""+  requireCubical CErased ""   t <- runNamesT [] $        nPi' "φ" primIntervalType $ \ φ ->        pPi' "o" φ (\ o -> primIntervalType) --> primIntervalType@@ -97,7 +110,7 @@  primIBin :: IntervalView -> IntervalView -> TCM PrimitiveImpl primIBin unit absorber = do-  requireCubical ""+  requireCubical CErased ""   t <- primIntervalType --> primIntervalType --> primIntervalType   return $ PrimImpl t $ primFun __IMPOSSIBLE__ 2 $ \ ts -> do     case ts of@@ -123,12 +136,12 @@  primIMin' :: TCM PrimitiveImpl primIMin' = do-  requireCubical ""+  requireCubical CErased ""   primIBin IOne IZero  primIMax' :: TCM PrimitiveImpl primIMax' = do-  requireCubical ""+  requireCubical CErased ""   primIBin IZero IOne  imax :: HasBuiltins m => m Term -> m Term -> m Term@@ -146,7 +159,7 @@ -- ∀ {a}{c}{A : Set a}{x : A}(C : ∀ y → Id x y → Set c) → C x (conid i1 (\ i → x)) → ∀ {y} (p : Id x y) → C y p primIdJ :: TCM PrimitiveImpl primIdJ = do-  requireCubical ""+  requireCubical CErased ""   t <- runNamesT [] $        hPi' "a" (el $ cl primLevel) $ \ a ->        hPi' "c" (el $ cl primLevel) $ \ c ->@@ -194,7 +207,7 @@  primIdElim' :: TCM PrimitiveImpl primIdElim' = do-  requireCubical ""+  requireCubical CErased ""   t <- runNamesT [] $        hPi' "a" (el $ cl primLevel) $ \ a ->        hPi' "c" (el $ cl primLevel) $ \ c ->@@ -233,7 +246,7 @@  primPOr :: TCM PrimitiveImpl primPOr = do-  requireCubical ""+  requireCubical CErased ""   t    <- runNamesT [] $           hPi' "a" (el $ cl primLevel)    $ \ a  ->           nPi' "i" primIntervalType $ \ i  ->@@ -263,7 +276,7 @@  primPartial' :: TCM PrimitiveImpl primPartial' = do-  requireCubical ""+  requireCubical CErased ""   t <- runNamesT [] $        hPi' "a" (el $ cl primLevel) (\ a ->         nPi' "φ" primIntervalType $ \ _ ->@@ -281,7 +294,7 @@  primPartialP' :: TCM PrimitiveImpl primPartialP' = do-  requireCubical ""+  requireCubical CErased ""   t <- runNamesT [] $        hPi' "a" (el $ cl primLevel) (\ a ->         nPi' "φ" primIntervalType $ \ phi ->@@ -299,7 +312,7 @@  primSubOut' :: TCM PrimitiveImpl primSubOut' = do-  requireCubical ""+  requireCubical CErased ""   t    <- runNamesT [] $           hPi' "a" (el $ cl primLevel) $ \ a ->           hPi' "A" (el' (cl primLevelSuc <@> a) (Sort . tmSort <$> a)) $ \ bA ->@@ -323,7 +336,7 @@  primIdFace' :: TCM PrimitiveImpl primIdFace' = do-  requireCubical ""+  requireCubical CErased ""   t <- runNamesT [] $        hPi' "a" (el $ cl primLevel) $ \ a ->        hPi' "A" (sort . tmSort <$> a) $ \ bA ->@@ -343,7 +356,7 @@  primIdPath' :: TCM PrimitiveImpl primIdPath' = do-  requireCubical ""+  requireCubical CErased ""   t <- runNamesT [] $        hPi' "a" (el $ cl primLevel) $ \ a ->        hPi' "A" (sort . tmSort <$> a) $ \ bA ->@@ -364,7 +377,7 @@  primTrans' :: TCM PrimitiveImpl primTrans' = do-  requireCubical ""+  requireCubical CErased ""   t    <- runNamesT [] $           hPi' "a" (primIntervalType --> el (cl primLevel)) $ \ a ->           nPi' "A" (nPi' "i" primIntervalType $ \ i -> (sort . tmSort <$> (a <@> i))) $ \ bA ->@@ -375,7 +388,7 @@  primHComp' :: TCM PrimitiveImpl primHComp' = do-  requireCubical ""+  requireCubical CErased ""   t    <- runNamesT [] $           hPi' "a" (el $ cl primLevel) $ \ a ->           hPi' "A" (sort . tmSort <$> a) $ \ bA ->@@ -1372,7 +1385,7 @@  primComp :: TCM PrimitiveImpl primComp = do-  requireCubical ""+  requireCubical CErased ""   t    <- runNamesT [] $           hPi' "a" (primIntervalType --> el (cl primLevel)) $ \ a ->           nPi' "A" (nPi' "i" primIntervalType $ \ i -> (sort . tmSort <$> (a <@> i))) $ \ bA ->@@ -1416,7 +1429,7 @@  prim_glueU' :: TCM PrimitiveImpl prim_glueU' = do-  requireCubical ""+  requireCubical CErased ""   t <- runNamesT [] $        hPi' "la" (el $ cl primLevel) (\ la ->        hPi' "φ" primIntervalType $ \ φ ->@@ -1439,7 +1452,7 @@  prim_unglueU' :: TCM PrimitiveImpl prim_unglueU' = do-  requireCubical ""+  requireCubical CErased ""   t <- runNamesT [] $        hPi' "la" (el $ cl primLevel) (\ la ->        hPi' "φ" primIntervalType $ \ φ ->@@ -1499,7 +1512,7 @@  primGlue' :: TCM PrimitiveImpl primGlue' = do-  requireCubical ""+  requireCubical CFull ""   -- Glue' : ∀ {l} (A : Set l) → ∀ φ → (T : Partial (Set a) φ) (f : (PartialP φ \ o → (T o) -> A))   --            ([f] : PartialP φ \ o → isEquiv (T o) A (f o)) → Set l   t <- runNamesT [] $@@ -1523,7 +1536,7 @@  prim_glue' :: TCM PrimitiveImpl prim_glue' = do-  requireCubical ""+  requireCubical CFull ""   t <- runNamesT [] $        hPi' "la" (el $ cl primLevel) (\ la ->        hPi' "lb" (el $ cl primLevel) $ \ lb ->@@ -1545,7 +1558,7 @@  prim_unglue' :: TCM PrimitiveImpl prim_unglue' = do-  requireCubical ""+  requireCubical CFull ""   t <- runNamesT [] $        hPi' "la" (el $ cl primLevel) (\ la ->        hPi' "lb" (el $ cl primLevel) $ \ lb ->@@ -1600,7 +1613,7 @@ -- TODO Andrea: keep reductions that happen under foralls? primFaceForall' :: TCM PrimitiveImpl primFaceForall' = do-  requireCubical ""+  requireCubical CErased ""   t <- (primIntervalType --> primIntervalType) --> primIntervalType   return $ PrimImpl t $ primFun __IMPOSSIBLE__ 1 $ \ts -> case ts of     [phi] -> do
src/full/Agda/TypeChecking/RecordPatterns.hs view
@@ -226,7 +226,7 @@                 -- translate new cases recursively (there might be nested record expressions)                 traverse recordExpressionsToCopatterns $ Branches                   { projPatterns   = True-                  , conBranches    = Map.fromList $+                  , conBranches    = Map.fromListWith __IMPOSSIBLE__ $                       zipWith (\ f v -> (unDom f, WithArity 0 $ Done xs v)) fs vs                   , etaBranch      = Nothing                   , litBranches    = Map.empty
src/full/Agda/TypeChecking/Records.hs view
@@ -716,19 +716,15 @@ etaContractRecord :: HasConstInfo m => QName -> ConHead -> ConInfo -> Args -> m Term etaContractRecord r c ci args = if all (not . usableModality) args then fallBack else do   Just Record{ recFields = xs } <- isRecord r-  let check :: Arg Term -> Dom QName -> Maybe (Maybe Term)-      check a ax = do-      -- @a@ is the constructor argument, @ax@ the corr. record field name-        -- skip irrelevant record fields by returning DontCare-        case (getRelevance a, hasElims $ unArg a) of-          (Irrelevant, _)   -> Just Nothing-          -- if @a@ is the record field name applied to a single argument-          -- then it passes the check-          (_, Just (_, [])) -> Nothing  -- not a projection-          (_, Just (h, e0:es0))-            | (es, Proj _o f) <- initLast1 e0 es0-            , unDom ax == f -> Just $ Just $ h es-          _                 -> Nothing+  reportSDoc "tc.record.eta.contract" 20 $ vcat+    [ "eta contracting record"+    , nest 2 $ vcat+      [ "record type r  =" <+> prettyTCM r+      , "constructor c  =" <+> prettyTCM c+      , "field names xs =" <+> pretty    xs+      , "fields    args =" <+> prettyTCM args+      ]+    ]   case compare (length args) (length xs) of     LT -> fallBack       -- Not fully applied     GT -> __IMPOSSIBLE__ -- Too many arguments. Impossible.@@ -743,6 +739,19 @@         _ -> fallBack  -- a Nothing   where   fallBack = return (mkCon c ci args)+  check :: Arg Term -> Dom QName -> Maybe (Maybe Term)+  check a ax = do+  -- @a@ is the constructor argument, @ax@ the corr. record field name+    -- skip irrelevant record fields by returning DontCare+    case (getRelevance a, hasElims $ unArg a) of+      (Irrelevant, _)   -> Just Nothing+      -- if @a@ is the record field name applied to a single argument+      -- then it passes the check+      (_, Just (_, [])) -> Nothing  -- not a projection+      (_, Just (h, e0:es0))+        | (es, Proj _o f) <- initLast1 e0 es0+        , unDom ax == f -> Just $ Just $ h es+      _                 -> Nothing  -- | Is the type a hereditarily singleton record type? May return a -- blocking metavariable.
src/full/Agda/TypeChecking/Reduce.hs view
@@ -6,6 +6,7 @@  import Data.Maybe import Data.Map (Map)+import qualified Data.Map as Map import qualified Data.IntMap as IntMap import Data.Foldable import Data.Traversable@@ -1234,7 +1235,6 @@ instance InstantiateFull t => InstantiateFull (Arg t) instance InstantiateFull t => InstantiateFull (Elim' t) instance InstantiateFull t => InstantiateFull (Named name t)-instance InstantiateFull t => InstantiateFull (Open t) instance InstantiateFull t => InstantiateFull (WithArity t) instance InstantiateFull t => InstantiateFull (IPBoundary' t) @@ -1358,6 +1358,21 @@  instance (InstantiateFull t, InstantiateFull e) => InstantiateFull (Dom' t e) where     instantiateFull' (Dom i fin n tac x) = Dom i fin n <$> instantiateFull' tac <*> instantiateFull' x++-- Andreas, 2021-09-13, issue #5544, need to traverse @checkpoints@ map+instance InstantiateFull t => InstantiateFull (Open t) where+  instantiateFull' (OpenThing checkpoint checkpoints modl t) =+    OpenThing checkpoint+    <$> (instantiateFull' =<< prune checkpoints)+    <*> pure modl+    <*> instantiateFull' t+    where+      -- Ulf, 2021-11-17, #5544+      --  Remove checkpoints that are no longer in scope, since they can+      --  mention functions that deadcode elimination will get rid of.+      prune cps = do+        inscope <- viewTC eCheckpoints+        return $ cps `Map.intersection` inscope  instance InstantiateFull a => InstantiateFull (Closure a) where     instantiateFull' cl = do
src/full/Agda/TypeChecking/Reduce/Fast.hs view
@@ -72,6 +72,7 @@ import Agda.Utils.Lens import Agda.Utils.List import Agda.Utils.Maybe+import Agda.Utils.Monad import Agda.Utils.Null (empty) import Agda.Utils.Functor import Agda.Utils.Pretty@@ -1373,6 +1374,7 @@         -- Bad work-around for #3870: don't fail hard during instance search.       | speculative          = rewriteAM (Eval (mkValue (NotBlocked MissingClauses ()) cl) ctrl)       | f `elem` partialDefs = rewriteAM (Eval (mkValue (NotBlocked MissingClauses ()) cl) ctrl)+      | hasRewriting         = rewriteAM (Eval (mkValue (NotBlocked ReallyNotBlocked ()) cl) ctrl)  -- See #5396       | otherwise            = runReduce $           traceSLn "impossible" 10 ("Incomplete pattern matching when applying " ++ prettyShow f)                    __IMPOSSIBLE__
src/full/Agda/TypeChecking/Rewriting/NonLinMatch.hs view
@@ -52,6 +52,7 @@ import Agda.TypeChecking.Reduce.Monad import Agda.TypeChecking.Substitute import Agda.TypeChecking.Telescope+import Agda.TypeChecking.Primitive.Cubical  import Agda.Utils.Either import Agda.Utils.Functor@@ -164,12 +165,24 @@      , "  with               " <+> addContext k (prettyTCM v)      , "  eliminating head   " <+> addContext k (prettyTCM $ hd []) <+> ":" <+> addContext k (prettyTCM t)]) $ do    case (p,v) of-    (Apply p, Apply v) -> do-      ~(Pi a b) <- addContext k $ unEl <$> reduce t-      match r gamma k a p v-      let t'  = absApp b (unArg v)-          hd' = hd . (Apply v:)-      match r gamma k (t',hd') ps vs+    (Apply p, Apply v) -> (addContext k $ unEl <$> reduce t) >>= \case+      Pi a b -> do+        match r gamma k a p v+        let t'  = absApp b (unArg v)+            hd' = hd . (Apply v:)+        match r gamma k (t',hd') ps vs+      t -> traceSDoc "rewriting.match" 20+        ("application at non-pi type (possible non-confluence?) " <+> prettyTCM t) mzero++    (IApply x y p , IApply u v i) -> (addContext k $ pathView =<< reduce t) >>= \case+      PathType s q l b _u _v -> do+        Right interval <- runExceptT primIntervalType+        match r gamma k interval p i+        let t' = El s $ unArg b `apply` [ defaultArg i ]+        let hd' = hd . (IApply u v i:)+        match r gamma k (t',hd') ps vs+      t -> traceSDoc "rewriting.match" 20+        ("interval application at non-pi type (possible non-confluence?) " <+> prettyTCM (pathUnview t)) mzero      (Proj o f, Proj o' f') | f == f' -> do       ~(Just (El _ (Pi a b))) <- addContext k $ getDefType f =<< reduce t
src/full/Agda/TypeChecking/Rewriting/NonLinPattern.hs view
@@ -26,6 +26,7 @@ import Agda.TypeChecking.Reduce import Agda.TypeChecking.Substitute import Agda.TypeChecking.Telescope+import Agda.TypeChecking.Primitive.Cubical  import Agda.Utils.Either import Agda.Utils.Functor@@ -61,8 +62,14 @@       let hd' = hd `apply` [ u ]       ps  <- patternFrom r k (t',hd') es       return $ Apply p : ps-    (IApply x y u : es) -> typeError $ GenericError $-      "Rewrite rules with cubical are not yet supported"+    (IApply x y i : es) -> do+      ~(PathType s q l b u v) <- pathView =<< reduce t+      let t' = El s $ unArg b `apply` [ defaultArg i ]+      let hd' = hd `applyE` [IApply x y i]+      interval <- primIntervalType+      p   <- patternFrom r k interval i+      ps  <- patternFrom r k (t',hd') es+      return $ IApply (PTerm x) (PTerm y) p : ps     (Proj o f : es) -> do       ~(Just (El _ (Pi a b))) <- getDefType f =<< reduce t       let t' = b `absApp` hd
src/full/Agda/TypeChecking/Rules/Application.hs view
@@ -118,10 +118,12 @@     ]   case unScope hd of     -- Subcase: unambiguous projection-    A.Proj o p | Just x <- getUnambiguous p -> checkUnambiguousProjectionApplication cmp e t x o hd args+    A.Proj o p | Just x <- getUnambiguous p -> do+      checkUnambiguousProjectionApplication cmp e t x o hd args      -- Subcase: ambiguous projection-    A.Proj o p -> checkProjApp cmp e o (unAmbQ p) args t+    A.Proj o p -> do+      checkProjApp cmp e o (unAmbQ p) args t      -- Subcase: unambiguous constructor     A.Con ambC | Just c <- getUnambiguous ambC -> do@@ -959,16 +961,20 @@ ---------------------------------------------------------------------------  checkUnambiguousProjectionApplication :: Comparison -> A.Expr -> Type -> QName -> ProjOrigin -> A.Expr -> [NamedArg A.Expr] -> TCM Term-checkUnambiguousProjectionApplication cmp e t x o hd args =+checkUnambiguousProjectionApplication cmp e t x o hd args = do+  let fallback = checkHeadApplication cmp e t hd args   -- Andreas, 2021-02-19, issue #3289   -- If a postfix projection was moved to the head by appView,   -- we have to patch the first argument with the correct hiding info.   case (o, args) of     (ProjPostfix, arg : rest) -> do-      pr <- fromMaybe __IMPOSSIBLE__ <$> isProjection x-      let ai = projArgInfo pr-      checkHeadApplication cmp e t hd (setArgInfo ai arg : rest)-    _ -> checkHeadApplication cmp e t hd args+      -- Andreas, 2021-11-19, issue #5657:+      -- If @x@ has been brought into scope by e.g. @open R r@, it is no longer+      -- a projection even though the scope checker labels it so.+      -- Thus, @isProjection@ may fail.+      caseMaybeM (isProjection x) fallback $ \ pr -> do+        checkHeadApplication cmp e t hd (setArgInfo (projArgInfo pr) arg : rest)+    _ -> fallback  -- | Inferring the type of an overloaded projection application. --   See 'inferOrCheckProjApp'.@@ -1360,8 +1366,9 @@     -- TODO: is this sufficient?     addConstant c' =<< do       let ai = setModality mod defaultArgInfo+      lang <- getLanguage       useTerPragma $-        (defaultDefn ai c' forcedType emptyFunction)+        (defaultDefn ai c' forcedType lang emptyFunction)         { defMutual = i }      checkFunDef NotDelayed info c' [clause]@@ -1421,7 +1428,7 @@           (Lam defaultArgInfo $ NoAbs "_" $ unArg a0)           (apply (unArg u) [iz])       return $ l : a : phi : u : a0 : rest-    _ -> typeError $ GenericError $ show c ++ " must be fully applied"+    _ -> typeError . GenericDocError =<< prettyTCM c <+> "must be fully applied"  -- | @primHComp : ∀ {ℓ} {A : Set ℓ} {φ : I} (u : ∀ i → Partial φ A) (a : A) → A@ --@@ -1443,7 +1450,7 @@             (Lam defaultArgInfo $ NoAbs "_" $ unArg a0)             (apply (unArg u) [iz])       return $ l : a : phi : u : a0 : rest-    _ -> typeError $ GenericError $ show c ++ " must be fully applied"+    _ -> typeError . GenericDocError =<< prettyTCM c <+> "must be fully applied"  -- | @transp : ∀{ℓ} (A : (i : I) → Set (ℓ i)) (φ : I) (a0 : A i0) → A i1@ --@@ -1467,7 +1474,7 @@           (unArg a)           (Lam defaultArgInfo $ NoAbs "_" $ apply (unArg a) [iz])       return $ l : a : phi : rest-    _ -> typeError $ GenericError $ show c ++ " must be fully applied"+    _ -> typeError . GenericDocError =<< prettyTCM c <+> "must be fully applied"  blockArg :: HasRange r => Type -> r -> Arg Term -> TCM () -> TCM (Arg Term) blockArg t r a m =@@ -1493,7 +1500,7 @@       --   equalTerm (El s (unArg a)) (unArg x) (unArg y) -- precondition for cx being well-typed at ty       --   cx <- pathAbs iv (NoAbs (stringToArgName "_") (applySubst alpha (unArg x)))       --   equalTerm ty (applySubst alpha (unArg p)) cx   -- G, phi |- p = \ i . x-   _ -> typeError $ GenericError $ show c ++ " must be fully applied"+   _ -> typeError . GenericDocError =<< prettyTCM c <+> "must be fully applied"   -- The following comment contains silly ' escapes to calm CPP about ∨ (\vee).@@ -1525,7 +1532,7 @@         -- ' φ₁ ∧ φ₂  ⊢ u , v : PartialP (φ₁ ∨ φ₂) \ o → a o         equalTermOnFace phi t1 (unArg u) (unArg v)       return $ l : phi1 : phi2 : a : u : v : rest-   _ -> typeError $ GenericError $ show c ++ " must be fully applied"+   _ -> typeError . GenericDocError =<< prettyTCM c <+> "must be fully applied"  -- | @prim^glue : ∀ {ℓ ℓ'} {A : Set ℓ} {φ : I} --              → {T : Partial φ (Set ℓ')} → {e : PartialP φ (λ o → T o ≃ A)}@@ -1549,7 +1556,7 @@       ta <- el' (pure $ unArg la) (pure $ unArg bA)       a <- blockArg ta (rs !!! 7) a $ equalTerm ty a' v       return $ la : lb : bA : phi : bT : e : t : a : rest-   _ -> typeError $ GenericError $ show c ++ " must be fully applied"+   _ -> typeError . GenericDocError =<< prettyTCM c <+> "must be fully applied"   -- | @prim^glueU : ∀ {ℓ} {φ : I}@@ -1577,4 +1584,4 @@             el' la (cl primSubOut <#> (cl primLevelSuc <@> la) <#> (Sort . tmSort <$> la) <#> phi <#> (bT <@> cl primIZero) <@> bA)       a <- blockArg ta (rs !!! 5) a $ equalTerm ty a' v       return $ la : phi : bT : bA : t : a : rest-   _ -> typeError $ GenericError $ show c ++ " must be fully applied"+   _ -> typeError . GenericDocError =<< prettyTCM c <+> "must be fully applied"
src/full/Agda/TypeChecking/Rules/Builtin.hs view
@@ -61,8 +61,9 @@ builtinPostulate :: TCM Type -> BuiltinDescriptor builtinPostulate = BuiltinPostulate Relevant -builtinPostulateC :: TCM Type -> BuiltinDescriptor-builtinPostulateC m = BuiltinPostulate Relevant $ requireCubical "" >> m+builtinPostulateC :: Cubical -> TCM Type -> BuiltinDescriptor+builtinPostulateC c m =+  BuiltinPostulate Relevant $ requireCubical c "" >> m  findBuiltinInfo :: String -> Maybe BuiltinInfo findBuiltinInfo b = find ((b ==) . builtinName) coreBuiltins@@ -108,25 +109,26 @@   , (builtinAgdaMeta                         |-> builtinPostulate tset)   , (builtinIO                               |-> builtinPostulate (tset --> tset))   , (builtinPath                             |-> BuiltinUnknown-                                                             (Just $ requireCubical "" >>+                                                             (Just $ requireCubical CErased "" >>                                                              hPi "a" (el primLevel) (                                                               hPi "A" (return $ sort $ varSort 0) $                                                               (El (varSort 1) <$> varM 0) -->                                                               (El (varSort 1) <$> varM 0) -->                                                               return (sort $ varSort 1)))                                                              verifyPath)-  , (builtinPathP                            |-> builtinPostulateC (hPi "a" (el primLevel) $+  , (builtinPathP                            |-> builtinPostulateC CErased (hPi "a" (el primLevel) $                                                               nPi "A" (tinterval --> return (sort $ varSort 0)) $                                                               (El (varSort 1) <$> varM 0 <@> primIZero) -->                                                               (El (varSort 1) <$> varM 0 <@> primIOne) -->                                                               return (sort $ varSort 1)))-  , (builtinInterval                         |-> BuiltinData (requireCubical "" >> (return $ ssort $ ClosedLevel 0)) [builtinIZero,builtinIOne])-  , (builtinSub                              |-> builtinPostulateC (runNamesT [] $ hPi' "a" (el $ cl primLevel) $ \ a ->+  , (builtinInterval                         |-> BuiltinData (requireCubical CErased "" >>+                                                              (return $ ssort $ ClosedLevel 0)) [builtinIZero,builtinIOne])+  , (builtinSub                              |-> builtinPostulateC CErased (runNamesT [] $ hPi' "a" (el $ cl primLevel) $ \ a ->                                                                    nPi' "A" (el' (cl primLevelSuc <@> a) (Sort . tmSort <$> a)) $ \ bA ->                                                                    nPi' "φ" (cl tinterval) $ \ phi ->                                                                    el's a (cl primPartial <#> a <@> phi <@> bA) --> (ssort . atomicLevel <$> a)                                                                   ))-  , (builtinSubIn                            |-> builtinPostulateC (runNamesT [] $+  , (builtinSubIn                            |-> builtinPostulateC CErased (runNamesT [] $                                                                    hPi' "a" (el $ cl primLevel) $ \ a ->                                                                    hPi' "A" (el' (cl primLevelSuc <@> a) (Sort . tmSort <$> a)) $ \ bA ->                                                                    hPi' "φ" (elSSet $ cl primInterval) $ \ phi ->@@ -136,38 +138,38 @@   , (builtinIOne                             |-> BuiltinDataCons tinterval)   , (builtinPartial                          |-> BuiltinPrim "primPartial" (const $ return ()))   , (builtinPartialP                         |-> BuiltinPrim "primPartialP" (const $ return ()))-  , (builtinIsOne                            |-> builtinPostulateC (tinterval --> return (ssort $ ClosedLevel 0)))-  , (builtinItIsOne                          |-> builtinPostulateC (elSSet $ primIsOne <@> primIOne))-  , (builtinIsOne1                           |-> builtinPostulateC (runNamesT [] $+  , (builtinIsOne                            |-> builtinPostulateC CErased (tinterval --> return (ssort $ ClosedLevel 0)))+  , (builtinItIsOne                          |-> builtinPostulateC CErased (elSSet $ primIsOne <@> primIOne))+  , (builtinIsOne1                           |-> builtinPostulateC CErased (runNamesT [] $                                                                    nPi' "i" (cl tinterval) $ \ i ->                                                                    nPi' "j" (cl tinterval) $ \ j ->                                                                    nPi' "i1" (elSSet $ cl primIsOne <@> i) $ \ i1 ->                                                                    (elSSet $ cl primIsOne <@> (cl primIMax <@> i <@> j))))-  , (builtinIsOne2                           |-> builtinPostulateC (runNamesT [] $+  , (builtinIsOne2                           |-> builtinPostulateC CErased (runNamesT [] $                                                                    nPi' "i" (cl tinterval) $ \ i ->                                                                    nPi' "j" (cl tinterval) $ \ j ->                                                                    nPi' "j1" (elSSet $ cl primIsOne <@> j) $ \ j1 ->                                                                    (elSSet $ cl primIsOne <@> (cl primIMax <@> i <@> j))))-  , (builtinIsOneEmpty                       |-> builtinPostulateC (runNamesT [] $+  , (builtinIsOneEmpty                       |-> builtinPostulateC CErased (runNamesT [] $                                                                    hPi' "l" (el $ cl primLevel) $ \ l ->                                                                    hPi' "A" (pPi' "o" (cl primIZero) $ \ _ ->                                                                                   el' (cl primLevelSuc <@> l) (Sort . tmSort <$> l)) $ \ bA ->                                                                    pPi' "o" (cl primIZero) (\ o ->                                                                         el' l $ gApply' (setRelevance Irrelevant defaultArgInfo) bA o))) -  , (builtinId                               |-> builtinPostulateC (hPi "a" (el primLevel) $+  , (builtinId                               |-> builtinPostulateC CErased (hPi "a" (el primLevel) $                                                               hPi "A" (return $ sort $ varSort 0) $                                                               (El (varSort 1) <$> varM 0) -->                                                               (El (varSort 1) <$> varM 0) -->                                                               return (sort $ varSort 1)))-  , (builtinConId                            |-> builtinPostulateC (hPi "a" (el primLevel) $+  , (builtinConId                            |-> builtinPostulateC CErased (hPi "a" (el primLevel) $                                                            hPi "A" (return $ sort $ varSort 0) $                                                            hPi "x" (El (varSort 1) <$> varM 0) $                                                            hPi "y" (El (varSort 2) <$> varM 1) $                                                            tinterval -->                                                            (El (varSort 3) <$> primPath <#> varM 3 <#> varM 2 <@> varM 1 <@> varM 0) -->                                                            (El (varSort 3) <$> primId <#> varM 3 <#> varM 2 <@> varM 1 <@> varM 0)))-  , (builtinEquiv                            |-> BuiltinUnknown (Just $ requireCubical "" >> runNamesT [] (+  , (builtinEquiv                            |-> BuiltinUnknown (Just $ requireCubical CFull "" >> runNamesT [] (                                                                     hPi' "l" (el $ cl primLevel) $ \ a ->                                                                     hPi' "l'" (el $ cl primLevel) $ \ b ->                                                                     nPi' "A" (sort . tmSort <$> a) $ \bA ->@@ -175,7 +177,7 @@                                                                     ((sort . tmSort) <$> (cl primLevelMax <@> a <@> b))                                                                   ))                                                                    (const $ const $ return ()))-  , (builtinEquivFun                         |-> BuiltinUnknown (Just $ requireCubical "" >> runNamesT [] (+  , (builtinEquivFun                         |-> BuiltinUnknown (Just $ requireCubical CFull "" >> runNamesT [] (                                                                  hPi' "l" (el $ cl primLevel) $ \ a ->                                                                  hPi' "l'" (el $ cl primLevel) $ \ b ->                                                                  hPi' "A" (sort . tmSort <$> a) $ \bA ->@@ -184,7 +186,7 @@                                                                  (el' a bA --> el' b bB)                                                                ))                                                                 (const $ const $ return ()))-  , (builtinEquivProof                       |-> BuiltinUnknown (Just $ requireCubical "" >> runNamesT [] (+  , (builtinEquivProof                       |-> BuiltinUnknown (Just $ requireCubical CFull "" >> runNamesT [] (                                                                hPi' "l" (el $ cl primLevel) $ \ la ->                                                                hPi' "l'" (el $ cl primLevel) $ \ lb ->                                                                nPi' "A" (sort . tmSort <$> la) $ \ bA ->@@ -202,7 +204,7 @@                                                                   pPi' "o" phi (\ o -> fiber) --> fiber                                                              ))                                                               (const $ const $ return ()))-  , (builtinTranspProof                       |-> BuiltinUnknown (Just $ requireCubical "" >> runNamesT [] (+  , (builtinTranspProof                       |-> BuiltinUnknown (Just $ requireCubical CErased "" >> runNamesT [] (                                                                hPi' "l" (el $ cl primLevel) $ \ la -> do                                                                nPi' "e" (cl tinterval --> (sort . tmSort <$> la)) $ \ e -> do                                                                let lb = la; bA = e <@> cl primIZero; bB = e <@> cl primIOne@@ -927,7 +929,7 @@     Just (BuiltinPostulate rel mt) -> do       -- We start by adding the corresponding postulate       t <- mt-      addConstant q $ defaultDefn (setRelevance rel defaultArgInfo) q t def+      addConstant' q (setRelevance rel defaultArgInfo) q t def       -- And we then *modify* the definition based on our needs:       -- We add polarity information for SIZE-related definitions       builtinSizeHook b q t@@ -954,7 +956,7 @@                           , primInv      = NotInjective                           , primCompiled = Just (CC.Done [] $ Def q [])                           }-      addConstant q $ defaultDefn defaultArgInfo q t def+      addConstant' q defaultArgInfo q t def       axioms v       bindBuiltinName b v @@ -975,13 +977,13 @@               , conForced = []               , conErased = Nothing               }-      addConstant q $ defaultDefn defaultArgInfo q t def+      addConstant' q defaultArgInfo q t def       addDataCons d [q]       bindBuiltinName b $ Con ch ConOSystem []      Just (BuiltinData mt cs) -> do       t <- mt-      addConstant q $ defaultDefn defaultArgInfo q t (def t)+      addConstant' q defaultArgInfo q t (def t)       bindBuiltinName b $ Def q []       where         def t = Datatype@@ -1004,7 +1006,7 @@                 "primStrictSetOmega" -> Inf IsStrict 0                 _              -> __IMPOSSIBLE__           def = PrimitiveSort sortname s-      addConstant q $ defaultDefn defaultArgInfo q (sort $ univSort s) def+      addConstant' q defaultArgInfo q (sort $ univSort s) def       bindBuiltinName b $ Def q []      Just{}  -> __IMPOSSIBLE__
src/full/Agda/TypeChecking/Rules/Builtin/Coinduction.hs view
@@ -48,8 +48,9 @@ -- definition.  bindBuiltinInf :: ResolvedName -> TCM ()-bindBuiltinInf x = bindPostulatedName builtinInf x $ \inf _ ->-  instantiateFull =<< checkExpr (A.Def inf) =<< typeOfInf+bindBuiltinInf x = bindPostulatedName builtinInf x $ \inf _ -> do+  _ <- checkExpr (A.Def inf) =<< typeOfInf+  return $ Def inf []  -- | Binds the SHARP builtin, and changes the definitions of INFINITY -- and SHARP.@@ -64,7 +65,7 @@   bindPostulatedName builtinSharp x $ \sharp sharpDefn -> do     sharpType <- typeOfSharp     TelV fieldTel _ <- telView sharpType-    sharpE    <- instantiateFull =<< checkExpr (A.Def sharp) sharpType+    _ <- checkExpr (A.Def sharp) sharpType     Def inf _ <- primInf     infDefn   <- getConstInfo inf     addConstant (defName infDefn) $@@ -99,7 +100,7 @@                     , conErased = Nothing                     }                 }-    return sharpE+    return $ Def sharp []  -- | Binds the FLAT builtin, and changes its definition. @@ -111,7 +112,7 @@ bindBuiltinFlat :: ResolvedName -> TCM () bindBuiltinFlat x =   bindPostulatedName builtinFlat x $ \ flat flatDefn -> do-    flatE       <- instantiateFull =<< checkExpr (A.Def flat) =<< typeOfFlat+    _ <- checkExpr (A.Def flat) =<< typeOfFlat     Def sharp _ <- primSharp     kit         <- requireLevels     Def inf _   <- primInf@@ -165,7 +166,7 @@       def { conSrcCon = sharpCon }     modifySignature $ updateDefinition inf $ updateTheDef $ \ def ->       def { recConHead = sharpCon, recFields = [defaultDom flat] }-    return flatE+    return $ Def flat []  -- The coinductive primitives. -- moved to TypeChecking.Monad.Builtin
src/full/Agda/TypeChecking/Rules/Data.hs view
@@ -150,8 +150,7 @@                   }              escapeContext impossible npars $ do-              addConstant name $-                defaultDefn defaultArgInfo name t dataDef+              addConstant' name defaultArgInfo name t dataDef                 -- polarity and argOcc.s determined by the positivity checker              -- Check the types of the constructors@@ -166,8 +165,7 @@          -- Add the datatype to the signature with its constructors.         -- It was previously added without them.-        addConstant name $-          defaultDefn defaultArgInfo name t $+        addConstant' name defaultArgInfo name t $             dataDef{ dataCons = cons }  @@ -216,6 +214,7 @@         -- check that the type of the constructor is well-formed         (t, isPathCons) <- applyQuantityToContext ai $                            checkConstructorType e d+         -- compute which constructor arguments are forced (only point constructors)         forcedArgs <- if isPathCons == PointCons                       then computeForcingAnnotations c t@@ -270,8 +269,7 @@         -- add parameters to constructor type and put into signature         escapeContext impossible (size tel) $ do -          addConstant c $-            defaultDefn ai c (telePi tel t) $ Constructor+          addConstant' c ai c (telePi tel t) $ Constructor               { conPars   = size tel               , conArity  = arity               , conSrcCon = con@@ -611,8 +609,9 @@                 , funMutual     = Just []                 , funTerminates = Just True                 }+      lang <- getLanguage       inTopContext $ addConstant projName $-        (defaultDefn defaultArgInfo projName (unDom projType) fun)+        (defaultDefn defaultArgInfo projName (unDom projType) lang fun)           { defNoCompilation  = True           , defArgOccurrences = [StrictPos]           }@@ -739,9 +738,11 @@   reportSDoc "trans.rec" 20 $ prettyTCM theType   reportSDoc "trans.rec" 60 $ text $ "sort = " ++ show (getSort rect') -  noMutualBlock $ addConstant theName $ (defaultDefn defaultArgInfo theName theType-    (emptyFunction { funTerminates = Just True }))-    { defNoCompilation = True }+  lang <- getLanguage+  noMutualBlock $ addConstant theName $+    (defaultDefn defaultArgInfo theName theType lang+       (emptyFunction { funTerminates = Just True }))+      { defNoCompilation = True }   -- ⊢ Γ = gamma = (δ : Δ^I) (φ : I) (u0 : R (δ i0))   -- Γ ⊢     rtype = R (δ i1)   TelV gamma rtype <- telView theType@@ -905,9 +906,11 @@   reportSDoc "hcomp.rec" 20 $ prettyTCM theType   reportSDoc "hcomp.rec" 60 $ text $ "sort = " ++ show (lTypeLevel rect) -  noMutualBlock $ addConstant theName $ (defaultDefn defaultArgInfo theName theType-    (emptyFunction { funTerminates = Just True }))-    { defNoCompilation = True }+  lang <- getLanguage+  noMutualBlock $ addConstant theName $+    (defaultDefn defaultArgInfo theName theType lang+       (emptyFunction { funTerminates = Just True }))+      { defNoCompilation = True }   --   ⊢ Γ = gamma = (δ : Δ) (φ : I) (_ : (i : I) -> Partial φ (R δ)) (_ : R δ)   -- Γ ⊢     rtype = R δ   TelV gamma rtype <- telView theType
src/full/Agda/TypeChecking/Rules/Decl.hs view
@@ -548,7 +548,8 @@       , nest 2 $ prettyTCM tGen       ] -    addConstant x $ (defaultDefn info x tGen GeneralizableVar)+    lang <- getLanguage+    addConstant x $ (defaultDefn info x tGen lang GeneralizableVar)                     { defArgGeneralizable = SomeGeneralizableArgs n }  @@ -639,7 +640,8 @@   -- Not safe. See Issue 330   -- t <- addForcingAnnotations t -  let defn = defaultDefn info x t $+  lang <- getLanguage+  let defn = defaultDefn info x t lang $         case kind of   -- #4833: set abstract already here so it can be inherited by with functions           FunName   -> emptyFunction{ funAbstr = Info.defAbstract i }           MacroName -> set funMacro True emptyFunction{ funAbstr = Info.defAbstract i }@@ -707,8 +709,7 @@             _ -> defaultArgInfo     unless (info == expectedInfo) $ typeError $ WrongModalityForPrimitive name info expectedInfo     bindPrimitive s pf-    addConstant x $-      defaultDefn info x t $+    addConstant' x info x t $         Primitive { primAbstr    = Info.defAbstract i                   , primName     = s                   , primClauses  = []
src/full/Agda/TypeChecking/Rules/Def.hs view
@@ -101,10 +101,16 @@                   mapM_ unfreezeMeta (x : xs)                 checkAlias t info delayed i name e mc             | otherwise -> do -- Warn about abstract alias (will never work!)-              setCurrentRange i $ genericWarning =<<-                "Missing type signature for abstract definition" <+> (prettyTCM name <> ".") $$-                fsep (pwords "Types of abstract definitions are never inferred since this would leak" ++-                      pwords "information that should be abstract.")+              -- Ulf, 2021-11-18, #5620: Don't warn if the meta is solved. A more intuitive solution+              -- would be to not treat definitions with solved meta types as aliases, but in mutual+              -- blocks you might actually have solved the type of an alias by the time you get to+              -- the definition. See test/Succeed/SizeInfinity.agda for an example where this+              -- happens.+              whenM (isOpenMeta . mvInstantiation <$> lookupMeta x) $+                setCurrentRange i $ genericWarning =<<+                  "Missing type signature for abstract definition" <+> (prettyTCM name <> ".") $$+                  fsep (pwords "Types of abstract definitions are never inferred since this would leak" +++                        pwords "information that should be abstract.")               checkFunDef' t info delayed Nothing Nothing i name cs           _ -> checkFunDef' t info delayed Nothing Nothing i name cs @@ -178,7 +184,7 @@         _          -> id    -- Add the definition-  addConstant name $ defaultDefn ai name t+  addConstant' name ai name t                    $ set funMacro (Info.defMacro i == MacroDef) $                      emptyFunction                       { funClauses = [ Clause  -- trivial clause @name = v@@@ -417,9 +423,10 @@              , funWith           = with              , funCovering       = covering              }+          lang <- getLanguage           useTerPragma $             updateDefCopatternLHS (const $ hasProjectionPatterns cc) $-            defaultDefn ai name fullType defn+            defaultDefn ai name fullType lang defn          reportSDoc "tc.def.fun" 10 $ do           sep [ "added " <+> prettyTCM name <+> ":"@@ -1012,9 +1019,22 @@   -> TCM (Maybe Term, WithFunctionProblem)                                 -- Note: as-bindings already bound (in checkClause) checkWithRHS x aux t (LHSResult npars delta ps _absurdPat trhs _ _asb _) vtys0 cs =-  Bench.billTo [Bench.Typing, Bench.With] $ do+  verboseBracket "tc.with.top" 25 "checkWithRHS" $ do+    Bench.billTo [Bench.Typing, Bench.With] $ do         withArgs <- withArguments vtys0         let perm = fromMaybe __IMPOSSIBLE__ $ dbPatPerm ps++        reportSDoc "tc.with.top" 30 $ vcat $+          -- declared locally because we do not want to use the unzip'd thing!+          let (vs, as) = unzipWith unArg vtys0 in+          [ "vs (before normalization) =" <+> prettyTCM vs+          , "as (before normalization) =" <+> prettyTCM as+          ]+        reportSDoc "tc.with.top" 45 $ vcat $+          -- declared locally because we do not want to use the unzip'd thing!+          let (vs, as) = unzipWith unArg vtys0 in+          [ "vs (before norm., raw) =" <+> pretty vs+          ]         vtys0 <- normalise vtys0          -- Andreas, 2012-09-17: for printing delta,@@ -1063,7 +1083,10 @@             v         = Nothing -- generated by checkWithFunction         -- Andreas, 2013-02-26 add with-name to signature for printing purposes         addConstant aux =<< do-          useTerPragma $ defaultDefn defaultArgInfo aux __DUMMY_TYPE__ emptyFunction+          lang <- getLanguage+          useTerPragma $+            defaultDefn defaultArgInfo aux __DUMMY_TYPE__ lang+              emptyFunction          reportSDoc "tc.with.top" 20 $ vcat $           let (vs, as) = unzipWith unArg vtys in@@ -1157,8 +1180,10 @@         , prettyTCM dt         ]   addConstant aux =<< do-    useTerPragma $ (defaultDefn defaultArgInfo aux withFunType emptyFunction)-                   { defDisplay = [df] }+    lang <- getLanguage+    useTerPragma $+      (defaultDefn defaultArgInfo aux withFunType lang emptyFunction)+        { defDisplay = [df] }   -- solveSizeConstraints -- Andreas, 2012-10-16 does not seem necessary    reportSDoc "tc.with.top" 10 $ sep
src/full/Agda/TypeChecking/Rules/LHS.hs view
@@ -1415,8 +1415,9 @@            -- The result type's quantity is set to 0 for erased           -- constructors, but not if the match is made in an erased-          -- position.-          cq <- getQuantity <$> getConstInfo (conName c)+          -- position, or if the original constructor definition is+          -- not erased.+          cq <- getQuantity <$> getOriginalConstInfo (conName c)           let target'' = mapQuantity updResMod target'                 where                   erased = case getQuantity info of@@ -1955,17 +1956,17 @@    where     checkPropSplit-      | IsRecord _ _ <- dr     = return ()+      | IsRecord Nothing _ <- dr = return ()       | Just target <- mtarget = do         reportSDoc "tc.sort.check" 20 $ "target prop:" <+> prettyTCM target         checkIsProp target       | otherwise              = do           reportSDoc "tc.sort.check" 20 $ "no target prop"-          splitOnPropError+          splitOnPropError dr      checkIsProp t = runBlocked (isPropM t) >>= \case-      Left b      -> splitOnPropError -- TODO-      Right False -> splitOnPropError+      Left b      -> splitOnPropError dr -- TODO+      Right False -> splitOnPropError dr       Right True  -> return ()      checkFibrantSplit@@ -1993,8 +1994,15 @@       Right False -> splitOnFibrantError Nothing       Right True  -> return () -    splitOnPropError = softTypeError $ GenericError-      "Cannot split on datatype in Prop unless target is in Prop"+    splitOnPropError dr = softTypeError =<< do+      liftTCM $ GenericDocError <$>+        ("Cannot split on" <+> kindOfData dr <+> "in Prop unless target is in Prop")+      where+        kindOfData :: DataOrRecord -> TCM Doc+        kindOfData IsData                          = "datatype"+        kindOfData (IsRecord Nothing _)            = "record type"+        kindOfData (IsRecord (Just Inductive) _)   = "inductive record type"+        kindOfData (IsRecord (Just CoInductive) _) = "coinductive record type"      splitOnFibrantError' t mb = softTypeError =<< do       liftTCM $ SortOfSplitVarError mb <$> fsep
src/full/Agda/TypeChecking/Rules/LHS/Unify.hs view
@@ -1310,13 +1310,15 @@     noForced v = gets $ IntSet.disjoint (precomputedFreeVars v) . IntMap.keysSet      bind md i = do-      Just md' <- gets $ IntMap.lookup i-      if related md POLE md'    -- The new binding site must be more relevant (more relevant = smaller).-        then do                 -- The forcing analysis guarantees that there exists such a position.+      gets (IntMap.lookup i) >>= \case+        Just md' | related md POLE md' -> do+          -- The new binding site must be more relevant (more relevant = smaller).+          -- "The forcing analysis guarantees that there exists such a position."+          -- Really? Andreas, 2021-08-18, issue #5506           tell   $ IntMap.singleton i md           modify $ IntMap.delete i           return $ varP (deBruijnVar i)-        else return $ dotP (Var i [])+        _ -> return $ dotP (Var i [])      go md v = ifM (noForced v) (return $ dotP v) $ do       v' <- lift $ lift $ reduce v
src/full/Agda/TypeChecking/Rules/Record.hs view
@@ -210,8 +210,7 @@       let npars = size tel           telh  = fmap hideAndRelParams tel       escapeContext impossible npars $ do-        addConstant name $-          defaultDefn defaultArgInfo name t $+        addConstant' name defaultArgInfo name t $             Record               { recPars           = npars               , recClause         = Nothing@@ -231,8 +230,8 @@               }          -- Add record constructor to signature-        addConstant conName $-          defaultDefn defaultArgInfo conName (telh `abstract` contype) $+        addConstant' conName defaultArgInfo conName+            (telh `abstract` contype) $             Constructor               { conPars   = npars               , conArity  = size fs@@ -716,8 +715,9 @@               ]          escapeContext impossible (size tel) $ do+          lang <- getLanguage           addConstant projname $-            (defaultDefn ai projname (killRange finalt)+            (defaultDefn ai projname (killRange finalt) lang               emptyFunction                 { funClauses        = [clause]                 , funCompiled       = Just cc
src/full/Agda/TypeChecking/Rules/Term.hs view
@@ -491,11 +491,14 @@     trySeeingIfPath = do       cubical <- optCubical <$> pragmaOptions       reportSLn "tc.term.lambda" 60 $ "trySeeingIfPath for " ++ show xps-      let postpone' = if cubical then postpone else \ _ _ -> dontUseTargetType+      let postpone' = if isJust cubical then postpone else \ _ _ -> dontUseTargetType       ifBlocked target postpone' $ \ _ t -> do-        ifPath t dontUseTargetType $ if cubical+        ifPath t dontUseTargetType $ if isJust cubical           then checkPath b body t-          else genericError "Option --cubical needed to build a path with a lambda abstraction"+          else genericError $ unwords+                 [ "Option --cubical/--erased-cubical needed to build"+                 , "a path with a lambda abstraction"+                 ]      postpone blocker tgt = flip postponeTypeCheckingProblem blocker $       CheckExpr cmp (A.Lam A.exprNoRange (A.DomainFull b) body) tgt@@ -745,8 +748,9 @@             [ ("Adding absurd function" <+> prettyTCM mod) <> prettyTCM aux             , nest 2 $ "of type" <+> prettyTCM t'             ]+          lang <- getLanguage           addConstant aux $-            (\ d -> (defaultDefn (setModality mod info') aux t' d)+            (\ d -> (defaultDefn (setModality mod info') aux t' lang d)                     { defPolarity       = [Nonvariant]                     , defArgOccurrences = [Unused] })             $ emptyFunction@@ -818,8 +822,10 @@        -- Andreas, 2013-12-28: add extendedlambda as @Function@, not as @Axiom@;        -- otherwise, @addClause@ in @checkFunDef'@ fails (see issue 1009).        addConstant qname =<< do+         lang <- getLanguage          useTerPragma $-           (defaultDefn info qname t emptyFunction) { defMutual = j }+           (defaultDefn info qname t lang emptyFunction)+             { defMutual = j }        checkFunDef' t info NotDelayed (Just $ ExtLamInfo lamMod False empty) Nothing di qname $          List1.toList cs        whenNothingM (asksTC envMutualBlock) $@@ -1571,7 +1577,7 @@ --   @{tel} -> D vs@ for some datatype @D@ then insert the hidden --   arguments.  Otherwise, leave the type polymorphic. inferExprForWith :: Arg A.Expr -> TCM (Term, Type)-inferExprForWith (Arg info e) =+inferExprForWith (Arg info e) = verboseBracket "tc.with.infer" 20 "inferExprForWith" $   applyRelevanceToContext (getRelevance info) $ do     reportSDoc "tc.with.infer" 20 $ "inferExprforWith " <+> prettyTCM e     reportSLn  "tc.with.infer" 80 $ "inferExprforWith " ++ show (deepUnscope e)
src/full/Agda/TypeChecking/Serialise.hs view
@@ -67,12 +67,14 @@ import Agda.Utils.Hash import Agda.Utils.IORef +import Agda.Utils.Impossible+ -- Note that the Binary instance for Int writes 64 bits, but throws -- away the 32 high bits when reading (at the time of writing, on -- 32-bit machines). Word64 does not have these problems.  currentInterfaceVersion :: Word64-currentInterfaceVersion = 20210510 * 10 + 0+currentInterfaceVersion = 20210514 * 10 + 1  -- | The result of 'encode' and 'encodeInterface'. @@ -121,9 +123,9 @@       statistics "A.QName"     qnameC       statistics "A.Name"      nameC     when collectStats $ do-      stats <- Map.fromList . map (second toInteger) <$> do+      stats <- Map.fromListWith __IMPOSSIBLE__ . map (second toInteger) <$> do         liftIO $ H.toList stats-      modifyStatistics $ Map.union stats+      modifyStatistics $ Map.unionWith (+) stats     -- Encode hashmaps and root, and compress.     bits1 <- Bench.billTo [ Bench.Serialization, Bench.BinaryEncode ] $       return $!! B.encode (root, nL, ltL, stL, bL, iL, dL)
src/full/Agda/TypeChecking/Serialise/Instances/Common.hs view
@@ -173,6 +173,26 @@     [3] -> valuN OrgFileType     _   -> malformed +instance EmbPrj Cubical where+  icod_ CErased = icodeN'  CErased+  icod_ CFull   = icodeN 0 CFull++  value = vcase $ \case+    []  -> valuN CErased+    [0] -> valuN CFull+    _   -> malformed++instance EmbPrj Language where+  icod_ WithoutK    = icodeN'  WithoutK+  icod_ WithK       = icodeN 0 WithK+  icod_ (Cubical a) = icodeN 1 Cubical a++  value = vcase $ \case+    []     -> valuN WithoutK+    [0]    -> valuN WithK+    [1, a] -> valuN Cubical a+    _      -> malformed+ instance EmbPrj AbsolutePath where   icod_ file = do     d <- asks absPathD@@ -246,16 +266,16 @@   value m = BiMap.fromDistinctAscendingLists <$> value m  instance (Ord a, EmbPrj a, EmbPrj b) => EmbPrj (Map a b) where-  icod_ m = icode (Map.toList m)-  value m = Map.fromList `fmap` value m+  icod_ m = icode (Map.toAscList m)+  value m = Map.fromDistinctAscList <$> value m  instance (Ord a, EmbPrj a) => EmbPrj (Set a) where-  icod_ s = icode (Set.toList s)-  value s = Set.fromList `fmap` value s+  icod_ s = icode (Set.toAscList s)+  value s = Set.fromDistinctAscList <$> value s  instance EmbPrj IntSet where-  icod_ s = icode (IntSet.toList s)-  value s = IntSet.fromList <$> value s+  icod_ s = icode (IntSet.toAscList s)+  value s = IntSet.fromDistinctAscList <$> value s  instance (Ord a, EmbPrj a, EmbPrj b) => EmbPrj (Trie a b) where   icod_ (Trie a b)= icodeN' Trie a b
src/full/Agda/TypeChecking/Serialise/Instances/Errors.hs view
@@ -190,6 +190,7 @@     InvalidRecordDirective a          -> icodeN 29 InvalidRecordDirective a     InvalidConstructor a              -> icodeN 30 InvalidConstructor a     InvalidConstructorBlock a         -> icodeN 31 InvalidConstructorBlock a+    MissingDeclarations a             -> icodeN 32 MissingDeclarations a    value = vcase $ \case     [0, a]   -> valuN UnknownNamesInFixityDecl a@@ -224,6 +225,7 @@     [29,r]   -> valuN InvalidRecordDirective r     [30,r]   -> valuN InvalidConstructor r     [31,r]   -> valuN InvalidConstructorBlock r+    [32,r]   -> valuN MissingDeclarations r     _ -> malformed  instance EmbPrj LibWarning where
src/full/Agda/TypeChecking/Serialise/Instances/Internal.hs view
@@ -208,7 +208,7 @@   value = valueN CompKit  instance EmbPrj Definition where-  icod_ (Defn a b c d e f g h i j k l m n o p q r) = icodeN' Defn a b (P.killRange c) d e f g h i j k l m n o p q r+  icod_ (Defn a b c d e f g h i j k l m n o p q r s) = icodeN' Defn a b (P.killRange c) d e f g h i j k l m n o p q r s    value = valueN Defn 
src/full/Agda/TypeChecking/SizedTypes/Syntax.hs view
@@ -17,6 +17,8 @@ import Agda.Utils.Null import Agda.Utils.Pretty +import Agda.Utils.Impossible+ -- * Syntax  -- | Constant finite sizes @n >= 0@.@@ -115,8 +117,9 @@ emptyPolarities :: Polarities flex emptyPolarities = Map.empty +-- Used in size-solver (Andreas, 2021-08-20) polaritiesFromAssignments :: Ord flex => [PolarityAssignment flex] -> Polarities flex-polaritiesFromAssignments = Map.fromList . map (\ (PolarityAssignment p x) -> (x,p))+polaritiesFromAssignments = Map.fromListWith __IMPOSSIBLE__ . map (\ (PolarityAssignment p x) -> (x,p))  -- | Default polarity is 'Least'. getPolarity :: Ord flex => Polarities flex -> flex -> Polarity
src/full/Agda/TypeChecking/SizedTypes/WarshallSolver.hs view
@@ -653,7 +653,8 @@                Graph r f a -> [Node r f] -> Map (Node r f) [Edge' r f a] commonSuccs hg srcs = intersectAll $ map (buildmap . outgoing hg) srcs   where-   buildmap            = Map.fromList . map (\ e -> (dest e, [e]))+   buildmap            = Map.fromListWith __IMPOSSIBLE__ . map (\ e -> (dest e, [e]))+     -- __IMPOSSIBLE__ because it is not a multi-graph; there is at most one egde per (src,dest)    intersectAll []     = Map.empty    intersectAll (m:ms) = foldl (Map.intersectionWith (++)) m ms @@ -665,7 +666,7 @@ commonPreds :: (Ord r, Ord f) => Graph r f a -> [Node r f] -> Map (Node r f) [Edge' r f a] commonPreds hg tgts = intersectAll $  map (buildmap . incoming hg) tgts   where-   buildmap = Map.fromList . map (\ e -> (src e, [e]))+   buildmap = Map.fromListWith __IMPOSSIBLE__ . map (\ e -> (src e, [e]))    intersectAll []     = Map.empty    intersectAll (m:ms) = foldl (Map.intersectionWith (++)) m ms @@ -868,7 +869,7 @@       xs = Set.toAscList $ Set.unions [ Map.keysSet lbs, Map.keysSet ubs, fs ]   -- iterate over all flexible variables   xas <- catMaybes <$> do-    forM xs $ \ x -> do+    forM xs $ \ x -> fmap (x,) <$> do       -- get lower and upper bounds for flexible x       let lx = Set.toList $ Map.findWithDefault Set.empty x lbs           ux = Set.toList $ Map.findWithDefault Set.empty x ubs@@ -892,16 +893,16 @@                      | Just l' <- findRigidBelow hg l -> return $ Just l'               _ -> Left $ "inconsistent upper bound for " ++ prettyShow x       case (lb, ub) of-        (Just l, Nothing) -> return $ Just (x, l)  -- solve x = lower bound-        (Nothing, Just u) -> return $ Just (x, u)  -- solve x = upper bound+        (Just l, Nothing) -> return $ Just l  -- solve x = lower bound+        (Nothing, Just u) -> return $ Just u  -- solve x = upper bound         (Just l,  Just u) -> do           traceM ("lower bound for " ++ prettyShow x ++ ": " ++ prettyShow l)           traceM ("upper bound for " ++ prettyShow x ++ ": " ++ prettyShow u)           case getPolarity pols x of-            Least    -> return $ Just (x, l)-            Greatest -> return $ Just (x, u)+            Least    -> return $ Just l+            Greatest -> return $ Just u         _ -> return Nothing-  return $ Solution $ Map.fromList xas+  return $ Solution $ Map.fromDistinctAscList xas  -- | Solve a forest of constraint graphs relative to a hypotheses graph. --   Concatenate individual solutions.
src/full/Agda/TypeChecking/Sort.hs view
@@ -27,7 +27,7 @@ import Data.Functor import Data.Maybe -import Agda.Interaction.Options (optCumulativity)+import Agda.Interaction.Options (optCumulativity, optRewriting)  import Agda.Syntax.Common import Agda.Syntax.Internal@@ -208,7 +208,9 @@         case unEl (ignoreBlocking ba) of           Pi b c -> sortOfE (c `absApp` v) (hd . (e:)) es           _ | Blocked m _ <- ba -> patternViolation m-            | otherwise         -> __IMPOSSIBLE__+            | otherwise         -> ifM (optRewriting <$> pragmaOptions)+                {-then-} (patternViolation neverUnblock)  -- Not IMPOSSIBLE because of possible non-confluent rewriting (see #5531)+                {-else-} __IMPOSSIBLE__       Proj o f -> do         a <- reduce a         ~(El _ (Pi b c)) <- fromMaybe __IMPOSSIBLE__ <$> getDefType f a
src/full/Agda/TypeChecking/Substitute.hs view
@@ -229,8 +229,8 @@   applyE t es = apply t $ fromMaybe __IMPOSSIBLE__ $ allApplyElims es  instance Apply Definition where-  apply (Defn info x t pol occ gens gpars df m c inst copy ma nc inj copat blk d) args =-    Defn info x (piApply t args) (apply pol args) (apply occ args) (apply gens args) (drop (length args) gpars) df m c inst copy ma nc inj copat blk (apply d args)+  apply (Defn info x t pol occ gens gpars df m c inst copy ma nc inj copat blk lang d) args =+    Defn info x (piApply t args) (apply pol args) (apply occ args) (apply gens args) (drop (length args) gpars) df m c inst copy ma nc inj copat blk lang (apply d args)    applyE t es = apply t $ fromMaybe __IMPOSSIBLE__ $ allApplyElims es @@ -610,9 +610,10 @@   ExtendTel arg xtel `abstract` tel = ExtendTel arg $ xtel <&> (`abstract` tel)  instance Abstract Definition where-  abstract tel (Defn info x t pol occ gens gpars df m c inst copy ma nc inj copat blk d) =+  abstract tel (Defn info x t pol occ gens gpars df m c inst copy ma nc inj copat blk lang d) =     Defn info x (abstract tel t) (abstract tel pol) (abstract tel occ) (abstract tel gens)-                (replicate (size tel) Nothing ++ gpars) df m c inst copy ma nc inj copat blk (abstract tel d)+      (replicate (size tel) Nothing ++ gpars)+      df m c inst copy ma nc inj copat blk lang (abstract tel d)  -- | @tel ⊢ (Γ ⊢ lhs ↦ rhs : t)@ becomes @tel, Γ ⊢ lhs ↦ rhs : t)@ --   we do not need to change lhs, rhs, and t since they live in Γ.
src/full/Agda/TypeChecking/Unquote.hs view
@@ -125,12 +125,9 @@     loop _         = False  reduceQuotedTerm :: Term -> UnquoteM Term-reduceQuotedTerm t = do-  b <- ifBlocked t {-then-} (\ m _ -> pure $ Left  m)-                   {-else-} (\ _ t -> pure $ Right t)-  case b of-    Left m  -> do s <- gets snd; throwError $ BlockedOnMeta s m-    Right t -> return t+reduceQuotedTerm t = locallyReduceAllDefs $ do+  ifBlocked t {-then-} (\ m _ -> do s <- gets snd; throwError $ BlockedOnMeta s m)+              {-else-} (\ _ t -> return t)  class Unquote a where   unquote :: I.Term -> UnquoteM a@@ -885,7 +882,7 @@         a <- locallyReduceAllDefs $ isType_ =<< toAbstract_ a         alreadyDefined <- isRight <$> getConstInfo' x         when alreadyDefined $ genericError $ "Multiple declarations of " ++ prettyShow x-        addConstant x $ defaultDefn i x a emptyFunction+        addConstant' x i x a emptyFunction         when (isInstance i) $ addTypedInstance x a         primUnitUnit @@ -906,7 +903,7 @@         a <- locallyReduceAllDefs $ isType_ =<< toAbstract_ a         alreadyDefined <- isRight <$> getConstInfo' x         when alreadyDefined $ genericError $ "Multiple declarations of " ++ prettyShow x-        addConstant x $ defaultDefn i x a defaultAxiom+        addConstant' x i x a defaultAxiom         when (isInstance i) $ addTypedInstance x a         primUnitUnit 
src/full/Agda/Utils/Graph/AdjacencyMap/Unidirectional.hs view
@@ -42,7 +42,11 @@   , clean   , removeNode, removeNodes   , removeEdge+  , filterNodes   , filterEdges+  , filterNodesKeepingEdges+  , renameNodes, renameNodesMonotonic+  , WithUniqueInt(..), addUniqueInts   , unzip   , composeWith     -- * Strongly connected components@@ -57,10 +61,12 @@     -- * Reachability   , reachableFrom, reachableFromSet   , walkSatisfying+  , longestPaths     -- * Transitive closure   , gaussJordanFloydWarshallMcNaughtonYamada   , gaussJordanFloydWarshallMcNaughtonYamadaReference   , transitiveClosure+  , transitiveReduction   , complete, completeIter   )   where@@ -71,6 +77,7 @@   import qualified Data.Array.IArray as Array+import Data.Sequence (Seq) import qualified Data.Sequence as Seq import Data.Function import qualified Data.Graph as Graph@@ -425,16 +432,22 @@ clean :: Null e => Graph n e -> Graph n e clean = Graph . Map.map (Map.filter (not . null)) . graph +-- | The graph @filterNodes p g@ contains exactly those nodes from @g@+-- that satisfy the predicate @p@. Edges to or from nodes that are+-- removed are also removed. /O(n + e)/.++filterNodes :: Ord n => (n -> Bool) -> Graph n e -> Graph n e+filterNodes p (Graph g) = Graph (Map.mapMaybeWithKey remSrc g)+  where+  remSrc s m+    | p s       = Just (Map.filterWithKey (\t _ -> p t) m)+    | otherwise = Nothing+ -- | @removeNodes ns g@ removes the nodes in @ns@ (and all -- corresponding edges) from @g@. /O((n + e) log |@ns@|)/.  removeNodes :: Ord n => Set n -> Graph n e -> Graph n e-removeNodes ns (Graph g) = Graph (Map.mapMaybeWithKey remSrc g)-  where-  remSrc s m-    | Set.member s ns = Nothing-    | otherwise       =-        Just (Map.filterWithKey (\t _ -> not (Set.member t ns)) m)+removeNodes ns = filterNodes (\n -> not (Set.member n ns))  -- | @removeNode n g@ removes the node @n@ (and all corresponding -- edges) from @g@. /O(n + e)/.@@ -458,6 +471,134 @@       f (Edge { source = s, target = t, label = l }))) .   graph +-- | Removes the nodes that do not satisfy the predicate from the+-- graph, but keeps the edges: if there is a path in the original+-- graph between two nodes that are retained, then there is a path+-- between these two nodes also in the resulting graph.+--+-- Precondition: The graph must be acyclic.+--+-- Worst-case time complexity: /O(e n log n)/ (this has not been+-- verified carefully).++filterNodesKeepingEdges ::+  forall n e. (Ord n, SemiRing e) =>+  (n -> Bool) -> Graph n e -> Graph n e+filterNodesKeepingEdges p g =+  foldr (insertEdgeWith oplus) (filterNodes p g)+    (fst edgesToAddAndRemove)+  where+  -- The new edges that should be added, and a map from nodes that+  -- should be removed to edges that should potentially be added+  -- (after being combined with paths into the nodes that should be+  -- removed).+  edgesToAddAndRemove :: ([Edge n e], Map n (Map n e))+  edgesToAddAndRemove =+    List.foldl' edgesToAddAndRemoveForSCC ([], Map.empty) (sccs' g)++  edgesToAddAndRemoveForSCC (add, !remove) (Graph.AcyclicSCC n)+    | p n =+      ( (do (n', e) <- neighbours n g+            case Map.lookup n' remove of+              Nothing -> []+              Just es ->+                flip map (Map.toList es) $ \(n', e') -> Edge+                  { source = n+                  , target = n'+                  , label  = e `otimes` e'+                  })+          +++        add+      , remove+      )+    | otherwise =+      ( add+      , Map.insert+          n+          (Map.unionsWith oplus $+           flip map (neighbours n g) $ \(n', e) ->+             case Map.lookup n' remove of+               Nothing -> Map.singleton n' e+               Just es -> fmap (e `otimes`) es)+          remove+      )+  edgesToAddAndRemoveForSCC _ (Graph.CyclicSCC{}) = __IMPOSSIBLE__++-- | Renames the nodes.+--+-- Precondition: The renaming function must be injective.+--+-- Time complexity: /O((n + e) log n)/.++renameNodes :: Ord n2 => (n1 -> n2) -> Graph n1 e -> Graph n2 e+renameNodes ren =+  Graph .+  fmap (Map.mapKeys ren) .+  Map.mapKeys ren .+  graph++-- | Renames the nodes.+--+-- Precondition: The renaming function @ren@ must be strictly+-- increasing (if @x '<' y@ then @ren x '<' ren y@).+--+-- Time complexity: /O(n + e)/.++renameNodesMonotonic ::+  (Ord n1, Ord n2) => (n1 -> n2) -> Graph n1 e -> Graph n2 e+renameNodesMonotonic ren =+  Graph .+  fmap (Map.mapKeysMonotonic ren) .+  Map.mapKeysMonotonic ren .+  graph++-- | @WithUniqueInt n@ consists of pairs of (unique) 'Int's and values+-- of type @n@.+--+-- Values of this type are compared by comparing the 'Int's.++data WithUniqueInt n = WithUniqueInt+  { uniqueInt  :: !Int+  , otherValue :: !n+  }+  deriving (Show, Functor)++instance Eq (WithUniqueInt n) where+  WithUniqueInt i1 _ == WithUniqueInt i2 _ = i1 == i2++instance Ord (WithUniqueInt n) where+  compare (WithUniqueInt i1 _) (WithUniqueInt i2 _) = compare i1 i2++instance Pretty n => Pretty (WithUniqueInt n) where+  pretty (WithUniqueInt i n) =+    parens ((pretty i <> comma) <+> pretty n)++-- | Combines each node label with a unique 'Int'.+--+-- Precondition: The number of nodes in the graph must not be larger+-- than @'maxBound' :: 'Int'@.+--+-- Time complexity: /O(n + e log n)/.++addUniqueInts ::+  forall n e. Ord n => Graph n e -> Graph (WithUniqueInt n) e+addUniqueInts g =+  Graph $+  Map.fromDistinctAscList $+  map (\(i, (n, m)) ->+        (WithUniqueInt i n, Map.mapKeysMonotonic ren m)) $+  zip [0..] $+  Map.toAscList $+  graph g+  where+  renaming :: Map n Int+  renaming = snd $ Map.mapAccum (\i _ -> (succ i, i)) 0 (graph g)++  ren :: n -> WithUniqueInt n+  ren n = case Map.lookup n renaming of+    Just i  -> WithUniqueInt i n+    Nothing -> __IMPOSSIBLE__+ -- | Unzips the graph. /O(n + e)/.  -- This is a naive implementation that uses fmap.@@ -492,16 +633,28 @@  -- | The graph's strongly connected components, in reverse topological -- order.+--+-- The time complexity is likely /O(n + e log n)/ (but this depends on+-- the, at the time of writing undocumented, time complexity of+-- 'Graph.stronglyConnComp').  sccs' :: Ord n => Graph n e -> [Graph.SCC n] sccs' g =   Graph.stronglyConnComp-    [ (n, n, map target (edgesFrom g [n]))-    | n <- Set.toList (nodes g)+    [ (n, n, Map.keys es)+    | (n, es) <- Map.toAscList (graph g)     ]+    -- Graph.stronglyConnComp sorts this list, and the sorting+    -- algorithm that is used is adaptive, so it may make sense to+    -- generate a sorted list. (These comments apply to one specific+    -- version of the code in Graph, compiled in a specific way.)  -- | The graph's strongly connected components, in reverse topological -- order.+--+-- The time complexity is likely /O(n + e log n)/ (but this depends on+-- the, at the time of writing undocumented, time complexity of+-- 'Graph.stronglyConnComp').  sccs :: Ord n => Graph n e -> [[n]] sccs = map Graph.flattenSCC . sccs'@@ -704,6 +857,57 @@   reachesTo =     reachableFrom (fromEdges (map transposeEdge everyEdges)) to +-- | Constructs a graph @g'@ with the same nodes as the original graph+-- @g@. In @g'@ there is an edge from @n1@ to @n2@ if and only if+-- there is a (possibly empty) simple path from @n1@ to @n2@ in @g@.+-- In that case the edge is labelled with all of the longest (in terms+-- of numbers of edges) simple paths from @n1@ to @n2@ in @g@, as well+-- as the lengths of these paths.+--+-- Precondition: The graph must be acyclic. The number of nodes in the+-- graph must not be larger than @'maxBound' :: 'Int'@.+--+-- Worst-case time complexity (if the paths are not inspected):+-- /O(e n log n)/ (this has not been verified carefully).+--+-- The algorithm is based on one found on Wikipedia.++longestPaths ::+  forall n e. Ord n => Graph n e -> Graph n (Int, [[Edge n e]])+longestPaths g =+  Graph $+  fmap (fmap (mapSnd toList)) $+  List.foldl' (flip addLongestFrom) Map.empty $+  sccs' g+  where+  addLongestFrom ::+    Graph.SCC n ->+    Map n (Map n (Int, Seq [Edge n e])) ->+    Map n (Map n (Int, Seq [Edge n e]))+  addLongestFrom Graph.CyclicSCC{}    !_  = __IMPOSSIBLE__+  addLongestFrom (Graph.AcyclicSCC n) pss =+    Map.insert n+      (Map.insert n (0, Seq.singleton []) $+       Map.unionsWith longest candidates)+      pss+    where+    longest p1@(n1, ps1) p2@(n2, ps2) = case compare n1 n2 of+      GT -> p1+      LT -> p2+      EQ -> (n1, ps1 Seq.>< ps2)++    candidates :: [Map n (Int, Seq [Edge n e])]+    candidates =+      flip map (neighbours n g) $ \(n', e) ->+      let edge = Edge+            { source = n+            , target = n'+            , label  = e+            }+      in case Map.lookup n' pss of+        Nothing -> Map.empty+        Just ps -> fmap (succ -*- fmap (edge :)) ps+ ------------------------------------------------------------------------ -- Transitive closure @@ -867,3 +1071,21 @@ --         NEW EDGES WILL BE ADDED! Use 'Maybe ()' instead. transitiveClosure :: (Ord n, Eq e, StarSemiRing e) => Graph n e -> Graph n e transitiveClosure = fst . gaussJordanFloydWarshallMcNaughtonYamada++-- | The transitive reduction of the graph: a graph with the same+-- reachability relation as the graph, but with as few edges as+-- possible.+--+-- Precondition: The graph must be acyclic. The number of nodes in the+-- graph must not be larger than @'maxBound' :: 'Int'@.+--+-- Worst-case time complexity: /O(e n log n)/ (this has not been+-- verified carefully).+--+-- The algorithm is based on one found on Wikipedia.++transitiveReduction :: Ord n => Graph n e -> Graph n ()+transitiveReduction g =+  fmap (const ()) $+  filterEdges ((== 1) . fst . label) $+  longestPaths g
src/full/Agda/Utils/Haskell/Syntax.hs view
@@ -26,8 +26,12 @@           | DataDecl DataOrNew Name [TyVarBind] [ConDecl] [Deriving]           | TypeSig [Name] Type           | FunBind [Match]+            -- ^ Should not be used when 'LocalBind' could be used.+          | LocalBind Strictness Name Rhs+            -- ^ Should only be used in @let@ or @where@.           | PatSyn Pat Pat           | FakeDecl String+          | Comment String   deriving (Eq)  data DataOrNew = DataType | NewType
src/full/Agda/Utils/List.hs view
@@ -9,6 +9,8 @@ import Data.Bifunctor import Data.Function import qualified Data.List as List+import qualified Data.List.NonEmpty as List1+import Data.List.NonEmpty (pattern (:|), (<|)) import Data.Maybe import qualified Data.Map as Map import qualified Data.Set as Set@@ -18,6 +20,10 @@ import Agda.Utils.Functor  ((<.>)) import Agda.Utils.Tuple +import {-# SOURCE #-} Agda.Utils.List1 (List1)++import Agda.Utils.Impossible+ --------------------------------------------------------------------------- -- * Variants of list case, cons, head, tail, init, last ---------------------------------------------------------------------------@@ -253,6 +259,32 @@   f x (b', (xs, ys)) = (b, if b then (xs, x:ys) else (x:xs, ys))     where b = b' && p x +-- | Breaks a list just /after/ an element satisfying the predicate is+--   found.+--+--   >>> breakAfter1 even 1 [3,5,2,4,7,8]+--   ([1,3,5,2],[4,7,8])++breakAfter1 :: (a -> Bool) -> a -> [a] -> (List1 a, [a])+breakAfter1 p = loop+  where+  loop x = \case+    xs@[]         -> (x :| [], xs)+    xs@(y : ys)+      | p x       -> (x :| [], xs)+      | otherwise -> let (vs, ws) = loop y ys in (x <| vs, ws)++-- | Breaks a list just /after/ an element satisfying the predicate is+--   found.+--+--   >>> breakAfter even [1,3,5,2,4,7,8]+--   ([1,3,5,2],[4,7,8])++breakAfter :: (a -> Bool) -> [a] -> ([a], [a])+breakAfter p = \case+  []   -> ([], [])+  x:xs -> first List1.toList $ breakAfter1 p x xs+ -- | A generalized version of @takeWhile@. --   (Cf. @mapMaybe@ vs. @filter@). --   @O(length . takeWhileJust f).@@ -388,6 +420,23 @@   | SSSStrip (ReversedSuffix a) -- ^ "Negative string" to remove from end. List may be empty.   | SSSResult [a]               -- ^ "Positive string" (result). Non-empty list. +-- ** Finding overlap++-- | Find out whether the first string @xs@+--   has a suffix that is a prefix of the second string @ys@.+--   So, basically, find the overlap where the strings can be glued together.+--   Returns the index where the overlap starts and the length of the overlap.+--   The length of the overlap plus the index is the length of the first string.+--   Note that in the worst case, the empty overlap @(length xs,0)@ is returned.+findOverlap :: forall a. Eq a => [a] -> [a] -> (Int, Int)+findOverlap xs ys =+  headWithDefault __IMPOSSIBLE__ $ mapMaybe maybePrefix $ zip [0..] (List.tails xs)+  where+  maybePrefix :: (Int, [a]) -> Maybe (Int, Int)+  maybePrefix (k, xs')+    | xs' `List.isPrefixOf` ys = Just (k, length xs')+    | otherwise                = Nothing+ --------------------------------------------------------------------------- -- * Groups and chunks ---------------------------------------------------------------------------@@ -439,15 +488,16 @@ --   O(n). -- --    > intercalate [x] (chopWhen (== x) xs) == xs-chopWhen :: (a -> Bool) -> [a] -> [[a]]-chopWhen p [] = []-chopWhen p xs = loop xs+chopWhen :: forall a. (a -> Bool) -> [a] -> [[a]]+chopWhen p []     = []+chopWhen p (x:xs) = loop (x :| xs)   where   -- Local function to avoid unnecessary pattern matching.-  loop xs = case break p xs of-    (w, [])     -> [w]-    (w, [_])    -> [w, []]-    (w, _ : ys) -> w : loop ys  -- here we already know that ys /= []+  loop :: List1 a -> [[a]]+  loop xs = case List1.break p xs of+    (w, []        ) -> [w]+    (w, _ : []    ) -> [w, []]+    (w, _ : y : ys) -> w : loop (y :| ys)  --------------------------------------------------------------------------- -- * List as sets@@ -568,18 +618,13 @@ -- | Efficient variant of 'nubBy' for finite lists. -- O(n log n). ----- Specification: For each list @xs@ there is a list @ys@ which is a--- permutation of @xs@ such that------ > uniqOn f xs == 'nubBy' ((==) `'on'` f) ys.------ Furthermore:+-- > uniqOn f == 'List.sortBy' (compare `'on'` f) . 'nubBy' ((==) `'on'` f) ----- > List.sortBy (compare `on` f) (uniqOn f xs) == uniqOn f xs--- > uniqOn id == Set.toAscList . Set.fromList+-- If there are several elements with the same @f@-representative,+-- the first of these is kept. -- uniqOn :: Ord b => (a -> b) -> [a] -> [a]-uniqOn key = Map.elems . Map.fromList . map (\ a -> (key a, a))+uniqOn key = Map.elems . Map.fromListWith (\ _ -> id) . map (\ a -> (key a, a))  -- | Checks if all the elements in the list are equal. Assumes that --   the 'Eq' instance stands for an equivalence relation.
src/full/Agda/Utils/List1.hs view
@@ -57,20 +57,22 @@ singleton = (:| []) #endif +#if !MIN_VERSION_base(4,16,0) -- | Append a list to a non-empty list. -append :: List1 a -> [a] -> List1 a-append (x :| xs) ys = x :| mappend xs ys+appendList :: List1 a -> [a] -> List1 a+appendList (x :| xs) ys = x :| mappend xs ys  -- | Prepend a list to a non-empty list. -prepend :: [a] -> List1 a -> List1 a-prepend as bs = foldr (<|) bs as+prependList :: [a] -> List1 a -> List1 a+prependList as bs = foldr (<|) bs as+#endif  -- | More precise type for @snoc@.  snoc :: [a] -> a -> List1 a-snoc as a = prepend as $ a :| []+snoc as a = prependList as $ a :| []  -- | More precise type for 'Agda.Utils.List.groupBy''. --@@ -87,6 +89,15 @@     = (x :| List.map snd xs) : case rest of       []                 -> []       ((_false, z) : zs) -> grp z zs++-- | Breaks a list just /after/ an element satisfying the predicate is+--   found.+--+--   >>> breakAfter even [1,3,5,2,4,7,8]+--   ([1,3,5,2],[4,7,8])++breakAfter :: (a -> Bool) -> List1 a -> (List1 a, [a])+breakAfter p (x :| xs) = List.breakAfter1 p x xs  -- | Concatenate one or more non-empty lists. 
+ src/full/Agda/Utils/List1.hs-boot view
@@ -0,0 +1,5 @@+module Agda.Utils.List1 where++import qualified Data.List.NonEmpty (NonEmpty)++type List1 = Data.List.NonEmpty.NonEmpty
src/full/Agda/Utils/Map.hs view
@@ -65,10 +65,11 @@ filterKeys :: (k -> Bool) -> Map k a -> Map k a filterKeys p = Map.filterWithKey (const . p) --- | O(n log n).  Rebuilds the map from scratch.---   Not worse than 'Map.mapKeys'.-mapMaybeKeys :: (Ord k1, Ord k2) => (k1 -> Maybe k2) -> Map k1 a -> Map k2 a-mapMaybeKeys f = Map.fromList . mapMaybe (\ (k,a) -> (,a) <$> f k) . Map.toList+-- UNUSED Andreas (2021-08-19)+-- -- | O(n log n).  Rebuilds the map from scratch.+-- --   Not worse than 'Map.mapKeys'.+-- mapMaybeKeys :: (Ord k1, Ord k2) => (k1 -> Maybe k2) -> Map k1 a -> Map k2 a+-- mapMaybeKeys f = Map.fromList . mapMaybe (\ (k,a) -> (,a) <$> f k) . Map.toList  -- UNUSED Liang-Ting Chen (05-07-2019) -- -- | Unzip a map.
src/full/Agda/Utils/Null.hs view
@@ -25,12 +25,14 @@ import qualified Data.List as List import Data.Map (Map) import qualified Data.Map as Map- import Data.Sequence (Seq) import qualified Data.Sequence as Seq import Data.Set (Set) import qualified Data.Set as Set +import Data.Text (Text)+import qualified Data.Text as Text+ import Text.PrettyPrint (Doc, isEmpty)  import Agda.Utils.Bag (Bag)@@ -65,6 +67,10 @@ instance Null ByteString where   empty = ByteString.empty   null  = ByteString.null++instance Null Text where+  empty = Text.empty+  null  = Text.null  instance Null [a] where   empty = []
src/full/Agda/Utils/Three.hs view
@@ -46,14 +46,6 @@  mapEither3M :: Applicative m => (a -> m (Either3 b c d)) -> [a] -> m ([b], [c], [d]) mapEither3M f xs = partitionEithers3 <$> traverse f xs--- mapEither3M f = \case---     []     -> return ([], [], [])---     (x:xs) -> liftA2 (flip prepend) (f x) (mapEither3M f xs)---   where---   prepend (as, bs, cs) = \case---     In1 b -> (b:bs, cs, ds)---     In2 c -> (bs, c:cs, ds)---     In3 d -> (bs, cs, d:ds)  forEither3M :: Applicative m => [a] -> (a -> m (Either3 b c d)) -> m ([b], [c], [d]) forEither3M = flip mapEither3M
src/full/Agda/Utils/Warshall.hs view
@@ -23,6 +23,8 @@ import Agda.Utils.List (nubOn) import Agda.Utils.Pretty as P +import Agda.Utils.Impossible+ type Matrix a = Array (Int,Int) a  -- assuming a square matrix@@ -52,7 +54,7 @@      m = array b [ ((n, m), edge i j) | (i, n) <- nodes, (j, m) <- nodes ] -    fromMatrix matrix = Map.fromList $ do+    fromMatrix matrix = Map.fromListWith __IMPOSSIBLE__ $ do       (i, n) <- nodes       let es = [ (fst (nodes !! m), e)                | m <- [0..len - 1]
stack-8.0.2.yaml view
@@ -3,6 +3,7 @@ compiler-check: match-exact  extra-deps:+- QuickCheck-2.14.2 - ansi-terminal-0.10.3 - ansi-wl-pprint-0.6.9 - async-2.2.1@@ -15,7 +16,14 @@ - regex-base-0.94.0.0 - regex-tdfa-1.3.1.0 - splitmix-0.1.0.3+- tasty-1.1.0.4+- tasty-silver-3.1.13+- tasty-quickcheck-0.10.1.1 - text-1.2.3.1 - uuid-types-1.0.3 - wcwidth-0.0.2 - text-icu-0.7.1.0++# Local packages, usually specified by relative directory name+packages:+- '.'
− stack-8.10.5.yaml
@@ -1,3 +0,0 @@-resolver: lts-18.0-compiler: ghc-8.10.5-compiler-check: match-exact
+ stack-8.10.7.yaml view
@@ -0,0 +1,7 @@+resolver: lts-18.10+compiler: ghc-8.10.7+compiler-check: match-exact++# Local packages, usually specified by relative directory name+packages:+- '.'
stack-8.2.2.yaml view
@@ -3,6 +3,7 @@ compiler-check: match-exact  extra-deps:+- QuickCheck-2.14.2 - async-2.2.1 - binary-0.8.3.0 - cpphs-1.20.9@@ -11,7 +12,13 @@ - regex-base-0.94.0.0 - regex-tdfa-1.3.1.0 - splitmix-0.1.0.3+- tasty-1.1.0.4+- tasty-silver-3.1.13 - text-1.2.3.1 - uuid-types-1.0.3 - wcwidth-0.0.2 - text-icu-0.7.1.0++# Local packages, usually specified by relative directory name+packages:+- '.'
stack-8.4.4.yaml view
@@ -3,10 +3,16 @@ compiler-check: match-exact  extra-deps:+- QuickCheck-2.14.2 - cpphs-1.20.9 - random-1.2.0 - regex-base-0.94.0.0 - regex-tdfa-1.3.1.0 - splitmix-0.1.0.3+- tasty-silver-3.1.13 - uuid-types-1.0.3 - text-icu-0.7.1.0++# Local packages, usually specified by relative directory name+packages:+- '.'
stack-8.6.5.yaml view
@@ -3,6 +3,7 @@ compiler-check: match-exact  extra-deps:+- QuickCheck-2.14.2 - STMonadTrans-0.4.3 - cpphs-1.20.9 - data-hash-0.2.0.1@@ -14,3 +15,7 @@ - splitmix-0.1.0.3 - uuid-types-1.0.3 - text-icu-0.7.1.0++# Local packages, usually specified by relative directory name+packages:+- '.'
stack-8.8.4.yaml view
@@ -3,6 +3,11 @@ compiler-check: match-exact  extra-deps:+- QuickCheck-2.14.2 - random-1.2.0 - splitmix-0.1.0.3 - text-icu-0.7.1.0++# Local packages, usually specified by relative directory name+packages:+  - '.'
stack-9.0.1.yaml view
@@ -1,93 +1,22 @@-resolver: ghc-9.0.1+resolver: nightly-2021-11-12 compiler: ghc-9.0.1 compiler-check: match-exact  extra-deps:-- aeson-1.5.6.0-- alex-3.2.6-- async-2.2.3-- bifunctors-5.5.11-- blaze-html-0.9.1.2-- boxes-0.1.5-- case-insensitive-1.2.1.0-- data-hash-0.2.0.1-- edit-distance-0.2.2.1-- equivalence-0.3.5-- gitrev-1.3.1+# Andreas, 2021-11-13+# happy-1.21.0 is deprecated, but currently in nightly+# (commercialhaskell/stackage#6294) - happy-1.20.0-- hashable-1.3.1.0-- hashtables-1.2.4.1-- monad-control-1.0.2.3-- murmur-hash-0.1.0.9-- parallel-3.2.2.0-- regex-tdfa-1.3.1.0-- split-0.2.3.4-- strict-0.4.0.1-- unordered-containers-0.2.13.0-- uri-encode-1.5.0.7-- zlib-0.6.2.3-- STMonadTrans-0.4.5-- assoc-1.0.2-# - attoparsec-0.14.1 # no matching version for this in resolver-- attoparsec-0.13.2.5-- base-compat-0.11.2-- base-compat-batteries-0.11.2-- base-orphans-0.8.4-- blaze-builder-0.4.2.1-- blaze-markup-0.8.2.8-- comonad-5.0.8-- data-fix-0.3.1-- dlist-1.0-- fail-4.9.0.0-- network-uri-2.6.4.1-- primitive-0.7.1.0-- random-1.2.0-- regex-base-0.94.0.1-- scientific-0.3.6.2-- tagged-0.8.6.1-- th-abstraction-0.4.2.0-- these-1.1.1.1-- time-compat-1.9.5-- transformers-base-0.4.5.2-- transformers-compat-0.6.6-- utf8-string-1.0.2-- uuid-types-1.0.4-- vector-0.12.3.0-- distributive-0.6.2.1-- indexed-traversable-0.1.1-- integer-logarithms-1.0.3.1-- splitmix-0.1.0.3-- th-compat-0.1.2-- filemanip-0.3.6.3-- process-extras-0.7.4-- temporary-1.3-- unix-compat-0.5.3-- ListLike-4.7.4-- ansi-terminal-0.11-- call-stack-0.3.0-- clock-0.8.2-- data-default-0.7.1.1-- generic-deriving-1.14-- optparse-applicative-0.16.1.0-- unbounded-delays-0.1.1.1-- wcwidth-0.0.2-- ansi-wl-pprint-0.6.9-- colour-2.3.5-- data-default-class-0.1.2.0-- data-default-instances-containers-0.0.1-- data-default-instances-dlist-0.0.1-- data-default-instances-old-locale-0.0.1-- fmlist-0.9.4-- old-locale-1.0.0.7-- text-icu-0.7.1.0 -# extra deps for cpphs flag-- cpphs-1.20.9.1-- polyparse-1.13--# extra deps for Windows-- mintty-0.1.2- flags:   transformers-compat:     five-three: true+  # Andreas, 2021-11-14+  # Work around problem in nightly-2021-11-12+  # (commercialhaskell/stackage#6304 and RyanGlScott/mintty#4):+  mintty:+    Win32-2-13-1: false++# Local packages, usually specified by relative directory name+packages:+- '.'
+ stack-9.2.1.yaml view
@@ -0,0 +1,136 @@+resolver: ghc-9.2.1+compiler: ghc-9.2.1+compiler-check: match-exact++extra-deps:+- Diff-0.4.0+- HUnit-1.6.2.0+- ListLike-4.7.6+- OneTuple-0.3.1+- QuickCheck-2.14.2+- StateVar-1.2.2+- STMonadTrans-0.4.6+- aeson-2.0.2.0+- alex-3.2.6+- ansi-terminal-0.11+- ansi-wl-pprint-0.6.9+- assoc-1.0.2+- async-2.2.4+- attoparsec-0.14.2+- base-compat-0.12.1+- base-compat-batteries-0.12.1+- base-orphans-0.8.6+- bifunctors-5.5.11+- blaze-builder-0.4.2.2+- blaze-html-0.9.1.2+- blaze-markup-0.8.2.8+- boxes-0.1.5+- call-stack-0.4.0+- case-insensitive-1.2.1.0+- clock-0.8.2+- cmdargs-0.10.21+- colour-2.3.6+- comonad-5.0.8+- contravariant-1.5.5+- cpphs-1.20.9.1+- data-default-0.7.1.1+- data-default-class-0.1.2.0+- data-default-instances-containers-0.0.1+- data-default-instances-dlist-0.0.1+- data-default-instances-old-locale-0.0.1+- data-fix-0.3.2+- data-hash-0.2.0.1+- distributive-0.6.2.1+- dlist-1.0+- edit-distance-0.2.2.1+- equivalence-0.3.5+- extensible-exceptions-0.1.1.4+- fail-4.9.0.0+- filemanip-0.3.6.3+- fmlist-0.9.4+- generic-deriving-1.14.1+- gitrev-1.3.1+- happy-1.20.0+- hashable-1.3.5.0+- hashtables-1.2.4.2+- haskell-lexer-1.1+- hostname-1.0+- indexed-traversable-0.1.2+- indexed-traversable-instances-0.1.1+- integer-logarithms-1.0.3.1+- mintty-0.1.2+- monad-control-1.0.3.1+- murmur-hash-0.1.0.10+- network-uri-2.6.4.1+- old-locale-1.0.0.7+- optparse-applicative-0.16.1.0+- parallel-3.2.2.0+- polyparse-1.13+- pretty-show-1.10+- primitive-0.7.3.0+- process-extras-0.7.4+- random-1.2.1+- regex-base-0.94.0.1+- regex-posix-0.96.0.0+- regex-tdfa-1.3.1.1+- safe-0.3.19+- scientific-0.3.7.0+- semialign-1.2.0.1+- semigroupoids-5.3.6+- silently-1.2.5.2+- split-0.2.3.4+- splitmix-0.1.0.4+- strict-0.4.0.1+- tagged-0.8.6.1+- tasty-1.4.2+- tasty-hunit-0.10.0.3+- tasty-quickcheck-0.10.1.2+- tasty-silver-3.3.1+- temporary-1.3+- test-framework-0.8.2.0+- test-framework-hunit-0.3.0.2+- text-icu-0.7.1.0+- text-short-0.1.4+- th-abstraction-0.4.3.0+- th-compat-0.1.3+- these-1.1.1.1+- time-compat-1.9.6.1+- transformers-base-0.4.6+- transformers-compat-0.7.1+- unbounded-delays-0.1.1.1+- unix-compat-0.5.3+- unordered-containers-0.2.15.0+- uri-encode-1.5.0.7+- utf8-string-1.0.2+- uuid-types-1.0.5+- vector-0.12.3.1+- wcwidth-0.0.2+- witherable-0.4.2+- xml-1.3.14+- zlib-0.6.2.3++# Andreas, 2021-11-13:+# Windows needs this instead of time-1.11.*, via unix-compat+- time-1.9.3++# Andreas, 2021-11-13: unix-compat (0.5.3) needs Win32 < 2.12+# See https://github.com/jacobstanley/unix-compat/issues/48+# Andreas, 2021-11-14: haskeline (0.8.2) needs Win32 < 2.10 || >= 2.12+- Win32-2.9.0.0++# Fixup:+- Cabal-3.6.2.0+# "this GHC boot package has been pruned (issue #4510);"+- directory-1.3.7.0+- haskeline-0.8.2+- process-1.6.13.2+- unix-2.7.2.2+++flags:+  transformers-compat:+    five-three: true++# Local packages, usually specified by relative directory name+packages:+- '.'