    {-# LANGUAGE NondecreasingIndentation #-}

    {-# OPTIONS_GHC -fno-warn-orphans #-}

    module Agda.TypeChecking.Errors
      ( renderError
      , prettyError
      , tcErrString
      , prettyTCWarnings'
      , prettyTCWarnings
      , tcWarningsToError
      , applyFlagsToTCWarningsPreserving
      , applyFlagsToTCWarnings
      , getAllUnsolvedWarnings
      , getAllWarningsPreserving
      , getAllWarnings
      , getAllWarningsOfTCErr
      , dropTopLevelModule
      , topLevelModuleDropper
      , explainWhyInScope
      , Verbalize(verbalize)
      ) where

    import Prelude hiding ( null, foldl )

    import qualified Control.Exception as E
    import Control.Monad ((>=>), (<=<))
    import Control.Monad.Except

    import qualified Data.CaseInsensitive as CaseInsens
    import Data.Foldable (foldl)
    import Data.Function (on)
    import Data.IntSet (IntSet)
    import qualified Data.IntSet as IntSet
    import Data.List (sortBy, dropWhileEnd, intercalate)
    import qualified Data.List as List
    import Data.Maybe
    import qualified Data.Map as Map
    import Data.Set (Set)
    import qualified Data.Set as Set
    import qualified Data.Text as Text
    import System.FilePath
    import qualified Text.PrettyPrint.Boxes as Boxes

    import Agda.Interaction.Options
    import Agda.Interaction.Options.Errors

    import Agda.Syntax.Common
    import Agda.Syntax.Common.Pretty ( prettyShow, render )
    import qualified Agda.Syntax.Common.Pretty as P
    import Agda.Syntax.Concrete.Definitions (notSoNiceDeclarations)
    import Agda.Syntax.Concrete.Definitions.Errors (declarationExceptionString)
    import Agda.Syntax.Concrete.Pretty (attributesForModality)
    import Agda.Syntax.Notation
    import Agda.Syntax.Position
    import qualified Agda.Syntax.Concrete as C
    import Agda.Syntax.Abstract as A
    import Agda.Syntax.Internal as I
    import Agda.Syntax.Translation.InternalToAbstract
    import Agda.Syntax.Scope.Monad (isDatatypeModule)
    import Agda.Syntax.Scope.Base

    import Agda.TypeChecking.Errors.Names (typeErrorString)
    import Agda.TypeChecking.Monad
    import Agda.TypeChecking.Pretty
    import Agda.TypeChecking.Pretty.Call
    import Agda.TypeChecking.Pretty.Warning
    import Agda.TypeChecking.SizedTypes.Pretty ()
    import Agda.TypeChecking.Substitute
    import Agda.TypeChecking.Reduce (instantiate)

    import Agda.Interaction.Library.Base (formatLibErrors, libFile)

    import Agda.Utils.FileName
    import Agda.Utils.Float  ( toStringWithoutDotZero )
    import Agda.Utils.Function
    import Agda.Utils.Functor( for )
    import Agda.Utils.IO     ( showIOException )
    import Agda.Utils.Lens
    import Agda.Utils.List   ( initLast, lastMaybe )
    import Agda.Utils.List1  ( List1, pattern (:|) )
    import Agda.Utils.List2  ( pattern List2 )
    import qualified Agda.Utils.List1 as List1
    import qualified Agda.Utils.List2 as List2
    import Agda.Utils.Maybe
    import Agda.Utils.Monad
    import Agda.Utils.Null
    import qualified Agda.Utils.Set1 as Set1
    import Agda.Utils.Singleton
    import Agda.Utils.Size

    import Agda.Utils.Impossible

    ---------------------------------------------------------------------------
    -- * Top level function
    ---------------------------------------------------------------------------

    {-# SPECIALIZE renderError :: TCErr -> TCM String #-}
    renderError :: MonadTCM tcm => TCErr -> tcm String
    renderError :: forall (tcm :: * -> *). MonadTCM tcm => TCErr -> tcm String
    renderError = (Doc -> String) -> tcm Doc -> tcm String
    forall a b. (a -> b) -> tcm a -> tcm b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Doc -> String
    forall a. Show a => a -> String
    show (tcm Doc -> tcm String)
    -> (TCErr -> tcm Doc) -> TCErr -> tcm String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . TCErr -> tcm Doc
    forall (tcm :: * -> *). MonadTCM tcm => TCErr -> tcm Doc
    prettyError

    {-# SPECIALIZE prettyError :: TCErr -> TCM Doc #-}
    prettyError :: MonadTCM tcm => TCErr -> tcm Doc
    prettyError :: forall (tcm :: * -> *). MonadTCM tcm => TCErr -> tcm Doc
    prettyError = TCMT IO Doc -> tcm Doc
    forall a. TCM a -> tcm a
    forall (tcm :: * -> *) a. MonadTCM tcm => TCM a -> tcm a
    liftTCM (TCMT IO Doc -> tcm Doc)
    -> (TCErr -> TCMT IO Doc) -> TCErr -> tcm Doc
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (TCErr -> [TCErr] -> TCMT IO Doc)
    -> [TCErr] -> TCErr -> TCMT IO Doc
    forall a b c. (a -> b -> c) -> b -> a -> c
    flip TCErr -> [TCErr] -> TCMT IO Doc
    renderError' [] where
      renderError' :: TCErr -> [TCErr] -> TCM Doc
      renderError' :: TCErr -> [TCErr] -> TCMT IO Doc
    renderError' TCErr
    err [TCErr]
    errs
        | [TCErr] -> Int
    forall a. [a] -> Int
    forall (t :: * -> *) a. Foldable t => t a -> Int
    length [TCErr]
    errs Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    > Int
    3 = [TCMT IO Doc] -> TCMT IO Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep (
            String -> [TCMT IO Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "total panic: error when printing error from printing error from printing error." [TCMT IO Doc] -> [TCMT IO Doc] -> [TCMT IO Doc]
    forall a. [a] -> [a] -> [a]
    ++
            String -> [TCMT IO Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "I give up! Approximations of errors (original error last):" )
            TCMT IO Doc -> TCMT IO Doc -> TCMT IO Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    $$ [TCMT IO Doc] -> TCMT IO Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat ((TCErr -> TCMT IO Doc) -> [TCErr] -> [TCMT IO Doc]
    forall a b. (a -> b) -> [a] -> [b]
    map (String -> TCMT IO Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (String -> TCMT IO Doc)
    -> (TCErr -> String) -> TCErr -> TCMT IO Doc
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . TCErr -> String
    tcErrString) [TCErr]
    errs)
        | Bool
    otherwise = Bool -> (TCMT IO Doc -> TCMT IO Doc) -> TCMT IO Doc -> TCMT IO Doc
    forall b a. IsBool b => b -> (a -> a) -> a -> a
    applyUnless ([TCErr] -> Bool
    forall a. Null a => a -> Bool
    null [TCErr]
    errs) (TCMT IO Doc
    "panic: error when printing error!" TCMT IO Doc -> TCMT IO Doc -> TCMT IO Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    $$) (TCMT IO Doc -> TCMT IO Doc) -> TCMT IO Doc -> TCMT IO Doc
    forall a b. (a -> b) -> a -> b
    $ do
            (TCErr -> TCMT IO Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => TCErr -> m Doc
    prettyTCM TCErr
    err TCMT IO Doc -> TCMT IO Doc -> TCMT IO Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    $$ [TCMT IO Doc] -> TCMT IO Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat ((TCErr -> TCMT IO Doc) -> [TCErr] -> [TCMT IO Doc]
    forall a b. (a -> b) -> [a] -> [b]
    map (String -> TCMT IO Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (String -> TCMT IO Doc)
    -> (TCErr -> String) -> TCErr -> TCMT IO Doc
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (String
    "when printing error " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++) (String -> String) -> (TCErr -> String) -> TCErr -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . TCErr -> String
    tcErrString) [TCErr]
    errs))
            TCMT IO Doc -> (TCErr -> TCMT IO Doc) -> TCMT IO Doc
    forall a. TCMT IO a -> (TCErr -> TCMT IO a) -> TCMT IO a
    forall e (m :: * -> *) a.
    MonadError e m =>
    m a -> (e -> m a) -> m a
    `catchError` \ TCErr
    err' -> TCErr -> [TCErr] -> TCMT IO Doc
    renderError' TCErr
    err' (TCErr
    errTCErr -> [TCErr] -> [TCErr]
    forall a. a -> [a] -> [a]
    :[TCErr]
    errs)

    ---------------------------------------------------------------------------
    -- * Helpers
    ---------------------------------------------------------------------------

    panic :: Monad m => String -> m Doc
    panic :: forall (m :: * -> *). Monad m => String -> m Doc
    panic String
    s = String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String
    "Panic: " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    s

    nameWithBinding :: MonadPretty m => QName -> m Doc
    nameWithBinding :: forall (m :: * -> *). MonadPretty m => QName -> m Doc
    nameWithBinding QName
    q =
      (QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    q m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> m Doc
    "bound at") m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <?> Range -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Range -> m Doc
    prettyTCM Range
    r
      where
        r :: Range
    r = Name -> Range
    nameBindingSite (Name -> Range) -> Name -> Range
    forall a b. (a -> b) -> a -> b
    $ QName -> Name
    qnameName QName
    q

    tcErrString :: TCErr -> String
    tcErrString :: TCErr -> String
    tcErrString TCErr
    err =
      [String] -> String
    unwords ([String] -> String)
    -> ([String] -> [String]) -> [String] -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (String -> Bool) -> [String] -> [String]
    forall a. (a -> Bool) -> [a] -> [a]
    filter (Bool -> Bool
    not (Bool -> Bool) -> (String -> Bool) -> String -> Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> Bool
    forall a. Null a => a -> Bool
    null) ([String] -> [String])
    -> ([String] -> [String]) -> [String] -> [String]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Range -> String
    forall a. Pretty a => a -> String
    prettyShow (TCErr -> Range
    forall a. HasRange a => a -> Range
    getRange TCErr
    err) String -> [String] -> [String]
    forall a. a -> [a] -> [a]
    :) ([String] -> String) -> [String] -> String
    forall a b. (a -> b) -> a -> b
    $
        case TCErr
    err of
          TypeError CallStack
    _ TCState
    _ Closure TypeError
    cl     -> [ TypeError -> String
    typeErrorString (TypeError -> String) -> TypeError -> String
    forall a b. (a -> b) -> a -> b
    $ Closure TypeError -> TypeError
    forall a. Closure a -> a
    clValue Closure TypeError
    cl ]
          ParserError ParseError
    e        -> [ String
    "ParserError" ]
          GenericException String
    msg -> [ String
    msg ]
          IOException Maybe TCState
    _ Range
    r IOException
    e    -> [ Range -> String
    forall a. Pretty a => a -> String
    prettyShow Range
    r, IOException -> String
    forall e. Exception e => e -> String
    showIOException IOException
    e ]
          PatternErr{}         -> [ String
    "PatternErr" ]

    instance PrettyTCM TCErr where
      prettyTCM :: forall (m :: * -> *). MonadPretty m => TCErr -> m Doc
    prettyTCM TCErr
    err = case TCErr
    err of
        -- Gallais, 2016-05-14
        -- Given where `NonFatalErrors` are created, we know for a
        -- fact that  ̀ws` is non-empty.
        TypeError CallStack
    loc TCState
    _ Closure{ clValue :: forall a. Closure a -> a
    clValue = NonFatalErrors Set1 TCWarning
    ws } -> do
          String -> Int -> String -> m ()
    forall (m :: * -> *).
    MonadDebug m =>
    String -> Int -> String -> m ()
    reportSLn String
    "error" Int
    2 (String -> m ()) -> String -> m ()
    forall a b. (a -> b) -> a -> b
    $ String
    "Error raised at " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ CallStack -> String
    forall a. Pretty a => a -> String
    prettyShow CallStack
    loc
          NonEmpty (m Doc) -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vsep (NonEmpty (m Doc) -> m Doc) -> NonEmpty (m Doc) -> m Doc
    forall a b. (a -> b) -> a -> b
    $ (TCWarning -> m Doc) -> NonEmpty TCWarning -> NonEmpty (m Doc)
    forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap TCWarning -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => TCWarning -> m Doc
    prettyTCM (NonEmpty TCWarning -> NonEmpty (m Doc))
    -> NonEmpty TCWarning -> NonEmpty (m Doc)
    forall a b. (a -> b) -> a -> b
    $ Set1 TCWarning -> NonEmpty TCWarning
    forall a. NESet a -> NonEmpty a
    Set1.toAscList Set1 TCWarning
    ws
        -- Andreas, 2014-03-23
        -- This use of withTCState seems ok since we do not collect
        -- Benchmark info during printing errors.
        TypeError CallStack
    loc TCState
    s Closure TypeError
    e -> (TCState -> TCState) -> m Doc -> m Doc
    forall a. (TCState -> TCState) -> m a -> m a
    forall (m :: * -> *) a.
    ReadTCState m =>
    (TCState -> TCState) -> m a -> m a
    withTCState (TCState -> TCState -> TCState
    forall a b. a -> b -> a
    const TCState
    s) (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ do
          String -> Int -> String -> m ()
    forall (m :: * -> *).
    MonadDebug m =>
    String -> Int -> String -> m ()
    reportSLn String
    "error" Int
    2 (String -> m ()) -> String -> m ()
    forall a b. (a -> b) -> a -> b
    $ String
    "Error raised at " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ CallStack -> String
    forall a. Pretty a => a -> String
    prettyShow CallStack
    loc
          let r :: Range
    r = TCEnv -> Range
    envRange (TCEnv -> Range) -> TCEnv -> Range
    forall a b. (a -> b) -> a -> b
    $ Closure TypeError -> TCEnv
    forall a. Closure a -> TCEnv
    clEnv Closure TypeError
    e
          [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat
            [ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    hsep
              [ if Range -> Bool
    forall a. Null a => a -> Bool
    null Range
    r then m Doc
    forall a. Null a => a
    empty else Range -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Range -> m Doc
    prettyTCM Range
    r m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    ":"
              , m Doc
    "error:"
              , m Doc -> m Doc
    forall (m :: * -> *). Functor m => m Doc -> m Doc
    brackets (String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ TypeError -> String
    typeErrorString (TypeError -> String) -> TypeError -> String
    forall a b. (a -> b) -> a -> b
    $ Closure TypeError -> TypeError
    forall a. Closure a -> a
    clValue Closure TypeError
    e)
              ]
            , Closure TypeError -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Closure TypeError -> m Doc
    prettyTCM Closure TypeError
    e
            , Maybe (Closure Call) -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *).
    MonadPretty m =>
    Maybe (Closure Call) -> m Doc
    prettyTCM (TCEnv -> Maybe (Closure Call)
    envCall (TCEnv -> Maybe (Closure Call)) -> TCEnv -> Maybe (Closure Call)
    forall a b. (a -> b) -> a -> b
    $ Closure TypeError -> TCEnv
    forall a. Closure a -> TCEnv
    clEnv Closure TypeError
    e)
            ]
        ParserError ParseError
    err   -> ParseError -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty ParseError
    err
        GenericException String
    msg -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    msg
        IOException Maybe TCState
    _ Range
    r IOException
    e -> Range -> m Doc -> m Doc
    forall (m :: * -> *) a.
    (MonadPretty m, HasRange a) =>
    a -> m Doc -> m Doc
    sayWhere Range
    r (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ IOException -> String
    forall e. Exception e => e -> String
    showIOException IOException
    e
        PatternErr{}      -> TCErr -> m Doc -> m Doc
    forall (m :: * -> *) a.
    (MonadPretty m, HasRange a) =>
    a -> m Doc -> m Doc
    sayWhere TCErr
    err (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> m Doc
    forall (m :: * -> *). Monad m => String -> m Doc
    panic String
    "uncaught pattern violation"

    -- | Drops given amount of leading components of the qualified name.
    dropTopLevelModule' :: Int -> QName -> QName
    dropTopLevelModule' :: Int -> QName -> QName
    dropTopLevelModule' Int
    k (QName (MName [Name]
    ns) Name
    n) = ModuleName -> Name -> QName
    QName ([Name] -> ModuleName
    MName (Int -> [Name] -> [Name]
    forall a. Int -> [a] -> [a]
    drop Int
    k [Name]
    ns)) Name
    n

    -- | Drops the filename component of the qualified name.
    dropTopLevelModule :: MonadPretty m => QName -> m QName
    dropTopLevelModule :: forall (m :: * -> *). MonadPretty m => QName -> m QName
    dropTopLevelModule QName
    q = ((QName -> QName) -> QName -> QName
    forall a b. (a -> b) -> a -> b
    $ QName
    q) ((QName -> QName) -> QName) -> m (QName -> QName) -> m QName
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> m (QName -> QName)
    forall (m :: * -> *).
    (MonadDebug m, MonadTCEnv m, ReadTCState m) =>
    m (QName -> QName)
    topLevelModuleDropper

    -- | Produces a function which drops the filename component of the qualified name.
    topLevelModuleDropper :: (MonadDebug m, MonadTCEnv m, ReadTCState m) => m (QName -> QName)
    topLevelModuleDropper :: forall (m :: * -> *).
    (MonadDebug m, MonadTCEnv m, ReadTCState m) =>
    m (QName -> QName)
    topLevelModuleDropper =
      m (Maybe TopLevelModuleName)
    -> m (QName -> QName)
    -> (TopLevelModuleName -> m (QName -> QName))
    -> m (QName -> QName)
    forall (m :: * -> *) a b.
    Monad m =>
    m (Maybe a) -> m b -> (a -> m b) -> m b
    caseMaybeM m (Maybe TopLevelModuleName)
    forall (m :: * -> *).
    (MonadTCEnv m, ReadTCState m) =>
    m (Maybe TopLevelModuleName)
    currentTopLevelModule
        ((QName -> QName) -> m (QName -> QName)
    forall a. a -> m a
    forall (m :: * -> *) a. Monad m => a -> m a
    return QName -> QName
    forall a. a -> a
    id)
        ((QName -> QName) -> m (QName -> QName)
    forall a. a -> m a
    forall (m :: * -> *) a. Monad m => a -> m a
    return ((QName -> QName) -> m (QName -> QName))
    -> (TopLevelModuleName -> QName -> QName)
    -> TopLevelModuleName
    -> m (QName -> QName)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> QName -> QName
    dropTopLevelModule' (Int -> QName -> QName)
    -> (TopLevelModuleName -> Int)
    -> TopLevelModuleName
    -> QName
    -> QName
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . TopLevelModuleName -> Int
    forall a. Sized a => a -> Int
    size)

    prettyDisamb :: MonadPretty m => (QName -> Maybe (Range' SrcFile)) -> QName -> m Doc
    prettyDisamb :: forall (m :: * -> *).
    MonadPretty m =>
    (QName -> Maybe Range) -> QName -> m Doc
    prettyDisamb QName -> Maybe Range
    f QName
    x = do
      let d :: m Doc
    d  = QName -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty (QName -> m Doc) -> m QName -> m Doc
    forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
    =<< QName -> m QName
    forall (m :: * -> *). MonadPretty m => QName -> m QName
    dropTopLevelModule QName
    x
      Maybe Range -> m Doc -> (Range -> m Doc) -> m Doc
    forall a b. Maybe a -> b -> (a -> b) -> b
    caseMaybe (QName -> Maybe Range
    f QName
    x) m Doc
    d ((Range -> m Doc) -> m Doc) -> (Range -> m Doc) -> m Doc
    forall a b. (a -> b) -> a -> b
    $ \ Range
    r -> m Doc
    d m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> (m Doc
    "(introduced at " m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> Range -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Range -> m Doc
    prettyTCM Range
    r m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    ")")

    -- | Print the last range in 'qnameModule'.
    prettyDisambProj :: MonadPretty m => QName -> m Doc
    prettyDisambProj :: forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyDisambProj = (QName -> Maybe Range) -> QName -> m Doc
    forall (m :: * -> *).
    MonadPretty m =>
    (QName -> Maybe Range) -> QName -> m Doc
    prettyDisamb ((QName -> Maybe Range) -> QName -> m Doc)
    -> (QName -> Maybe Range) -> QName -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [Range] -> Maybe Range
    forall a. [a] -> Maybe a
    lastMaybe ([Range] -> Maybe Range)
    -> (QName -> [Range]) -> QName -> Maybe Range
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Range -> Bool) -> [Range] -> [Range]
    forall a. (a -> Bool) -> [a] -> [a]
    filter (Range
    forall a. Range' a
    noRange Range -> Range -> Bool
    forall a. Eq a => a -> a -> Bool
    /=) ([Range] -> [Range]) -> (QName -> [Range]) -> QName -> [Range]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Name -> Range) -> [Name] -> [Range]
    forall a b. (a -> b) -> [a] -> [b]
    map Name -> Range
    nameBindingSite ([Name] -> [Range]) -> (QName -> [Name]) -> QName -> [Range]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ModuleName -> [Name]
    mnameToList (ModuleName -> [Name]) -> (QName -> ModuleName) -> QName -> [Name]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . QName -> ModuleName
    qnameModule

    --   Print the range in 'qnameName'. This fixes the bad error message in #4130.
    prettyDisambCons :: MonadPretty m => QName -> m Doc
    prettyDisambCons :: forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyDisambCons = (QName -> Maybe Range) -> QName -> m Doc
    forall (m :: * -> *).
    MonadPretty m =>
    (QName -> Maybe Range) -> QName -> m Doc
    prettyDisamb ((QName -> Maybe Range) -> QName -> m Doc)
    -> (QName -> Maybe Range) -> QName -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Range -> Maybe Range
    forall a. a -> Maybe a
    Just (Range -> Maybe Range) -> (QName -> Range) -> QName -> Maybe Range
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Name -> Range
    nameBindingSite (Name -> Range) -> (QName -> Name) -> QName -> Range
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . QName -> Name
    qnameName

    instance PrettyTCM TypeError where
      prettyTCM :: forall m. MonadPretty m => TypeError -> m Doc
      prettyTCM :: forall (m :: * -> *). MonadPretty m => TypeError -> m Doc
    prettyTCM TypeError
    err = case TypeError
    err of
        InternalError String
    s -> String -> m Doc
    forall (m :: * -> *). Monad m => String -> m Doc
    panic String
    s

        NotImplemented String
    s -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String
    "Not implemented: " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    s

        NotSupported String
    s -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String
    "Not supported: " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    s

        CompilationError String
    s -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    sep [String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "Compilation error:", String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text String
    s]

        GenericError String
    s -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    s

        GenericDocError Doc
    d -> Doc -> m Doc
    forall a. a -> m a
    forall (m :: * -> *) a. Monad m => a -> m a
    return Doc
    d

        ExecError ExecError
    err -> ExecError -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => ExecError -> m Doc
    prettyTCM ExecError
    err

        NicifierError DeclarationException'
    err -> DeclarationException' -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty DeclarationException'
    err

        OptionError String
    s -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    s

        SyntaxError String
    s -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String
    "Syntax error: "  String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    s

        DoNotationError String
    err -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    err

        IdiomBracketError String
    err -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    err

        TypeError
    InvalidDottedExpression -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "Invalid dotted expression"

        NoKnownRecordWithSuchFields [Name]
    fields -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          case [Name]
    fields of
            []  -> String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "There are no records in scope"
            [Name
    f] -> String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "There is no known record with the field" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [ Name -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty Name
    f ]
            [Name]
    _   -> String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "There is no known record with the fields" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ (Name -> m Doc) -> [Name] -> [m Doc]
    forall a b. (a -> b) -> [a] -> [b]
    map Name -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty [Name]
    fields

        ShouldEndInApplicationOfTheDatatype Type
    t -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "The target of a constructor must be the datatype applied to its parameters,"
          [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    t] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "isn't"

        ShouldBeRecordType Type
    t -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Expected non-abstract record type, found " [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    t]

        ShouldBeRecordPattern DeBruijnPattern
    p -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Expected record pattern" -- ", found " ++ [prettyTCM p]

        TypeError
    WrongHidingInLHS -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "Unexpected implicit argument"

        WrongHidingInLambda Type
    t ->
          String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "Found an implicit lambda where an explicit lambda was expected"

        WrongHidingInProjection QName
    d ->
          [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    sep [ m Doc
    "Wrong hiding used for projection " , QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    d ]

        IllegalHidingInPostfixProjection NamedArg Expr
    arg -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Illegal hiding in postfix projection " [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          [NamedArg Expr -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty NamedArg Expr
    arg]

        TypeError
    WrongAnnotationInLambda ->
          String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "Wrong annotation in lambda"

        TypeError
    WrongIrrelevanceInLambda ->
          String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "Found a non-strict lambda where a irrelevant lambda was expected"

        TypeError
    WrongQuantityInLambda ->
          String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "Incorrect quantity annotation in lambda"

        TypeError
    WrongCohesionInLambda ->
          String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "Incorrect cohesion annotation in lambda"

        TypeError
    WrongPolarityInLambda ->
          String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "Incorrect polarity annotation in lambda"

        WrongNamedArgument NamedArg Expr
    a List1 NamedName
    xs0 -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Function does not accept argument "
          [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [NamedArg Expr -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => NamedArg Expr -> m Doc
    prettyTCM NamedArg Expr
    a] -- ++ pwords " (wrong argument name)"
          [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [m Doc -> m Doc
    forall (m :: * -> *). Functor m => m Doc -> m Doc
    parens (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text String
    "possible arguments:" m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : (NamedName -> m Doc) -> [NamedName] -> [m Doc]
    forall a b. (a -> b) -> [a] -> [b]
    map NamedName -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty [NamedName]
    xs | Bool -> Bool
    not ([NamedName] -> Bool
    forall a. Null a => a -> Bool
    null [NamedName]
    xs)]
          where
          xs :: [NamedName]
    xs = (NamedName -> Bool) -> List1 NamedName -> [NamedName]
    forall a. (a -> Bool) -> NonEmpty a -> [a]
    List1.filter (Bool -> Bool
    not (Bool -> Bool) -> (NamedName -> Bool) -> NamedName -> Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . NamedName -> Bool
    forall a. IsNoName a => a -> Bool
    isNoName) List1 NamedName
    xs0

        WrongHidingInApplication Type
    t ->
          String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "Found an implicit application where an explicit application was expected"

        HidingMismatch Hiding
    h Hiding
    h' -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String
    "Expected " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ Indefinite Hiding -> String
    forall a. Verbalize a => a -> String
    verbalize (Hiding -> Indefinite Hiding
    forall a. a -> Indefinite a
    Indefinite Hiding
    h') String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    " argument, but found " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++
          Indefinite Hiding -> String
    forall a. Verbalize a => a -> String
    verbalize (Hiding -> Indefinite Hiding
    forall a. a -> Indefinite a
    Indefinite Hiding
    h) String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    " argument"

        RelevanceMismatch Relevance
    r Relevance
    r' -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String
    "Expected " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ Indefinite Relevance -> String
    forall a. Verbalize a => a -> String
    verbalize (Relevance -> Indefinite Relevance
    forall a. a -> Indefinite a
    Indefinite Relevance
    r') String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    " argument, but found " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++
          Indefinite Relevance -> String
    forall a. Verbalize a => a -> String
    verbalize (Relevance -> Indefinite Relevance
    forall a. a -> Indefinite a
    Indefinite Relevance
    r) String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    " argument"

        QuantityMismatch Quantity
    q Quantity
    q' -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String
    "Expected " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ Indefinite Quantity -> String
    forall a. Verbalize a => a -> String
    verbalize (Quantity -> Indefinite Quantity
    forall a. a -> Indefinite a
    Indefinite Quantity
    q') String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    " argument, but found " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++
          Indefinite Quantity -> String
    forall a. Verbalize a => a -> String
    verbalize (Quantity -> Indefinite Quantity
    forall a. a -> Indefinite a
    Indefinite Quantity
    q) String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    " argument"

        ForcedConstructorNotInstantiated Pattern
    p -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Failed to infer that constructor pattern "
          [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Pattern -> m Doc
    forall a (m :: * -> *).
    (ToConcrete a, Pretty (ConOfAbs a), MonadAbsToCon m) =>
    a -> m Doc
    prettyA Pattern
    p] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    " is forced"

        IllformedProjectionPatternAbstract Pattern
    p -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Ill-formed projection pattern " [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Pattern -> m Doc
    forall a (m :: * -> *).
    (ToConcrete a, Pretty (ConOfAbs a), MonadAbsToCon m) =>
    a -> m Doc
    prettyA Pattern
    p]

        IllformedProjectionPatternConcrete Pattern
    p -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Ill-formed projection pattern" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Pattern -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty Pattern
    p]

        TypeError
    LiteralTooBig -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
          [ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Matching on natural number literals is done by expanding"
          , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "the literal to the corresponding constructor pattern,"
          , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "so you probably don't want to do it this way"
          ]

        TypeError
    NegativeLiteralInPattern -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Negative literals are not supported in patterns"

        CannotEliminateWithPattern Maybe Blocker
    b NamedArg Pattern
    p Type
    a -> do
          let isProj :: Bool
    isProj = Maybe (ProjOrigin, AmbiguousQName) -> Bool
    forall a. Maybe a -> Bool
    isJust (NamedArg Pattern -> Maybe (ProjOrigin, AmbiguousQName)
    forall a. IsProjP a => a -> Maybe (ProjOrigin, AmbiguousQName)
    isProjP NamedArg Pattern
    p)
          [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
            String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Cannot eliminate type" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    a m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : if
             | Bool
    isProj -> String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "with projection pattern" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [NamedArg Pattern -> m Doc
    forall a (m :: * -> *).
    (ToConcrete a, Pretty (ConOfAbs a), MonadAbsToCon m) =>
    a -> m Doc
    prettyA NamedArg Pattern
    p]
             | A.ProjP PatInfo
    _ ProjOrigin
    _ AmbiguousQName
    f <- NamedArg Pattern -> Pattern
    forall a. NamedArg a -> a
    namedArg NamedArg Pattern
    p -> String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "with pattern" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [NamedArg Pattern -> m Doc
    forall a (m :: * -> *).
    (ToConcrete a, Pretty (ConOfAbs a), MonadAbsToCon m) =>
    a -> m Doc
    prettyA NamedArg Pattern
    p] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
                 String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "(suggestion: write" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [m Doc
    ".(" m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> Expr -> m Doc
    forall a (m :: * -> *).
    (ToConcrete a, Pretty (ConOfAbs a), MonadAbsToCon m) =>
    a -> m Doc
    prettyA (ProjOrigin -> AmbiguousQName -> Expr
    A.Proj ProjOrigin
    ProjPrefix AmbiguousQName
    f) m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    ")"] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "for a dot pattern," [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
                 String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "or remove the braces for a postfix projection)"
             | Bool
    otherwise ->
                 m Doc
    "with" m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (Pattern -> String
    forall {e}. Pattern' e -> String
    kindOfPattern (NamedArg Pattern -> Pattern
    forall a. NamedArg a -> a
    namedArg NamedArg Pattern
    p)) m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : m Doc
    "pattern" m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : NamedArg Pattern -> m Doc
    forall a (m :: * -> *).
    (ToConcrete a, Pretty (ConOfAbs a), MonadAbsToCon m) =>
    a -> m Doc
    prettyA NamedArg Pattern
    p m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    :
                 String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "(did you supply too many arguments?)"
          where
          kindOfPattern :: Pattern' e -> String
    kindOfPattern = \case
            A.VarP{}    -> String
    "variable"
            A.ConP{}    -> String
    "constructor"
            A.ProjP{}   -> String
    forall a. HasCallStack => a
    __IMPOSSIBLE__
            A.DefP{}    -> String
    forall a. HasCallStack => a
    __IMPOSSIBLE__
            A.WildP{}   -> String
    "wildcard"
            A.DotP{}    -> String
    "dot"
            A.AbsurdP{} -> String
    "absurd"
            A.LitP{}    -> String
    "literal"
            A.RecP{}    -> String
    "record"
            A.WithP{}   -> String
    "with"
            A.EqualP{}  -> String
    "equality"
            A.AsP PatInfo
    _ BindName
    _ Pattern' e
    p -> Pattern' e -> String
    kindOfPattern Pattern' e
    p
            A.PatternSynP{} -> String
    forall a. HasCallStack => a
    __IMPOSSIBLE__

        CannotEliminateWithProjection Arg Type
    ty Bool
    isAmbiguous QName
    projection -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    sep
            [ m Doc
    "Cannot eliminate type "
            , Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM (Arg Type -> Type
    forall e. Arg e -> e
    unArg Arg Type
    ty)
            , m Doc
    " with projection "
            , if Bool
    isAmbiguous then
                String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ QName -> String
    forall a. Pretty a => a -> String
    prettyShow QName
    projection
              else
                QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    projection
            ]

        WrongNumberOfConstructorArguments QName
    c Int
    expect Int
    given -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "The constructor" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    c] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "expects" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Int -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Int -> m Doc
    prettyTCM Int
    expect] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "arguments (including hidden ones), but has been given"
          [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Int -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Int -> m Doc
    prettyTCM Int
    given] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "(including hidden ones)"

        CantResolveOverloadedConstructorsTargetingSameDatatype QName
    d List1 QName
    cs -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Can't resolve overloaded constructors targeting the same datatype"
          [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [m Doc -> m Doc
    forall (m :: * -> *). Functor m => m Doc -> m Doc
    parens (QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM (QName -> QName
    qnameToConcrete QName
    d)) m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    forall (m :: * -> *). Applicative m => m Doc
    colon]
          [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ (QName -> m Doc) -> [QName] -> [m Doc]
    forall a b. (a -> b) -> [a] -> [b]
    map QName -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty (List1 QName -> [Item (List1 QName)]
    forall l. IsList l => l -> [Item l]
    List1.toList List1 QName
    cs)

        ConstructorDoesNotTargetGivenType QName
    c Type
    t -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "The constructor" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    c] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "does not construct an element of" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    t]

        ConstructorPatternInWrongDatatype QName
    c QName
    d -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          [QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    c] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "is not a constructor of the datatype"
          [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    d]

        ShadowedModule Name
    x ms :: List1 ModuleName
    ms@(ModuleName
    m0 :| [ModuleName]
    _) -> do
          -- Clash! Concrete module name x already points to the abstract names ms.
          (r, m) <- do
            -- Andreas, 2017-07-28, issue #719.
            -- First, we try to find whether one of the abstract names @ms@ points back to @x@
            scope <- m ScopeInfo
    forall (m :: * -> *). ReadTCState m => m ScopeInfo
    getScope
            -- Get all pairs (y,m) such that y points to some m ∈ ms.
            let xms0 = NonEmpty [(QName, ModuleName)] -> [(QName, ModuleName)]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat (NonEmpty [(QName, ModuleName)] -> [(QName, ModuleName)])
    -> NonEmpty [(QName, ModuleName)] -> [(QName, ModuleName)]
    forall a b. (a -> b) -> a -> b
    $ List1 ModuleName
    ms List1 ModuleName
    -> (ModuleName -> [(QName, ModuleName)])
    -> NonEmpty [(QName, ModuleName)]
    forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
    <&> \ ModuleName
    m -> (QName -> (QName, ModuleName)) -> [QName] -> [(QName, ModuleName)]
    forall a b. (a -> b) -> [a] -> [b]
    map (,ModuleName
    m) ([QName] -> [(QName, ModuleName)])
    -> [QName] -> [(QName, ModuleName)]
    forall a b. (a -> b) -> a -> b
    $ ModuleName -> ScopeInfo -> [QName]
    inverseScopeLookupModule ModuleName
    m ScopeInfo
    scope
            reportSLn "scope.clash.error" 30 $ "candidates = " ++ prettyShow xms0

            -- Try to find x (which will have a different Range, if it has one (#2649)).
            let xms = ((QName, ModuleName) -> Bool)
    -> [(QName, ModuleName)] -> [(QName, ModuleName)]
    forall a. (a -> Bool) -> [a] -> [a]
    filter ((\ QName
    y -> Bool -> Bool
    not (Range -> Bool
    forall a. Null a => a -> Bool
    null (Range -> Bool) -> Range -> Bool
    forall a b. (a -> b) -> a -> b
    $ QName -> Range
    forall a. HasRange a => a -> Range
    getRange QName
    y) Bool -> Bool -> Bool
    && QName
    y QName -> QName -> Bool
    forall a. Eq a => a -> a -> Bool
    == Name -> QName
    C.QName Name
    x) (QName -> Bool)
    -> ((QName, ModuleName) -> QName) -> (QName, ModuleName) -> Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (QName, ModuleName) -> QName
    forall a b. (a, b) -> a
    fst) [(QName, ModuleName)]
    xms0
            reportSLn "scope.class.error" 30 $ "filtered candidates = " ++ prettyShow xms

            -- If we found a copy of x with non-empty range, great!
            ifJust (listToMaybe xms) (\ (QName
    x', ModuleName
    m) -> (Range, ModuleName) -> m (Range, ModuleName)
    forall a. a -> m a
    forall (m :: * -> *) a. Monad m => a -> m a
    return (QName -> Range
    forall a. HasRange a => a -> Range
    getRange QName
    x', ModuleName
    m)) $ {-else-} do

            -- If that failed, we pick the first m from ms which has a nameBindingSite.
            let rms = NonEmpty [(Range, ModuleName)] -> [(Range, ModuleName)]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat (NonEmpty [(Range, ModuleName)] -> [(Range, ModuleName)])
    -> NonEmpty [(Range, ModuleName)] -> [(Range, ModuleName)]
    forall a b. (a -> b) -> a -> b
    $ List1 ModuleName
    ms List1 ModuleName
    -> (ModuleName -> [(Range, ModuleName)])
    -> NonEmpty [(Range, ModuleName)]
    forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
    <&> \ ModuleName
    m -> (Range -> (Range, ModuleName)) -> [Range] -> [(Range, ModuleName)]
    forall a b. (a -> b) -> [a] -> [b]
    map (,ModuleName
    m) ([Range] -> [(Range, ModuleName)])
    -> [Range] -> [(Range, ModuleName)]
    forall a b. (a -> b) -> a -> b
    $
                  (Range -> Bool) -> [Range] -> [Range]
    forall a. (a -> Bool) -> [a] -> [a]
    filter (Range
    forall a. Range' a
    noRange Range -> Range -> Bool
    forall a. Eq a => a -> a -> Bool
    /=) ([Range] -> [Range]) -> [Range] -> [Range]
    forall a b. (a -> b) -> a -> b
    $ (Name -> Range) -> [Name] -> [Range]
    forall a b. (a -> b) -> [a] -> [b]
    map Name -> Range
    nameBindingSite ([Name] -> [Range]) -> [Name] -> [Range]
    forall a b. (a -> b) -> a -> b
    $ [Name] -> [Name]
    forall a. [a] -> [a]
    reverse ([Name] -> [Name]) -> [Name] -> [Name]
    forall a b. (a -> b) -> a -> b
    $ ModuleName -> [Name]
    mnameToList ModuleName
    m
                  -- Andreas, 2017-07-25, issue #2649
                  -- Take the first nameBindingSite we can get hold of.
            reportSLn "scope.class.error" 30 $ "rangeful clashing modules = " ++ prettyShow rms

            -- If even this fails, we pick the first m and give no range.
            return $ fromMaybe (noRange, m0) $ listToMaybe rms

          fsep $
            pwords "Duplicate definition of module" ++ [prettyTCM x <> "."] ++
            pwords "Previous definition of" ++ [help m] ++ pwords "module" ++ [prettyTCM x] ++
            pwords "at" ++ [prettyTCM r]
          where
            help :: MonadPretty m => ModuleName -> m Doc
            help :: MonadPretty m => ModuleName -> m Doc
    help ModuleName
    m = m (Maybe DataOrRecordModule)
    -> m Doc -> (DataOrRecordModule -> m Doc) -> m Doc
    forall (m :: * -> *) a b.
    Monad m =>
    m (Maybe a) -> m b -> (a -> m b) -> m b
    caseMaybeM (ModuleName -> m (Maybe DataOrRecordModule)
    forall (m :: * -> *).
    ReadTCState m =>
    ModuleName -> m (Maybe DataOrRecordModule)
    isDatatypeModule ModuleName
    m) m Doc
    forall a. Null a => a
    empty ((DataOrRecordModule -> m Doc) -> m Doc)
    -> (DataOrRecordModule -> m Doc) -> m Doc
    forall a b. (a -> b) -> a -> b
    $ \case
              DataOrRecordModule
    IsDataModule   -> m Doc
    "(datatype)"
              DataOrRecordModule
    IsRecordModule -> m Doc
    "(record)"

        ModuleArityMismatch ModuleName
    m Telescope
    EmptyTel Either (List1 (NamedArg Expr)) Args
    args -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "The module" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [ModuleName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => ModuleName -> m Doc
    prettyTCM ModuleName
    m] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "is not parameterized, but is being applied to arguments"

        ModuleArityMismatch ModuleName
    m tel :: Telescope
    tel@(ExtendTel Dom Type
    _ Abs Telescope
    _) Either (List1 (NamedArg Expr)) Args
    args -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "The arguments to " [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [ModuleName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => ModuleName -> m Doc
    prettyTCM ModuleName
    m] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "do not fit the telescope" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          [Telescope -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Telescope -> m Doc
    prettyTCM Telescope
    tel]

        ShouldBeEmpty Type
    t [] -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
           Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    t m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "should be empty, but that's not obvious to me"

        ShouldBeEmpty Type
    t [DeBruijnPattern]
    ps -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep (
          Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    t m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    :
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "should be empty, but the following constructor patterns are valid:"
          ) m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    $$ Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 ([m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ (DeBruijnPattern -> m Doc) -> [DeBruijnPattern] -> [m Doc]
    forall a b. (a -> b) -> [a] -> [b]
    map (Integer -> DeBruijnPattern -> m Doc
    forall a. MonadPretty m => Integer -> Pattern' a -> m Doc
    prettyPat Integer
    0) [DeBruijnPattern]
    ps)

        ShouldBeASort Type
    t -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    t m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "should be a sort, but it isn't"

        ShouldBePi Type
    t -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    t m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "should be a function type, but it isn't"

        ShouldBePath Type
    t -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    t m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "should be a Path or PathP type, but it isn't"

        CannotApply Expr
    e Type
    t -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    sep
          [ m Doc
    "Expression used as function but does not have function type:"
          , Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ m Doc
    "expr:" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> Expr -> m Doc
    forall a (m :: * -> *).
    (ToConcrete a, Pretty (ConOfAbs a), MonadAbsToCon m) =>
    a -> m Doc
    prettyA Expr
    e
          , Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ m Doc
    "type:" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    t
          ]

        InvalidTypeSort Sort
    s -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Sort -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Sort -> m Doc
    prettyTCM Sort
    s m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "is not a valid sort"

        CannotSolveSizeConstraints List1 (ProblemConstraint, HypSizeConstraint)
    ccs Doc
    reason -> do
          -- Print the HypSizeConstraints (snd)
          [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
            [ [ String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String
    "Cannot solve size constraints" ]
            , NonEmpty (m Doc) -> [Item (NonEmpty (m Doc))]
    forall l. IsList l => l -> [Item l]
    List1.toList (NonEmpty (m Doc) -> [Item (NonEmpty (m Doc))])
    -> NonEmpty (m Doc) -> [Item (NonEmpty (m Doc))]
    forall a b. (a -> b) -> a -> b
    $ ((ProblemConstraint, HypSizeConstraint) -> m Doc)
    -> List1 (ProblemConstraint, HypSizeConstraint) -> NonEmpty (m Doc)
    forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap (HypSizeConstraint -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => HypSizeConstraint -> m Doc
    prettyTCM (HypSizeConstraint -> m Doc)
    -> ((ProblemConstraint, HypSizeConstraint) -> HypSizeConstraint)
    -> (ProblemConstraint, HypSizeConstraint)
    -> m Doc
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (ProblemConstraint, HypSizeConstraint) -> HypSizeConstraint
    forall a b. (a, b) -> b
    snd) List1 (ProblemConstraint, HypSizeConstraint)
    ccs
            , [ m Doc
    "Reason:" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> Doc -> m Doc
    forall a. a -> m a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Doc
    reason | Bool -> Bool
    not (Doc -> Bool
    forall a. Null a => a -> Bool
    null Doc
    reason) ]
            ]

        ContradictorySizeConstraint cc :: (ProblemConstraint, HypSizeConstraint)
    cc@(ProblemConstraint
    _,HypSizeConstraint
    c0) -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Contradictory size constraint" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [HypSizeConstraint -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => HypSizeConstraint -> m Doc
    prettyTCM HypSizeConstraint
    c0]

        EmptyTypeOfSizes Term
    t -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Possibly empty type of sizes:" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    t]

        FunctionTypeInSizeUniv Term
    v -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Functions may not return sizes, thus, function type " [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          [ Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    v ] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    " is illegal"

        TypeError
    PostulatedSizeInModule -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "We don't like postulated sizes in parametrized modules."

        TypeError
    SplitOnCoinductive -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Pattern matching on coinductive types is not allowed"

        SplitOnIrrelevant Dom Type
    t -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Cannot pattern match against" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Relevance -> String
    forall a. Verbalize a => a -> String
    verbalize (Relevance -> String) -> Relevance -> String
    forall a b. (a -> b) -> a -> b
    $ Dom Type -> Relevance
    forall a. LensRelevance a => a -> Relevance
    getRelevance Dom Type
    t] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "argument of type" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM (Type -> m Doc) -> Type -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Dom Type -> Type
    forall t e. Dom' t e -> e
    unDom Dom Type
    t]

        SplitOnUnusableCohesion Dom Type
    t -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Cannot pattern match against" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Cohesion -> String
    forall a. Verbalize a => a -> String
    verbalize (Cohesion -> String) -> Cohesion -> String
    forall a b. (a -> b) -> a -> b
    $ Dom Type -> Cohesion
    forall a. LensCohesion a => a -> Cohesion
    getCohesion Dom Type
    t] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "argument of type" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM (Type -> m Doc) -> Type -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Dom Type -> Type
    forall t e. Dom' t e -> e
    unDom Dom Type
    t]

        SplitOnUnusablePolarity Dom Type
    t -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Cannot pattern match against" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ PolarityModality -> String
    forall a. Verbalize a => a -> String
    verbalize (PolarityModality -> String) -> PolarityModality -> String
    forall a b. (a -> b) -> a -> b
    $ Dom Type -> PolarityModality
    forall a. LensModalPolarity a => a -> PolarityModality
    getModalPolarity Dom Type
    t] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "argument of type" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM (Type -> m Doc) -> Type -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Dom Type -> Type
    forall t e. Dom' t e -> e
    unDom Dom Type
    t]

        -- UNUSED:
        -- SplitOnErased t -> fsep $
        --   pwords "Cannot pattern match against" ++ [text $ verbalize $ getQuantity t] ++
        --   pwords "argument of type" ++ [prettyTCM $ unDom t]

        SplitOnNonVariable Term
    v Type
    t -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Cannot pattern match because the (refined) argument " [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          [ Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    v ] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    " is not a variable."

        SplitOnNonEtaRecord QName
    q -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
          [ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Pattern matching on no-eta record type"
          , [ QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    q, m Doc -> m Doc
    forall (m :: * -> *). Functor m => m Doc -> m Doc
    parens (m Doc
    "defined at" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> Range -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Range -> m Doc
    prettyTCM Range
    r) ]
          , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "is not allowed"
          , [ m Doc -> m Doc
    forall (m :: * -> *). Functor m => m Doc -> m Doc
    parens m Doc
    "to activate, add declaration `pattern` to record definition" ]
          ]
          where r :: Range
    r = Name -> Range
    nameBindingSite (Name -> Range) -> Name -> Range
    forall a b. (a -> b) -> a -> b
    $ QName -> Name
    qnameName QName
    q

        SplitOnAbstract QName
    d ->
          m Doc
    "Cannot split on abstract data type" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    d

        SplitOnUnchecked QName
    d ->
          m Doc
    "Cannot split on data type" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    d m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> m Doc
    "whose definition has not yet been checked"

        SplitOnPartial Dom Type
    dom -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat
          [ m Doc
    "Splitting on partial elements is only allowed at the type Partial, but the domain here is", Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM (Type -> m Doc) -> Type -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Dom Type -> Type
    forall t e. Dom' t e -> e
    unDom Dom Type
    dom ]

        SplitInProp DataOrRecordE
    dr -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep
          [ String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text String
    "Cannot split on"
          , String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ DataOrRecordE -> String
    kindOfData DataOrRecordE
    dr
          , String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text String
    "in Prop unless target is in Prop"
          ]
          where
            kindOfData :: DataOrRecordE -> String
            kindOfData :: DataOrRecordE -> String
    kindOfData DataOrRecordE
    IsData                                                          = String
    "datatype"
            kindOfData (IsRecord InductionAndEta {recordInduction :: InductionAndEta -> Maybe Induction
    recordInduction=Maybe Induction
    Nothing})            = String
    "record type"
            kindOfData (IsRecord InductionAndEta {recordInduction :: InductionAndEta -> Maybe Induction
    recordInduction=(Just Induction
    Inductive)})   =  String
    "inductive record type"
            kindOfData (IsRecord InductionAndEta {recordInduction :: InductionAndEta -> Maybe Induction
    recordInduction=(Just Induction
    CoInductive)}) = String
    "coinductive record type"

        DefinitionIsIrrelevant QName
    x -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          m Doc
    "Identifier" m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    x m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "is declared irrelevant, so it cannot be used here"

        DefinitionIsErased QName
    x -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          m Doc
    "Identifier" m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    x m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "is declared erased, so it cannot be used here"

        ProjectionIsIrrelevant QName
    x -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat
          [ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep [ m Doc
    "Projection " , QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    x, m Doc
    " is irrelevant." ]
          , m Doc
    "Turn on option --irrelevant-projections to use it (unsafe)"
          ]

        VariableIsIrrelevant Name
    x -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          m Doc
    "Variable" m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : Name -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Name -> m Doc
    prettyTCM (Name -> Name
    nameConcrete Name
    x) m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "is declared irrelevant, so it cannot be used here"

        VariableIsErased Name
    x -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          m Doc
    "Variable" m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : Name -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Name -> m Doc
    prettyTCM (Name -> Name
    nameConcrete Name
    x) m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "is declared erased, so it cannot be used here"

        VariableIsOfUnusableCohesion Name
    x Cohesion
    c -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep
          [m Doc
    "Variable", Name -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Name -> m Doc
    prettyTCM (Name -> Name
    nameConcrete Name
    x), m Doc
    "is declared", String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (Cohesion -> String
    forall a. Show a => a -> String
    show Cohesion
    c), m Doc
    "so it cannot be used here"]

        TypeError
    LambdaIsErased -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String
    "Erased pattern-matching lambdas may only be used in erased contexts"

        TypeError
    RecordIsErased -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String
    "A record expression corresponding to an erased record " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++
          String
    "constructor must only be used in erased settings"

        InvalidModalTelescopeUse Term
    t Modality
    used Modality
    avail Definition
    def -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep
          [ m Doc
    "Telescope variable" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    t
          , m Doc
    "is indirectly being used in the" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (Modality -> String
    forall a. Verbalize a => a -> String
    verbalize (Modality -> Modality
    forall a. LensModality a => a -> Modality
    getModality Modality
    used)) m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> m Doc
    "modality"
          , m Doc
    "but only available in the" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (Modality -> String
    forall a. Verbalize a => a -> String
    verbalize (Modality -> Modality
    forall a. LensModality a => a -> Modality
    getModality Modality
    avail)) m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> m Doc
    "modality"
          , m Doc
    "when inserting into the telescope of definition"
          , QName -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty (Definition -> QName
    defName Definition
    def) m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> m Doc
    ":" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM (Definition -> Type
    defType Definition
    def)
          ]

        VariableIsOfUnusablePolarity Name
    x PolarityModality
    c -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          [m Doc
    "Variable", Name -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Name -> m Doc
    prettyTCM (Name -> Name
    nameConcrete Name
    x), m Doc
    "is bound with", String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (ModalPolarity -> String
    forall a. Verbalize a => a -> String
    verbalize ModalPolarity
    p)] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++  String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "polarity, so it cannot be used here at" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          [String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (Indefinite ModalPolarity -> String
    forall a. Verbalize a => a -> String
    verbalize (ModalPolarity -> Indefinite ModalPolarity
    forall a. a -> Indefinite a
    Indefinite ModalPolarity
    l)), m Doc
    "position"]
          where
            PolarityModality ModalPolarity
    _ ModalPolarity
    p ModalPolarity
    l = PolarityModality
    c

        UnequalTerms Comparison
    cmp Term
    s Term
    t CompareAs
    a -> case (Term
    s,Term
    t) of
          (Sort Sort
    s1      , Sort Sort
    s2      )
            | Comparison
    CmpEq  <- Comparison
    cmp              -> TypeError -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => TypeError -> m Doc
    prettyTCM (TypeError -> m Doc) -> TypeError -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Sort -> Sort -> TypeError
    UnequalSorts Sort
    s1 Sort
    s2
            | Comparison
    CmpLeq <- Comparison
    cmp              -> TypeError -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => TypeError -> m Doc
    prettyTCM (TypeError -> m Doc) -> TypeError -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Sort -> Sort -> TypeError
    NotLeqSort Sort
    s1 Sort
    s2
          (Sort MetaS{} , Term
    t            ) -> TypeError -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => TypeError -> m Doc
    prettyTCM (TypeError -> m Doc) -> TypeError -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Type -> TypeError
    ShouldBeASort (Type -> TypeError) -> Type -> TypeError
    forall a b. (a -> b) -> a -> b
    $ Sort -> Term -> Type
    forall t a. Sort' t -> a -> Type'' t a
    El Sort
    forall a. HasCallStack => a
    __IMPOSSIBLE__ Term
    t
          (Term
    s            , Sort MetaS{} ) -> TypeError -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => TypeError -> m Doc
    prettyTCM (TypeError -> m Doc) -> TypeError -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Type -> TypeError
    ShouldBeASort (Type -> TypeError) -> Type -> TypeError
    forall a b. (a -> b) -> a -> b
    $ Sort -> Term -> Type
    forall t a. Sort' t -> a -> Type'' t a
    El Sort
    forall a. HasCallStack => a
    __IMPOSSIBLE__ Term
    s
          (Sort DefS{}  , Term
    t            ) -> TypeError -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => TypeError -> m Doc
    prettyTCM (TypeError -> m Doc) -> TypeError -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Type -> TypeError
    ShouldBeASort (Type -> TypeError) -> Type -> TypeError
    forall a b. (a -> b) -> a -> b
    $ Sort -> Term -> Type
    forall t a. Sort' t -> a -> Type'' t a
    El Sort
    forall a. HasCallStack => a
    __IMPOSSIBLE__ Term
    t
          (Term
    s            , Sort DefS{}  ) -> TypeError -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => TypeError -> m Doc
    prettyTCM (TypeError -> m Doc) -> TypeError -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Type -> TypeError
    ShouldBeASort (Type -> TypeError) -> Type -> TypeError
    forall a b. (a -> b) -> a -> b
    $ Sort -> Term -> Type
    forall t a. Sort' t -> a -> Type'' t a
    El Sort
    forall a. HasCallStack => a
    __IMPOSSIBLE__ Term
    s
          (Term
    _            , Term
    _            ) -> do
            (d1, d2, d) <- Term -> Term -> m (Doc, Doc, Doc)
    forall (m :: * -> *).
    MonadPretty m =>
    Term -> Term -> m (Doc, Doc, Doc)
    prettyInEqual Term
    s Term
    t
            fsep $ concat $
              [ [return d1, notCmp cmp, return d2]
              , case a of
                    AsTermsOf Type
    t -> String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "of type" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    t]
                    CompareAs
    AsSizes     -> String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "of type" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM (Type -> m Doc) -> m Type -> m Doc
    forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
    =<< m Type
    forall (m :: * -> *).
    (HasBuiltins m, MonadTCEnv m, ReadTCState m) =>
    m Type
    sizeType]
                    CompareAs
    AsTypes     -> []
              , [return d]
              ]

        UnequalLevel Comparison
    cmp Level
    s Level
    t -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          [Level -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Level -> m Doc
    prettyTCM Level
    s, Comparison -> m Doc
    forall (m :: * -> *). MonadPretty m => Comparison -> m Doc
    notCmp Comparison
    cmp, Level -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Level -> m Doc
    prettyTCM Level
    t]

        UnequalRelevance Comparison
    cmp Term
    a Term
    b -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          [Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    a, Comparison -> m Doc
    forall (m :: * -> *). MonadPretty m => Comparison -> m Doc
    notCmp Comparison
    cmp, Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    b] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "because one is a relevant function type and the other is an irrelevant function type"

        UnequalQuantity Comparison
    cmp Term
    a Term
    b -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          [Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    a, Comparison -> m Doc
    forall (m :: * -> *). MonadPretty m => Comparison -> m Doc
    notCmp Comparison
    cmp, Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    b] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "because one is a non-erased function type and the other is an erased function type"

        UnequalCohesion Comparison
    cmp Term
    a Term
    b -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          [Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    a, Comparison -> m Doc
    forall (m :: * -> *). MonadPretty m => Comparison -> m Doc
    notCmp Comparison
    cmp, Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    b] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "because one is a non-flat function type and the other is a flat function type"
          -- FUTURE Cohesion: update message if/when introducing sharp.

        UnequalPolarity Comparison
    cmp Term
    a Term
    b -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          [Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    a, Comparison -> m Doc
    forall (m :: * -> *). MonadPretty m => Comparison -> m Doc
    notCmp Comparison
    cmp, Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    b] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "because they do not have the same polarity annotations"

        UnequalFiniteness Comparison
    cmp Term
    a Term
    b -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          [Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    a, Comparison -> m Doc
    forall (m :: * -> *). MonadPretty m => Comparison -> m Doc
    notCmp Comparison
    cmp, Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    b] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "because one is a type of partial elements and the other is a function type"
          -- FUTURE Cohesion: update message if/when introducing sharp.

        UnequalHiding Term
    a Term
    b -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          [Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    a, m Doc
    "!=", Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    b] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "because one is an implicit function type and the other is an explicit function type"

        UnequalSorts Sort
    s1 Sort
    s2 -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          [Sort -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Sort -> m Doc
    prettyTCM Sort
    s1, m Doc
    "!=", Sort -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Sort -> m Doc
    prettyTCM Sort
    s2]

        NotLeqSort Sort
    s1 Sort
    s2 -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          [Sort -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Sort -> m Doc
    prettyTCM Sort
    s1] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "is not less or equal than" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Sort -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Sort -> m Doc
    prettyTCM Sort
    s2]

        TooManyFields QName
    r [Name]
    missing List1 Name
    xs -> QName -> [Name] -> List1 Name -> m Doc
    forall (m :: * -> *).
    MonadPretty m =>
    QName -> [Name] -> List1 Name -> m Doc
    prettyTooManyFields QName
    r [Name]
    missing List1 Name
    xs

        DuplicateConstructors List1 Name
    xs -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
          [ [ m Doc
    "Duplicate" ]
          , [ List1 Name -> m Doc -> m Doc
    forall (m :: * -> *) a. (Functor m, Sized a) => a -> m Doc -> m Doc
    pluralS List1 Name
    xs m Doc
    "constructor" ]
          , m Doc -> NonEmpty (m Doc) -> [m Doc]
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Semigroup (m Doc), Foldable t) =>
    m Doc -> t (m Doc) -> [m Doc]
    punctuate m Doc
    forall (m :: * -> *). Applicative m => m Doc
    comma (NonEmpty (m Doc) -> [m Doc]) -> NonEmpty (m Doc) -> [m Doc]
    forall a b. (a -> b) -> a -> b
    $ (Name -> m Doc) -> List1 Name -> NonEmpty (m Doc)
    forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Name -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty List1 Name
    xs
          , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "in datatype"
          ]

        DuplicateFields List1 Name
    xs -> List1 Name -> m Doc
    forall (m :: * -> *). MonadPretty m => List1 Name -> m Doc
    prettyDuplicateFields List1 Name
    xs

        DuplicateOverlapPragma QName
    q OverlapMode
    old OverlapMode
    new -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "The instance" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    q] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "was already marked" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [OverlapMode -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty OverlapMode
    old m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    "."] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "This" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [OverlapMode -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty OverlapMode
    new] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "pragma can not be applied to it."

        WithOnFreeVariable Expr
    e Term
    v -> do
          de <- Expr -> m Doc
    forall a (m :: * -> *).
    (ToConcrete a, Pretty (ConOfAbs a), MonadAbsToCon m) =>
    a -> m Doc
    prettyA Expr
    e
          dv <- prettyTCM v
          if show de == show dv
            then fsep $
              pwords "Cannot `with` on variable" ++ [return dv] ++
              pwords " bound in a module telescope (or patterns of a parent clause)"
            else fsep $
              pwords "Cannot `with` on expression" ++ [return de] ++ pwords "which reduces to variable" ++ [return dv] ++
              pwords " bound in a module telescope (or patterns of a parent clause)"

        UnexpectedWithPatterns List1 Pattern
    ps -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Unexpected with patterns" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ m Doc -> NonEmpty (m Doc) -> [m Doc]
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Semigroup (m Doc), Foldable t) =>
    m Doc -> t (m Doc) -> [m Doc]
    punctuate m Doc
    " |" ((Pattern -> m Doc) -> List1 Pattern -> NonEmpty (m Doc)
    forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Pattern -> m Doc
    forall a (m :: * -> *).
    (ToConcrete a, Pretty (ConOfAbs a), MonadAbsToCon m) =>
    a -> m Doc
    prettyA List1 Pattern
    ps)

        TypeError
    TooFewPatternsInWithClause -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Too few arguments given in with-clause"
        TypeError
    TooManyPatternsInWithClause -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Too many arguments given in with-clause"

        WithClausePatternMismatch Pattern
    p NamedArg DeBruijnPattern
    q -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "With clause pattern " [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Pattern -> m Doc
    forall a (m :: * -> *).
    (ToConcrete a, Pretty (ConOfAbs a), MonadAbsToCon m) =>
    a -> m Doc
    prettyA Pattern
    p] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    " is not an instance of its parent pattern " [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [[Doc] -> Doc
    forall (t :: * -> *). Foldable t => t Doc -> Doc
    P.fsep ([Doc] -> Doc) -> m [Doc] -> m Doc
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> [NamedArg DeBruijnPattern] -> m [Doc]
    forall (m :: * -> *).
    MonadPretty m =>
    [NamedArg DeBruijnPattern] -> m [Doc]
    prettyTCMPatterns [NamedArg DeBruijnPattern
    q]]

        PathAbstractionFailed Abs Type
    b -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat
          [ (m Doc
    "Path abstraction failed for type" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM (Abs Type -> Type
    forall a. Abs a -> a
    unAbs Abs Type
    b)) m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    "."
          , m Doc
    "The type may be non-fibrant or its sort depends on an interval variable"
          ]

        MetaCannotDependOn MetaId
    m Term
    v Int
    i ->
          m Bool -> m Doc -> m Doc -> m Doc
    forall (m :: * -> *) a. Monad m => m Bool -> m a -> m a -> m a
    ifM (MetaId -> m Bool
    forall (m :: * -> *). ReadTCState m => MetaId -> m Bool
    isSortMeta MetaId
    m m Bool -> m Bool -> m Bool
    forall (m :: * -> *). Monad m => m Bool -> m Bool -> m Bool
    `and2M` (Bool -> Bool
    not (Bool -> Bool) -> m Bool -> m Bool
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> m Bool
    forall (m :: * -> *). HasOptions m => m Bool
    hasUniversePolymorphism))
          ( {- then -}
            [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep [ String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text String
    "Cannot instantiate the metavariable"
                 , MetaId -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => MetaId -> m Doc
    prettyTCM MetaId
    m
                 , m Doc
    "to"
                 , Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    v
                 , m Doc
    "since universe polymorphism is disabled"
                 ]
          ) {- else -}
          ( [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep [ String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text String
    "Cannot instantiate the metavariable"
                 , MetaId -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => MetaId -> m Doc
    prettyTCM MetaId
    m
                 , m Doc
    "to solution"
                 , Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    v
                 , m Doc
    "since it contains the variable"
                 , Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM (Int -> Elims -> Term
    I.Var Int
    i [])
                 , m Doc
    "which is not in scope of the metavariable"
                 ]
            )
        MetaIrrelevantSolution MetaId
    m Term
    v ->
          [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep [ String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text String
    "Cannot instantiate the metavariable"
               , MetaId -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => MetaId -> m Doc
    prettyTCM MetaId
    m
               , m Doc
    "to solution"
               , Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    v
               , m Doc
    "since (part of) the solution was created in an irrelevant context"
               ]

        MetaErasedSolution MetaId
    m Term
    v  ->
          [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep [ String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text String
    "Cannot instantiate the metavariable"
               , MetaId -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => MetaId -> m Doc
    prettyTCM MetaId
    m
               , m Doc
    "to solution"
               , Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    v
               , m Doc
    "since (part of) the solution was created in an erased context"
               ]

        WrongSharpArity QName
    c -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          [QName -> m Doc
    forall a (m :: * -> *).
    (ToConcrete a, Pretty (ConOfAbs a), MonadAbsToCon m) =>
    a -> m Doc
    prettyA QName
    c] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "must be applied to exactly one argument"

        BuiltinMustBeConstructor BuiltinId
    s Expr
    e -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          [Expr -> m Doc
    forall a (m :: * -> *).
    (ToConcrete a, Pretty (ConOfAbs a), MonadAbsToCon m) =>
    a -> m Doc
    prettyA Expr
    e] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "must be a constructor in the binding to builtin" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [BuiltinId -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty BuiltinId
    s]

        BuiltinMustBeData BuiltinId
    s Int
    n -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "The builtin" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [BuiltinId -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty BuiltinId
    s] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "must be a datatype with" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          if Int
    n Int -> Int -> Bool
    forall a. Eq a => a -> a -> Bool
    == Int
    1 then String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "a single constructor or an (inductive) record type"
          else [Int -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty Int
    n] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "constructors"

        BuiltinMustBeDef BuiltinId
    s -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "The argument to BUILTIN" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [BuiltinId -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty BuiltinId
    s] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "must be a defined name"

        BuiltinMustBeFunction BuiltinId
    s -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Builtin" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [BuiltinId -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty BuiltinId
    s] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "must be bound to a function"

        BuiltinMustBePostulate BuiltinId
    s -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "The argument to BUILTIN" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [BuiltinId -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty BuiltinId
    s] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "must be a postulated name"

        NoSuchBuiltinName String
    s -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "There is no built-in thing called" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [String -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty String
    s]

        InvalidBuiltin String
    s -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    s

        DuplicateBuiltinBinding BuiltinId
    b Term
    x Term
    y -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Duplicate binding for built-in thing" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [BuiltinId -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty BuiltinId
    b m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    forall (m :: * -> *). Applicative m => m Doc
    comma] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "previous binding to" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    x]

        NoBindingForBuiltin BuiltinId
    x
          | BuiltinId
    x BuiltinId -> [BuiltinId] -> Bool
    forall a. Eq a => a -> [a] -> Bool
    forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
    `elem` [BuiltinId
    builtinZero, BuiltinId
    builtinSuc] -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
            String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "No binding for builtin " [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [BuiltinId -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty BuiltinId
    x m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    forall (m :: * -> *). Applicative m => m Doc
    comma] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
            String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords (String
    "use {-# BUILTIN " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ BuiltinId -> String
    forall a. IsBuiltin a => a -> String
    getBuiltinId BuiltinId
    builtinNat String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    " name #-} to bind builtin natural " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++
                    String
    "numbers to the type 'name'")
          | Bool
    otherwise -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
            String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "No binding for builtin thing" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [BuiltinId -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty BuiltinId
    x m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    forall (m :: * -> *). Applicative m => m Doc
    comma] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
            String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords (String
    "use {-# BUILTIN " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ BuiltinId -> String
    forall a. IsBuiltin a => a -> String
    getBuiltinId BuiltinId
    x String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    " name #-} to bind it to 'name'")

        NoBindingForPrimitive PrimitiveId
    x -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Missing binding for" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          [PrimitiveId -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty PrimitiveId
    x] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "primitive."

        DuplicatePrimitiveBinding PrimitiveId
    b QName
    x QName
    y -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Duplicate binding for primitive thing" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [PrimitiveId -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty PrimitiveId
    b m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    forall (m :: * -> *). Applicative m => m Doc
    comma] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "previous binding to" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    x]

        NoSuchPrimitiveFunction String
    x -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "There is no primitive function called" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text String
    x]

        WrongArgInfoForPrimitive PrimitiveId
    x ArgInfo
    got ArgInfo
    expect ->
          [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat [ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Wrong definition properties for primitive" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [PrimitiveId -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty PrimitiveId
    x]
               , Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String
    "Got:      " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String -> [String] -> String
    forall a. [a] -> [[a]] -> [a]
    intercalate String
    ", " [String]
    gs
               , Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String
    "Expected: " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String -> [String] -> String
    forall a. [a] -> [[a]] -> [a]
    intercalate String
    ", " [String]
    es ]
          where
            ([String]
    gs, [String]
    es) = [(String, String)] -> ([String], [String])
    forall a b. [(a, b)] -> ([a], [b])
    unzip [ (String, String)
    p | p :: (String, String)
    p@(String
    g, String
    e) <- [String] -> [String] -> [(String, String)]
    forall a b. [a] -> [b] -> [(a, b)]
    zip (ArgInfo -> [String]
    forall {a}. (LensHiding a, LensModality a) => a -> [String]
    things ArgInfo
    got) (ArgInfo -> [String]
    forall {a}. (LensHiding a, LensModality a) => a -> [String]
    things ArgInfo
    expect), String
    g String -> String -> Bool
    forall a. Eq a => a -> a -> Bool
    /= String
    e ]
            things :: a -> [String]
    things a
    i = [Hiding -> String
    forall a. Verbalize a => a -> String
    verbalize (Hiding -> String) -> Hiding -> String
    forall a b. (a -> b) -> a -> b
    $ a -> Hiding
    forall a. LensHiding a => a -> Hiding
    getHiding a
    i,
                        String
    "at modality " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ Modality -> String
    forall a. Verbalize a => a -> String
    verbalize (a -> Modality
    forall a. LensModality a => a -> Modality
    getModality a
    i)]

        BuiltinInParameterisedModule BuiltinId
    x -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String
    "The BUILTIN pragma cannot appear inside a bound context " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++
          String
    "(for instance, in a parameterised module or as a local declaration)"

        IllegalDeclarationInDataDefinition List1 Declaration
    ds -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat
          [ m Doc
    "Illegal declaration in data type definition"
          , Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ NonEmpty (m Doc) -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat (NonEmpty (m Doc) -> m Doc) -> NonEmpty (m Doc) -> m Doc
    forall a b. (a -> b) -> a -> b
    $ (Declaration -> m Doc) -> List1 Declaration -> NonEmpty (m Doc)
    forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Declaration -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty List1 Declaration
    ds
          ]

        IllegalLetInTelescope TypedBinding
    tb -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          -- pwords "The binding" ++
          TypedBinding -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty TypedBinding
    tb m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    :
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    " is not allowed in a telescope here."

        IllegalPatternInTelescope Binder
    bd -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          Binder -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty Binder
    bd m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    :
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    " is not allowed in a telescope here."

        TypeError
    AbsentRHSRequiresAbsurdPattern -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String
    "The right-hand side can only be omitted if there " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++
          String
    "is an absurd pattern, () or {}, in the left-hand side."

        LibraryError LibErrors
    err -> Doc -> m Doc
    forall a. a -> m a
    forall (m :: * -> *) a. Monad m => a -> m a
    return (Doc -> m Doc) -> Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ LibErrors -> Doc
    formatLibErrors LibErrors
    err

        LibTooFarDown TopLevelModuleName
    m AgdaLibFile
    lib -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat
          [ String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text String
    "An .agda-lib file for" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> TopLevelModuleName -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty TopLevelModuleName
    m
          , String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text String
    "must not be located in the directory" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (String -> String
    takeDirectory (AgdaLibFile
    lib AgdaLibFile -> Lens' AgdaLibFile String -> String
    forall o i. o -> Lens' o i -> i
    ^. (String -> f String) -> AgdaLibFile -> f AgdaLibFile
    Lens' AgdaLibFile String
    libFile))
          ]

        TypeError
    SolvedButOpenHoles -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Module cannot be imported since it has open interaction points" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "(consider adding {-# OPTIONS --allow-unsolved-metas #-} to this module)"

        CyclicModuleDependency (List2 TopLevelModuleName
    m0 TopLevelModuleName
    m1 [TopLevelModuleName]
    ms) ->
          [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep (String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "cyclic module dependency:")
          m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    $$ Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 ([m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ (TopLevelModuleName -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty TopLevelModuleName
    m0 m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    :) ([m Doc] -> [m Doc]) -> [m Doc] -> [m Doc]
    forall a b. (a -> b) -> a -> b
    $ (TopLevelModuleName -> m Doc) -> [TopLevelModuleName] -> [m Doc]
    forall a b. (a -> b) -> [a] -> [b]
    map ((m Doc
    "importing" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+>) (m Doc -> m Doc)
    -> (TopLevelModuleName -> m Doc) -> TopLevelModuleName -> m Doc
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . TopLevelModuleName -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty) (TopLevelModuleName
    m1 TopLevelModuleName -> [TopLevelModuleName] -> [TopLevelModuleName]
    forall a. a -> [a] -> [a]
    : [TopLevelModuleName]
    ms))

        FileNotFound TopLevelModuleName
    x [AbsolutePath]
    files ->
          [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ( String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Failed to find source of module" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [TopLevelModuleName -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty TopLevelModuleName
    x] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
                 String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "in any of the following locations:"
               ) m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    $$ Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 ([m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ (AbsolutePath -> m Doc) -> [AbsolutePath] -> [m Doc]
    forall a b. (a -> b) -> [a] -> [b]
    map (String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (String -> m Doc)
    -> (AbsolutePath -> String) -> AbsolutePath -> m Doc
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . AbsolutePath -> String
    filePath) [AbsolutePath]
    files)

        OverlappingProjects AbsolutePath
    f TopLevelModuleName
    m1 TopLevelModuleName
    m2
          | Doc -> CI String
    forall {a}. Doc a -> CI String
    canon Doc
    d1 CI String -> CI String -> Bool
    forall a. Eq a => a -> a -> Bool
    == Doc -> CI String
    forall {a}. Doc a -> CI String
    canon Doc
    d2 -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
              [ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Case mismatch when accessing file"
              , [ String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ AbsolutePath -> String
    filePath AbsolutePath
    f ]
              , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "through module name"
              , [ Doc -> m Doc
    forall a. a -> m a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Doc
    d2 ]
              ]
          | Bool
    otherwise -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep
               ( String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "The file" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (AbsolutePath -> String
    filePath AbsolutePath
    f)] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
                 String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "can be accessed via several project roots. Both" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
                 [ Doc -> m Doc
    forall a. a -> m a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Doc
    d1 ] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "and" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [ Doc -> m Doc
    forall a. a -> m a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Doc
    d2 ] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
                 String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "point to this file."
               )
          where
          canon :: Doc a -> CI String
    canon = String -> CI String
    forall s. FoldCase s => s -> CI s
    CaseInsens.mk (String -> CI String) -> (Doc a -> String) -> Doc a -> CI String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Doc a -> String
    forall a. Doc a -> String
    P.render
          d1 :: Doc
    d1 = TopLevelModuleName -> Doc
    forall a. Pretty a => a -> Doc
    P.pretty TopLevelModuleName
    m1
          d2 :: Doc
    d2 = TopLevelModuleName -> Doc
    forall a. Pretty a => a -> Doc
    P.pretty TopLevelModuleName
    m2

        AmbiguousTopLevelModuleName TopLevelModuleName
    x List2 AbsolutePath
    files ->
          [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ( String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Ambiguous module name. The module name" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
                 [TopLevelModuleName -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty TopLevelModuleName
    x] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
                 String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "could refer to any of the following files:"
               ) m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    $$ Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (List2 (m Doc) -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat (List2 (m Doc) -> m Doc) -> List2 (m Doc) -> m Doc
    forall a b. (a -> b) -> a -> b
    $ (AbsolutePath -> m Doc) -> List2 AbsolutePath -> List2 (m Doc)
    forall a b. (a -> b) -> List2 a -> List2 b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap (String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (String -> m Doc)
    -> (AbsolutePath -> String) -> AbsolutePath -> m Doc
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . AbsolutePath -> String
    filePath) List2 AbsolutePath
    files)

        AmbiguousProjection QName
    d List1 QName
    disambs -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat
          [ m Doc
    "Ambiguous projection " m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    d m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    "."
          , m Doc
    "It could refer to any of"
          , Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ List2 (m Doc) -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat (List2 (m Doc) -> m Doc) -> List2 (m Doc) -> m Doc
    forall a b. (a -> b) -> a -> b
    $ (QName -> m Doc) -> List2 QName -> List2 (m Doc)
    forall a b. (a -> b) -> List2 a -> List2 b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap QName -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyDisambProj (List2 QName -> List2 (m Doc)) -> List2 QName -> List2 (m Doc)
    forall a b. (a -> b) -> a -> b
    $ QName -> List1 QName -> List2 QName
    forall a. a -> List1 a -> List2 a
    List2.cons QName
    d List1 QName
    disambs
          ]

        AmbiguousOverloadedProjection List1 QName
    ds Doc
    reason -> do
          let nameRaw :: m Doc
    nameRaw = Name -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty (Name -> m Doc) -> Name -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Name -> Name
    A.nameConcrete (Name -> Name) -> Name -> Name
    forall a b. (a -> b) -> a -> b
    $ QName -> Name
    A.qnameName (QName -> Name) -> QName -> Name
    forall a b. (a -> b) -> a -> b
    $ List1 QName -> QName
    forall a. NonEmpty a -> a
    List1.head List1 QName
    ds
          [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat
            [ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep
              [ String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text String
    "Cannot resolve overloaded projection"
              , m Doc
    nameRaw
              , String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text String
    "because"
              , Doc -> m Doc
    forall a. a -> m a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Doc
    reason
              ]
            , Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text String
    "candidates in scope:"
            , NonEmpty (m Doc) -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat (NonEmpty (m Doc) -> m Doc) -> NonEmpty (m Doc) -> m Doc
    forall a b. (a -> b) -> a -> b
    $ List1 QName -> (QName -> m Doc) -> NonEmpty (m Doc)
    forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
    for List1 QName
    ds ((QName -> m Doc) -> NonEmpty (m Doc))
    -> (QName -> m Doc) -> NonEmpty (m Doc)
    forall a b. (a -> b) -> a -> b
    $ \ QName
    d -> do
                t <- QName -> m Type
    forall (m :: * -> *).
    (HasConstInfo m, ReadTCState m) =>
    QName -> m Type
    typeOfConst QName
    d
                text "-" <+> nest 2 (nameRaw <+> text ":" <+> prettyTCM t)
            ]

        AmbiguousConstructor QName
    c List2 QName
    disambs -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat
          [ m Doc
    "Ambiguous constructor " m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> Name -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty (QName -> Name
    qnameName QName
    c) m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    "."
          , m Doc
    "It could refer to any of"
          , Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ List2 (m Doc) -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat (List2 (m Doc) -> m Doc) -> List2 (m Doc) -> m Doc
    forall a b. (a -> b) -> a -> b
    $ (QName -> m Doc) -> List2 QName -> List2 (m Doc)
    forall a b. (a -> b) -> List2 a -> List2 b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap QName -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyDisambCons List2 QName
    disambs
          ]

        InvalidFileName AbsolutePath
    file InvalidFileNameReason
    reason -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "The file name" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [AbsolutePath -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty AbsolutePath
    file] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "is invalid because" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          case InvalidFileNameReason
    reason of
            InvalidFileNameReason
    DoesNotCorrespondToValidModuleName ->
              String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "it does not correspond to a valid module name."
            RootNameModuleNotAQualifiedModuleName Text
    defaultName ->
              Text -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty Text
    defaultName m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "is not an unqualified module name."

        ModuleDefinedInOtherFile TopLevelModuleName
    mod AbsolutePath
    file AbsolutePath
    file' -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
          [ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "You tried to load"
          , [ String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (AbsolutePath -> String
    filePath AbsolutePath
    file) ]
          , if TopLevelModuleName -> Bool
    forall range. TopLevelModuleName' range -> Bool
    moduleNameInferred TopLevelModuleName
    mod
              then String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "which seems to define the module"
              else String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "which defines the module"
          , [ TopLevelModuleName -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty TopLevelModuleName
    mod m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    "." ]
          , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "However, according to the include path this module should be defined in"
          , [ String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (AbsolutePath -> String
    filePath AbsolutePath
    file') ]
            -- Andreas, 2025-06-21, issue #7953:
            -- We have no test that triggers this hint, not sure it can be triggered at all.
          , if TopLevelModuleName -> Bool
    forall range. TopLevelModuleName' range -> Bool
    moduleNameInferred TopLevelModuleName
    mod then String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "(Hint: no module header was found in this file; adding one might fix this error.)"
            else [m Doc]
    forall a. Null a => a
    empty
          ]

        ModuleNameUnexpected TopLevelModuleName
    given TopLevelModuleName
    expected
          | Doc -> CI String
    forall {a}. Doc a -> CI String
    canon Doc
    dGiven CI String -> CI String -> Bool
    forall a. Eq a => a -> a -> Bool
    == Doc -> CI String
    forall {a}. Doc a -> CI String
    canon Doc
    dExpected -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
              [ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Case mismatch between the actual module name"
              , [ Doc -> m Doc
    forall a. a -> m a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Doc
    dGiven ]
              , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "and the expected module name"
              , [ Doc -> m Doc
    forall a. a -> m a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Doc
    dExpected ]
              ]
          | Bool
    otherwise -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
              [ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "The name of the top level module does not match the file name. The module"
              , [ Doc -> m Doc
    forall a. a -> m a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Doc
    dGiven ]
              , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "should probably be named"
              , [ Doc -> m Doc
    forall a. a -> m a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Doc
    dExpected ]
              ]
          where
          canon :: Doc a -> CI String
    canon = String -> CI String
    forall s. FoldCase s => s -> CI s
    CaseInsens.mk (String -> CI String) -> (Doc a -> String) -> Doc a -> CI String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Doc a -> String
    forall a. Doc a -> String
    P.render
          dGiven :: Doc
    dGiven    = TopLevelModuleName -> Doc
    forall a. Pretty a => a -> Doc
    P.pretty TopLevelModuleName
    given
          dExpected :: Doc
    dExpected = TopLevelModuleName -> Doc
    forall a. Pretty a => a -> Doc
    P.pretty TopLevelModuleName
    expected

        ModuleNameHashCollision RawTopLevelModuleName
    raw Maybe RawTopLevelModuleName
    raw' -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ case Maybe RawTopLevelModuleName
    raw' of
          Maybe RawTopLevelModuleName
    Nothing ->
            String
    "The module name " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ RawTopLevelModuleName -> String
    forall a. Pretty a => a -> String
    prettyShow RawTopLevelModuleName
    raw String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    " has a reserved " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++
            String
    "hash (you may want to consider renaming the module with this name)"
          Just RawTopLevelModuleName
    raw' ->
            String
    "Module name hash collision for " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ RawTopLevelModuleName -> String
    forall a. Pretty a => a -> String
    prettyShow RawTopLevelModuleName
    raw String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++
            String
    " and " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ RawTopLevelModuleName -> String
    forall a. Pretty a => a -> String
    prettyShow RawTopLevelModuleName
    raw' String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    " (you may want to consider " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++
            String
    "renaming one of these modules)"

        ModuleNameDoesntMatchFileName TopLevelModuleName
    given [AbsolutePath]
    files -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat
          [ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
            [ [ m Doc
    "The" ]
            , [ m Doc
    "inferred" | TopLevelModuleName -> Bool
    forall range. TopLevelModuleName' range -> Bool
    moduleNameInferred TopLevelModuleName
    given ]
            , [ m Doc
    "name" ]
            , [ m Doc
    "`" m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> TopLevelModuleName -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty TopLevelModuleName
    given m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    "`"]
            , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "of the top level module"
            , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "does not match the file name."
            , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "A such named module should be defined in one of the following files:"
            ]
          , Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 ([m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ (AbsolutePath -> m Doc) -> [AbsolutePath] -> [m Doc]
    forall a b. (a -> b) -> [a] -> [b]
    map (String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (String -> m Doc)
    -> (AbsolutePath -> String) -> AbsolutePath -> m Doc
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . AbsolutePath -> String
    filePath) [AbsolutePath]
    files)
          , if TopLevelModuleName -> Bool
    forall range. TopLevelModuleName' range -> Bool
    moduleNameInferred TopLevelModuleName
    given then [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
              String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "(Hint: no module header was found in this file; adding one might fix this error.)"
            else m Doc
    forall a. Null a => a
    empty
          ]

        AbstractConstructorNotInScope QName
    q -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          [ m Doc
    "Constructor"
          , QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    q
          ] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "is abstract, thus, not in scope here"

        TypeError
    BothWithAndRHS -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Unexpected right hand side"

        CopatternHeadNotProjection QName
    x -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
          [ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Head of copattern needs to be a projection, but"
          , [ QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    x ]
          , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "isn't one"
          ]

        NotAllowedInDotPatterns NotAllowedInDotPatterns
    what -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ NotAllowedInDotPatterns -> [m Doc]
    verb NotAllowedInDotPatterns
    what [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "are not allowed in dot patterns"
          where
          verb :: NotAllowedInDotPatterns -> [m Doc]
    verb = \case
            NotAllowedInDotPatterns
    LetExpressions -> String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Let expressions"
            NotAllowedInDotPatterns
    PatternLambdas -> String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Pattern lambdas"

        NotInScope QName
    x ->
          -- using the warning version to avoid code duplication
          Warning -> m Doc
    forall (m :: * -> *). MonadPretty m => Warning -> m Doc
    prettyWarning (Warning -> m Doc) -> Warning -> m Doc
    forall a b. (a -> b) -> a -> b
    $ QName -> Warning
    NotInScopeW QName
    x

        NoSuchModule QName
    x -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "No module" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [QName -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty QName
    x] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "in scope"

        AmbiguousName QName
    x AmbiguousNameReason
    reason -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat
          [ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Ambiguous name" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [QName -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty QName
    x m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    "."] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
                   String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "It could refer to any one of"
          , Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ List2 (m Doc) -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat (List2 (m Doc) -> m Doc) -> List2 (m Doc) -> m Doc
    forall a b. (a -> b) -> a -> b
    $ (QName -> m Doc) -> List2 QName -> List2 (m Doc)
    forall a b. (a -> b) -> List2 a -> List2 b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap QName -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    nameWithBinding (List2 QName -> List2 (m Doc)) -> List2 QName -> List2 (m Doc)
    forall a b. (a -> b) -> a -> b
    $ AmbiguousNameReason -> List2 QName
    ambiguousNamesInReason AmbiguousNameReason
    reason
          , WhyInScopeData -> m Doc
    forall (m :: * -> *). MonadPretty m => WhyInScopeData -> m Doc
    explainWhyInScope (WhyInScopeData -> m Doc) -> WhyInScopeData -> m Doc
    forall a b. (a -> b) -> a -> b
    $ QName -> AmbiguousNameReason -> WhyInScopeData
    whyInScopeDataFromAmbiguousNameReason QName
    x AmbiguousNameReason
    reason
          ]

        AmbiguousModule QName
    x List1 ModuleName
    ys -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat
          [ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Ambiguous module name" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [QName -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty QName
    x m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    "."] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
                   String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "It could refer to any one of"
          , Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ NonEmpty (m Doc) -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat (NonEmpty (m Doc) -> m Doc) -> NonEmpty (m Doc) -> m Doc
    forall a b. (a -> b) -> a -> b
    $ (ModuleName -> m Doc) -> List1 ModuleName -> NonEmpty (m Doc)
    forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap MonadPretty m => ModuleName -> m Doc
    ModuleName -> m Doc
    help List1 ModuleName
    ys
          , String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "(hint: Use C-c C-w (in Emacs) if you want to know why)"
          ]
          where
            help :: MonadPretty m => ModuleName -> m Doc
            help :: MonadPretty m => ModuleName -> m Doc
    help ModuleName
    m = do
              anno <- m (Maybe DataOrRecordModule)
    -> m (m Doc) -> (DataOrRecordModule -> m (m Doc)) -> m (m Doc)
    forall (m :: * -> *) a b.
    Monad m =>
    m (Maybe a) -> m b -> (a -> m b) -> m b
    caseMaybeM (ModuleName -> m (Maybe DataOrRecordModule)
    forall (m :: * -> *).
    ReadTCState m =>
    ModuleName -> m (Maybe DataOrRecordModule)
    isDatatypeModule ModuleName
    m) (m Doc -> m (m Doc)
    forall a. a -> m a
    forall (m :: * -> *) a. Monad m => a -> m a
    return m Doc
    forall a. Null a => a
    empty) ((DataOrRecordModule -> m (m Doc)) -> m (m Doc))
    -> (DataOrRecordModule -> m (m Doc)) -> m (m Doc)
    forall a b. (a -> b) -> a -> b
    $ \case
                DataOrRecordModule
    IsDataModule   -> m Doc -> m (m Doc)
    forall a. a -> m a
    forall (m :: * -> *) a. Monad m => a -> m a
    return (m Doc -> m (m Doc)) -> m Doc -> m (m Doc)
    forall a b. (a -> b) -> a -> b
    $ m Doc
    "(datatype module)"
                DataOrRecordModule
    IsRecordModule -> m Doc -> m (m Doc)
    forall a. a -> m a
    forall (m :: * -> *) a. Monad m => a -> m a
    return (m Doc -> m (m Doc)) -> m Doc -> m (m Doc)
    forall a b. (a -> b) -> a -> b
    $ m Doc
    "(record module)"
              sep [prettyTCM m, anno ]

        AmbiguousField Name
    field List2 ModuleName
    modules -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    hsep [ m Doc
    "Ambiguity: the field", Name -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Name -> m Doc
    prettyTCM Name
    field, m Doc
    "appears in the following modules:" ]
          m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : (ModuleName -> m Doc) -> [ModuleName] -> [m Doc]
    forall a b. (a -> b) -> [a] -> [b]
    map ModuleName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => ModuleName -> m Doc
    prettyTCM (List2 ModuleName -> [Item (List2 ModuleName)]
    forall l. IsList l => l -> [Item l]
    List2.toList List2 ModuleName
    modules)

        ClashingDefinition QName
    x QName
    y Maybe NiceDeclaration
    suggestion -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Multiple definitions of" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [QName -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty QName
    x m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    "."] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Previous definition at"
          [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Range -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Range -> m Doc
    prettyTCM (Range -> m Doc) -> Range -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Name -> Range
    nameBindingSite (Name -> Range) -> Name -> Range
    forall a b. (a -> b) -> a -> b
    $ QName -> Name
    qnameName QName
    y] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          Maybe NiceDeclaration
    -> [m Doc] -> (NiceDeclaration -> [m Doc]) -> [m Doc]
    forall a b. Maybe a -> b -> (a -> b) -> b
    caseMaybe Maybe NiceDeclaration
    suggestion [] (\NiceDeclaration
    d ->
            [  m Doc
    "Perhaps you meant to write "
            m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    $$ Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (m Doc
    "'" m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> List1 Declaration -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty (NiceDeclaration -> List1 Declaration
    notSoNiceDeclarations NiceDeclaration
    d) m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    "'")
            m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    $$ (m Doc
    "at" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> (Range -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty (Range -> m Doc) -> (TCEnv -> Range) -> TCEnv -> m Doc
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . TCEnv -> Range
    envRange (TCEnv -> m Doc) -> m TCEnv -> m Doc
    forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
    =<< m TCEnv
    forall (m :: * -> *). MonadTCEnv m => m TCEnv
    askTC)) m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    "?"
            m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    $$ m Doc
    "In data definitions separate from data declaration, the ':' and type must be omitted."
            ])

        ClashingModule ModuleName
    m1 ModuleName
    m2 -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "The modules" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [ModuleName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => ModuleName -> m Doc
    prettyTCM ModuleName
    m1, m Doc
    "and", ModuleName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => ModuleName -> m Doc
    prettyTCM ModuleName
    m2]
          [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "clash."

        DuplicateImports QName
    m List1 ImportedName
    xs -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Ambiguous imports from module" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [QName -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty QName
    m] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "for" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          m Doc -> NonEmpty (m Doc) -> [m Doc]
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Semigroup (m Doc), Foldable t) =>
    m Doc -> t (m Doc) -> [m Doc]
    punctuate m Doc
    forall (m :: * -> *). Applicative m => m Doc
    comma ((ImportedName -> m Doc) -> List1 ImportedName -> NonEmpty (m Doc)
    forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap ImportedName -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty List1 ImportedName
    xs)

        DefinitionInDifferentModule QName
    _x -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Definition in different module than its type signature"

        TypeError
    FieldOutsideRecord -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Field appearing outside record declaration."

        TypeError
    PrivateRecordField -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "Record fields cannot be private"

        InvalidPattern Pattern
    p -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          Pattern -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty Pattern
    p m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "is not a valid pattern"

        InvalidPun ConstructorOrPatternSynonym
    kind QName
    x -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
          [ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "A pun must not use the"
          , [ Doc -> m Doc
    forall a. a -> m a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (Doc -> m Doc) -> Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ ConstructorOrPatternSynonym -> Doc
    forall a. Pretty a => a -> Doc
    P.pretty ConstructorOrPatternSynonym
    kind ]
          , [ QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    x ]
          ]

        RepeatedVariablesInPattern List1 Name
    xs -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Repeated variables in pattern:" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ (Name -> m Doc) -> [Name] -> [m Doc]
    forall a b. (a -> b) -> [a] -> [b]
    map Name -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty (List1 Name -> [Item (List1 Name)]
    forall l. IsList l => l -> [Item l]
    List1.toList List1 Name
    xs)

        RepeatedNamesInImportDirective List1 (List2 ImportedName)
    yss -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep
          [ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
             [ [ m Doc
    "Repeated" , List1 (List2 ImportedName) -> m Doc -> m Doc
    forall (m :: * -> *) a. (Functor m, Sized a) => a -> m Doc -> m Doc
    pluralS List1 (List2 ImportedName)
    yss m Doc
    "name" ]
             , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "in import directive:"
             ]
          , [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ m Doc -> NonEmpty (m Doc) -> [m Doc]
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Semigroup (m Doc), Foldable t) =>
    m Doc -> t (m Doc) -> [m Doc]
    punctuate m Doc
    forall (m :: * -> *). Applicative m => m Doc
    comma (NonEmpty (m Doc) -> [m Doc]) -> NonEmpty (m Doc) -> [m Doc]
    forall a b. (a -> b) -> a -> b
    $ (List2 ImportedName -> m Doc)
    -> List1 (List2 ImportedName) -> NonEmpty (m Doc)
    forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap (ImportedName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => ImportedName -> m Doc
    prettyTCM (ImportedName -> m Doc)
    -> (List2 ImportedName -> ImportedName)
    -> List2 ImportedName
    -> m Doc
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . List2 ImportedName -> ImportedName
    forall a. List2 a -> a
    List2.head) List1 (List2 ImportedName)
    yss
          ]

        TypeError
    DeclarationsAfterTopLevelModule -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String
    "No declarations allowed after top-level module."

        TypeError
    IllegalDeclarationBeforeTopLevelModule -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String
    "Illegal declaration(s) before top-level module"

        MissingTypeSignature MissingTypeSignatureInfo
    info -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "Missing type signature for" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> MissingTypeSignatureInfo -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *).
    MonadPretty m =>
    MissingTypeSignatureInfo -> m Doc
    prettyTCM MissingTypeSignatureInfo
    info

        NotAnExpression Expr
    e -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          Expr -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty Expr
    e m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "is not a valid expression."

        NotAValidLetBinding Maybe NotAValidLetBinding
    Nothing -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String
    "Not a valid let binding"
        NotAValidLetBinding (Just NotAValidLetBinding
    err) -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ NotAValidLetBinding -> String
    verbalizeNotAValidLetBinding NotAValidLetBinding
    err

        NotAValidLetExpression NotAValidLetExpression
    err -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ NotAValidLetExpression -> String
    verbalizeNotAValidLetExpression NotAValidLetExpression
    err

        NotValidBeforeField NiceDeclaration
    nd -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String
    "This declaration is illegal in a record before the last field"

        NoParseForApplication List2 Expr
    es -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep (
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Could not parse the application" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Expr -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty (Expr -> m Doc) -> Expr -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Range -> List2 Expr -> Expr
    C.RawApp Range
    forall a. Range' a
    noRange List2 Expr
    es])

        AmbiguousParseForApplication List2 Expr
    es List1 Expr
    es' -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep (
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Don't know how to parse" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [m Doc
    MonadPretty m => m Doc
    pretty_es m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    "."] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Could mean any one of:"
          ) m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    $$ Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (NonEmpty (m Doc) -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat (NonEmpty (m Doc) -> m Doc) -> NonEmpty (m Doc) -> m Doc
    forall a b. (a -> b) -> a -> b
    $ (Expr -> m Doc) -> List1 Expr -> NonEmpty (m Doc)
    forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap MonadPretty m => Expr -> m Doc
    Expr -> m Doc
    pretty' List1 Expr
    es')
          where
            pretty_es :: MonadPretty m => m Doc
            pretty_es :: MonadPretty m => m Doc
    pretty_es = Expr -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty (Expr -> m Doc) -> Expr -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Range -> List2 Expr -> Expr
    C.RawApp Range
    forall a. Range' a
    noRange List2 Expr
    es

            pretty' :: MonadPretty m => C.Expr -> m Doc
            pretty' :: MonadPretty m => Expr -> m Doc
    pretty' Expr
    e = do
              p1 <- m Doc
    MonadPretty m => m Doc
    pretty_es
              p2 <- pretty e
              if render p1 == render p2 then unambiguous e else return p2

            unambiguous :: MonadPretty m => C.Expr -> m Doc
            unambiguous :: MonadPretty m => Expr -> m Doc
    unambiguous e :: Expr
    e@(C.OpApp Range
    r QName
    op Set1 Name
    _ OpAppArgs
    xs)
              | (NamedArg (MaybePlaceholder (OpApp Expr)) -> Bool)
    -> OpAppArgs -> Bool
    forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
    all (MaybePlaceholder (OpApp Expr) -> Bool
    forall e. MaybePlaceholder (OpApp e) -> Bool
    isOrdinary (MaybePlaceholder (OpApp Expr) -> Bool)
    -> (NamedArg (MaybePlaceholder (OpApp Expr))
        -> MaybePlaceholder (OpApp Expr))
    -> NamedArg (MaybePlaceholder (OpApp Expr))
    -> Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . NamedArg (MaybePlaceholder (OpApp Expr))
    -> MaybePlaceholder (OpApp Expr)
    forall a. NamedArg a -> a
    namedArg) OpAppArgs
    xs =
                Expr -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty (Expr -> m Doc) -> Expr -> m Doc
    forall a b. (a -> b) -> a -> b
    $
                  (Expr -> NamedArg Expr -> Expr)
    -> Expr -> NonEmpty (NamedArg Expr) -> Expr
    forall b a. (b -> a -> b) -> b -> NonEmpty a -> b
    forall (t :: * -> *) b a.
    Foldable t =>
    (b -> a -> b) -> b -> t a -> b
    foldl (Range -> Expr -> NamedArg Expr -> Expr
    C.App Range
    r) (QName -> Expr
    C.Ident QName
    op) (NonEmpty (NamedArg Expr) -> Expr)
    -> NonEmpty (NamedArg Expr) -> Expr
    forall a b. (a -> b) -> a -> b
    $
                    ((NamedArg (MaybePlaceholder (OpApp Expr)) -> NamedArg Expr)
    -> OpAppArgs -> NonEmpty (NamedArg Expr)
    forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap ((NamedArg (MaybePlaceholder (OpApp Expr)) -> NamedArg Expr)
     -> OpAppArgs -> NonEmpty (NamedArg Expr))
    -> ((MaybePlaceholder (OpApp Expr) -> Expr)
        -> NamedArg (MaybePlaceholder (OpApp Expr)) -> NamedArg Expr)
    -> (MaybePlaceholder (OpApp Expr) -> Expr)
    -> OpAppArgs
    -> NonEmpty (NamedArg Expr)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Named NamedName (MaybePlaceholder (OpApp Expr))
     -> Named NamedName Expr)
    -> NamedArg (MaybePlaceholder (OpApp Expr)) -> NamedArg Expr
    forall a b. (a -> b) -> Arg a -> Arg b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap ((Named NamedName (MaybePlaceholder (OpApp Expr))
      -> Named NamedName Expr)
     -> NamedArg (MaybePlaceholder (OpApp Expr)) -> NamedArg Expr)
    -> ((MaybePlaceholder (OpApp Expr) -> Expr)
        -> Named NamedName (MaybePlaceholder (OpApp Expr))
        -> Named NamedName Expr)
    -> (MaybePlaceholder (OpApp Expr) -> Expr)
    -> NamedArg (MaybePlaceholder (OpApp Expr))
    -> NamedArg Expr
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (MaybePlaceholder (OpApp Expr) -> Expr)
    -> Named NamedName (MaybePlaceholder (OpApp Expr))
    -> Named NamedName Expr
    forall a b. (a -> b) -> Named NamedName a -> Named NamedName b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap) MaybePlaceholder (OpApp Expr) -> Expr
    forall e. MaybePlaceholder (OpApp e) -> e
    fromOrdinary OpAppArgs
    xs
              | (NamedArg (MaybePlaceholder (OpApp Expr)) -> Bool)
    -> OpAppArgs -> Bool
    forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
    any (MaybePlaceholder (OpApp Expr) -> Bool
    forall a. MaybePlaceholder a -> Bool
    isPlaceholder (MaybePlaceholder (OpApp Expr) -> Bool)
    -> (NamedArg (MaybePlaceholder (OpApp Expr))
        -> MaybePlaceholder (OpApp Expr))
    -> NamedArg (MaybePlaceholder (OpApp Expr))
    -> Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . NamedArg (MaybePlaceholder (OpApp Expr))
    -> MaybePlaceholder (OpApp Expr)
    forall a. NamedArg a -> a
    namedArg) OpAppArgs
    xs =
                  Expr -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty Expr
    e m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> m Doc
    "(section)"
            unambiguous Expr
    e = Expr -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty Expr
    e

            isOrdinary :: MaybePlaceholder (C.OpApp e) -> Bool
            isOrdinary :: forall e. MaybePlaceholder (OpApp e) -> Bool
    isOrdinary (NoPlaceholder Maybe PositionInName
    _ (C.Ordinary e
    _)) = Bool
    True
            isOrdinary MaybePlaceholder (OpApp e)
    _                                = Bool
    False

            fromOrdinary :: MaybePlaceholder (C.OpApp e) -> e
            fromOrdinary :: forall e. MaybePlaceholder (OpApp e) -> e
    fromOrdinary (NoPlaceholder Maybe PositionInName
    _ (C.Ordinary e
    e)) = e
    e
            fromOrdinary MaybePlaceholder (OpApp e)
    _                                = e
    forall a. HasCallStack => a
    __IMPOSSIBLE__

            isPlaceholder :: MaybePlaceholder a -> Bool
            isPlaceholder :: forall a. MaybePlaceholder a -> Bool
    isPlaceholder Placeholder{}   = Bool
    True
            isPlaceholder NoPlaceholder{} = Bool
    False

        TypeError
    AsPatternInPatternSynonym -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "@-patterns are not allowed in pattern synonyms"

        TypeError
    DotPatternInPatternSynonym -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords
          String
    "Dot or equality patterns are not allowed in pattern synonyms. Maybe use '_' instead."

        BadArgumentsToPatternSynonym AmbiguousQName
    x -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Bad arguments to pattern synonym " [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM (QName -> m Doc) -> QName -> m Doc
    forall a b. (a -> b) -> a -> b
    $ AmbiguousQName -> QName
    headAmbQ AmbiguousQName
    x]

        TooFewArgumentsToPatternSynonym AmbiguousQName
    x -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Too few arguments to pattern synonym " [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM (QName -> m Doc) -> QName -> m Doc
    forall a b. (a -> b) -> a -> b
    $ AmbiguousQName -> QName
    headAmbQ AmbiguousQName
    x]

        CannotResolveAmbiguousPatternSynonym List1 (QName, PatternSynDefn)
    defs -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat
          [ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Cannot resolve overloaded pattern synonym" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    x m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    forall (m :: * -> *). Applicative m => m Doc
    comma] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
                   String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "since candidates have different shapes:"
          , Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ NonEmpty (m Doc) -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat (NonEmpty (m Doc) -> m Doc) -> NonEmpty (m Doc) -> m Doc
    forall a b. (a -> b) -> a -> b
    $ ((QName, PatternSynDefn) -> m Doc)
    -> List1 (QName, PatternSynDefn) -> NonEmpty (m Doc)
    forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap (QName, PatternSynDefn) -> m Doc
    forall {m :: * -> *}.
    (MonadFresh NameId m, MonadInteractionPoints m,
     MonadStConcreteNames m, PureTCM m, IsString (m Doc), Null (m Doc),
     Semigroup (m Doc)) =>
    (QName, PatternSynDefn) -> m Doc
    prDef List1 (QName, PatternSynDefn)
    defs
          , [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "(hint: overloaded pattern synonyms must be equal up to variable and constructor names)"
          ]
          where
            (QName
    x, PatternSynDefn
    _) = List1 (QName, PatternSynDefn) -> (QName, PatternSynDefn)
    forall a. NonEmpty a -> a
    List1.head List1 (QName, PatternSynDefn)
    defs
            prDef :: (QName, PatternSynDefn) -> m Doc
    prDef (QName
    x, ([WithHiding Name]
    xs, Pattern' Void
    p)) = Declaration -> m Doc
    forall a (m :: * -> *).
    (ToConcrete a, Pretty (ConOfAbs a), MonadAbsToCon m) =>
    a -> m Doc
    prettyA (QName -> [WithHiding BindName] -> Pattern' Void -> Declaration
    A.PatternSynDef QName
    x ((WithHiding Name -> WithHiding BindName)
    -> [WithHiding Name] -> [WithHiding BindName]
    forall a b. (a -> b) -> [a] -> [b]
    map ((Name -> BindName) -> WithHiding Name -> WithHiding BindName
    forall a b. (a -> b) -> WithHiding a -> WithHiding b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Name -> BindName
    BindName) [WithHiding Name]
    xs) Pattern' Void
    p) m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <?> (m Doc
    "at" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> Range -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty Range
    r)
              where r :: Range
    r = Name -> Range
    nameBindingSite (Name -> Range) -> Name -> Range
    forall a b. (a -> b) -> a -> b
    $ QName -> Name
    qnameName QName
    x

        IllegalInstanceVariableInPatternSynonym Name
    x -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
          [ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Variable is bound as instance in pattern synonym,"
          , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "but does not resolve as instance in pattern: "
          , [Name -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty Name
    x]
          ]

        PatternSynonymArgumentShadows ConstructorOrPatternSynonym
    kind Name
    x (AbstractName
    y :| [AbstractName]
    _ys) -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat
          [ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
            [ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Pattern synonym variable"
            , [ Name -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty Name
    x ]
            , [ m Doc
    "shadows" ]
            , [ ConstructorOrPatternSynonym -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty ConstructorOrPatternSynonym
    kind ]
            , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "defined at:"
            ]
          , Range -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty (Range -> m Doc) -> Range -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Name -> Range
    nameBindingSite (Name -> Range) -> Name -> Range
    forall a b. (a -> b) -> a -> b
    $ QName -> Name
    qnameName (QName -> Name) -> QName -> Name
    forall a b. (a -> b) -> a -> b
    $ AbstractName -> QName
    anameName AbstractName
    y
          ]

        UnusedVariableInPatternSynonym Name
    x -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Unused variable in pattern synonym: " [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Name -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty Name
    x]

        UnboundVariablesInPatternSynonym List1 Name
    xs -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Unbound variables in pattern synonym: " [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          [NonEmpty (m Doc) -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    sep ((Name -> m Doc) -> List1 Name -> NonEmpty (m Doc)
    forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Name -> m Doc
    forall a (m :: * -> *).
    (ToConcrete a, Pretty (ConOfAbs a), MonadAbsToCon m) =>
    a -> m Doc
    prettyA List1 Name
    xs)]

        NoParseForLHS LHSOrPatSyn
    lhsOrPatSyn [Pattern]
    errs Pattern
    p -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat
          [ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Could not parse the" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [m Doc]
    prettyLhsOrPatSyn [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Pattern -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty Pattern
    p]
          , m Doc
    prettyErrs
          ]
          where
          prettyLhsOrPatSyn :: [m Doc]
    prettyLhsOrPatSyn = String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords (String -> [m Doc]) -> String -> [m Doc]
    forall a b. (a -> b) -> a -> b
    $ case LHSOrPatSyn
    lhsOrPatSyn of
            LHSOrPatSyn
    IsLHS    -> String
    "left-hand side"
            LHSOrPatSyn
    IsPatSyn -> String
    "pattern synonym right-hand side"
          prettyErrs :: m Doc
    prettyErrs = case [Pattern]
    errs of
            []     -> m Doc
    forall a. Null a => a
    empty
            Pattern
    p0 : [Pattern]
    _ -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Problematic expression:" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Pattern -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty Pattern
    p0]

        AmbiguousParseForLHS LHSOrPatSyn
    lhsOrPatSyn Pattern
    p List2 Pattern
    ps -> do
          d <- Pattern -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty Pattern
    p
          vcat $
            [ fsep $
                pwords "Don't know how to parse" ++ [pure d <> "."] ++
                pwords "Could mean any one of:"
            ]
              ++
            map (nest 2 . pretty' d) (List2.toList ps)
          where
            pretty' :: MonadPretty m => Doc -> C.Pattern -> m Doc
            pretty' :: MonadPretty m => Doc -> Pattern -> m Doc
    pretty' Doc
    d1 Pattern
    p' = do
              d2 <- Pattern -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty Pattern
    p'
              if render d1 == render d2 then pretty $ unambiguousP p' else return d2

            -- the entire pattern is shown, not just the ambiguous part,
            -- so we need to dig in order to find the OpAppP's.
            unambiguousP :: C.Pattern -> C.Pattern
            unambiguousP :: Pattern -> Pattern
    unambiguousP (C.AppP Pattern
    x Arg (Named NamedName Pattern)
    y)         = Pattern -> Arg (Named NamedName Pattern) -> Pattern
    C.AppP (Pattern -> Pattern
    unambiguousP Pattern
    x) (Arg (Named NamedName Pattern) -> Pattern)
    -> Arg (Named NamedName Pattern) -> Pattern
    forall a b. (a -> b) -> a -> b
    $ ((Named NamedName Pattern -> Named NamedName Pattern)
    -> Arg (Named NamedName Pattern) -> Arg (Named NamedName Pattern)
    forall a b. (a -> b) -> Arg a -> Arg b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap((Named NamedName Pattern -> Named NamedName Pattern)
     -> Arg (Named NamedName Pattern) -> Arg (Named NamedName Pattern))
    -> ((Pattern -> Pattern)
        -> Named NamedName Pattern -> Named NamedName Pattern)
    -> (Pattern -> Pattern)
    -> Arg (Named NamedName Pattern)
    -> Arg (Named NamedName Pattern)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    .(Pattern -> Pattern)
    -> Named NamedName Pattern -> Named NamedName Pattern
    forall a b. (a -> b) -> Named NamedName a -> Named NamedName b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap) Pattern -> Pattern
    unambiguousP Arg (Named NamedName Pattern)
    y
            unambiguousP (C.HiddenP Range
    r Named NamedName Pattern
    x)      = Range -> Named NamedName Pattern -> Pattern
    C.HiddenP Range
    r (Named NamedName Pattern -> Pattern)
    -> Named NamedName Pattern -> Pattern
    forall a b. (a -> b) -> a -> b
    $ (Pattern -> Pattern)
    -> Named NamedName Pattern -> Named NamedName Pattern
    forall a b. (a -> b) -> Named NamedName a -> Named NamedName b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Pattern -> Pattern
    unambiguousP Named NamedName Pattern
    x
            unambiguousP (C.InstanceP Range
    r Named NamedName Pattern
    x)    = Range -> Named NamedName Pattern -> Pattern
    C.InstanceP Range
    r (Named NamedName Pattern -> Pattern)
    -> Named NamedName Pattern -> Pattern
    forall a b. (a -> b) -> a -> b
    $ (Pattern -> Pattern)
    -> Named NamedName Pattern -> Named NamedName Pattern
    forall a b. (a -> b) -> Named NamedName a -> Named NamedName b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Pattern -> Pattern
    unambiguousP Named NamedName Pattern
    x
            unambiguousP (C.ParenP Range
    r Pattern
    x)       = Range -> Pattern -> Pattern
    C.ParenP Range
    r (Pattern -> Pattern) -> Pattern -> Pattern
    forall a b. (a -> b) -> a -> b
    $ Pattern -> Pattern
    unambiguousP Pattern
    x
            unambiguousP (C.AsP Range
    r Name
    n Pattern
    x)        = Range -> Name -> Pattern -> Pattern
    C.AsP Range
    r Name
    n (Pattern -> Pattern) -> Pattern -> Pattern
    forall a b. (a -> b) -> a -> b
    $ Pattern -> Pattern
    unambiguousP Pattern
    x
            unambiguousP (C.OpAppP Range
    r QName
    op Set1 Name
    _ List1 (Arg (Named NamedName Pattern))
    xs) = (Pattern -> Arg (Named NamedName Pattern) -> Pattern)
    -> Pattern -> List1 (Arg (Named NamedName Pattern)) -> Pattern
    forall b a. (b -> a -> b) -> b -> NonEmpty a -> b
    forall (t :: * -> *) b a.
    Foldable t =>
    (b -> a -> b) -> b -> t a -> b
    foldl Pattern -> Arg (Named NamedName Pattern) -> Pattern
    C.AppP (Bool -> QName -> Pattern
    C.IdentP Bool
    True QName
    op) List1 (Arg (Named NamedName Pattern))
    xs
            unambiguousP Pattern
    e                    = Pattern
    e

        OperatorInformation [NotationSection]
    sects TypeError
    err ->
          TypeError -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => TypeError -> m Doc
    prettyTCM TypeError
    err
            m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    $+$
          [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep (String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Operators used in the grammar:")
            m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    $$
          Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2
            (if [NotationSection] -> Bool
    forall a. Null a => a -> Bool
    null [NotationSection]
    sects then m Doc
    "None" else
             [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat ((String -> m Doc) -> [String] -> [m Doc]
    forall a b. (a -> b) -> [a] -> [b]
    map String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text ([String] -> [m Doc]) -> [String] -> [m Doc]
    forall a b. (a -> b) -> a -> b
    $
                   String -> [String]
    lines (String -> [String]) -> String -> [String]
    forall a b. (a -> b) -> a -> b
    $
                   Box -> String
    Boxes.render (Box -> String) -> Box -> String
    forall a b. (a -> b) -> a -> b
    $
                   (\([Box]
    col1, [Box]
    col2, [Box]
    col3) ->
                       Int -> Alignment -> [Box] -> Box
    forall (f :: * -> *).
    Foldable f =>
    Int -> Alignment -> f Box -> Box
    Boxes.hsep Int
    1 Alignment
    Boxes.top ([Box] -> Box) -> [Box] -> Box
    forall a b. (a -> b) -> a -> b
    $
                       ([Box] -> Box) -> [[Box]] -> [Box]
    forall a b. (a -> b) -> [a] -> [b]
    map (Alignment -> [Box] -> Box
    forall (f :: * -> *). Foldable f => Alignment -> f Box -> Box
    Boxes.vcat Alignment
    Boxes.left) [[Box]
    col1, [Box]
    col2, [Box]
    col3]) (([Box], [Box], [Box]) -> Box) -> ([Box], [Box], [Box]) -> Box
    forall a b. (a -> b) -> a -> b
    $
                   [(Box, Box, Box)] -> ([Box], [Box], [Box])
    forall a b c. [(a, b, c)] -> ([a], [b], [c])
    unzip3 ([(Box, Box, Box)] -> ([Box], [Box], [Box]))
    -> [(Box, Box, Box)] -> ([Box], [Box], [Box])
    forall a b. (a -> b) -> a -> b
    $
                   (NotationSection -> (Box, Box, Box))
    -> [NotationSection] -> [(Box, Box, Box)]
    forall a b. (a -> b) -> [a] -> [b]
    map NotationSection -> (Box, Box, Box)
    prettySect ([NotationSection] -> [(Box, Box, Box)])
    -> [NotationSection] -> [(Box, Box, Box)]
    forall a b. (a -> b) -> a -> b
    $
                   (NotationSection -> NotationSection -> Ordering)
    -> [NotationSection] -> [NotationSection]
    forall a. (a -> a -> Ordering) -> [a] -> [a]
    sortBy (String -> String -> Ordering
    forall a. Ord a => a -> a -> Ordering
    compare (String -> String -> Ordering)
    -> (NotationSection -> String)
    -> NotationSection
    -> NotationSection
    -> Ordering
    forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
    `on` QName -> String
    forall a. Pretty a => a -> String
    prettyShow (QName -> String)
    -> (NotationSection -> QName) -> NotationSection -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . NewNotation -> QName
    notaName (NewNotation -> QName)
    -> (NotationSection -> NewNotation) -> NotationSection -> QName
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . NotationSection -> NewNotation
    sectNotation) ([NotationSection] -> [NotationSection])
    -> [NotationSection] -> [NotationSection]
    forall a b. (a -> b) -> a -> b
    $
                   (NotationSection -> Bool) -> [NotationSection] -> [NotationSection]
    forall a. (a -> Bool) -> [a] -> [a]
    filter (Bool -> Bool
    not (Bool -> Bool)
    -> (NotationSection -> Bool) -> NotationSection -> Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . NotationSection -> Bool
    closedWithoutHoles) [NotationSection]
    sects))
          where
          trimLeft :: [NotationPart] -> [NotationPart]
    trimLeft  = (NotationPart -> Bool) -> [NotationPart] -> [NotationPart]
    forall a. (a -> Bool) -> [a] -> [a]
    dropWhile NotationPart -> Bool
    isAHole
          trimRight :: [NotationPart] -> [NotationPart]
    trimRight = (NotationPart -> Bool) -> [NotationPart] -> [NotationPart]
    forall a. (a -> Bool) -> [a] -> [a]
    dropWhileEnd NotationPart -> Bool
    isAHole

          closedWithoutHoles :: NotationSection -> Bool
    closedWithoutHoles NotationSection
    sect =
            NotationSection -> NotationKind
    sectKind NotationSection
    sect NotationKind -> NotationKind -> Bool
    forall a. Eq a => a -> a -> Bool
    == NotationKind
    NonfixNotation
              Bool -> Bool -> Bool
    &&
            [()] -> Bool
    forall a. Null a => a -> Bool
    null [ () | HolePart{} <- [NotationPart] -> [NotationPart]
    trimLeft ([NotationPart] -> [NotationPart])
    -> [NotationPart] -> [NotationPart]
    forall a b. (a -> b) -> a -> b
    $ [NotationPart] -> [NotationPart]
    trimRight ([NotationPart] -> [NotationPart])
    -> [NotationPart] -> [NotationPart]
    forall a b. (a -> b) -> a -> b
    $
                                        NewNotation -> [NotationPart]
    notation (NotationSection -> NewNotation
    sectNotation NotationSection
    sect) ]

          prettyName :: Name -> Box
    prettyName Name
    n = String -> Box
    Boxes.text (String -> Box) -> String -> Box
    forall a b. (a -> b) -> a -> b
    $
            Doc -> String
    forall a. Doc a -> String
    P.render (Name -> Doc
    forall a. Pretty a => a -> Doc
    P.pretty Name
    n) String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++
            String
    " (" String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ Doc -> String
    forall a. Doc a -> String
    P.render (Range -> Doc
    forall a. Pretty a => a -> Doc
    P.pretty (Name -> Range
    nameBindingSite Name
    n)) String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    ")"

          prettySect :: NotationSection -> (Box, Box, Box)
    prettySect NotationSection
    sect =
            ( String -> Box
    Boxes.text (Doc -> String
    forall a. Doc a -> String
    P.render ([NotationPart] -> Doc
    forall a. Pretty a => a -> Doc
    P.pretty [NotationPart]
    section))
                Box -> Box -> Box
    Boxes.//
              Box
    strut
            , String -> Box
    Boxes.text
                (String
    "(" String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++
                 String
    kind String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    " " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++
                 (if NewNotation -> Bool
    notaIsOperator NewNotation
    nota
                  then String
    "operator"
                  else String
    "notation") String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++
                 (if NotationSection -> Bool
    sectIsSection NotationSection
    sect
                  then String
    " section"
                  else String
    "") String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++
                 (case NotationSection -> Maybe FixityLevel
    sectLevel NotationSection
    sect of
                    Maybe FixityLevel
    Nothing          -> String
    ""
                    Just FixityLevel
    Unrelated   -> String
    ", unrelated"
                    Just (Related PrecedenceLevel
    l) -> String
    ", level " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ PrecedenceLevel -> String
    toStringWithoutDotZero PrecedenceLevel
    l) String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++
                 String
    ")")
                Box -> Box -> Box
    Boxes.//
              Box
    strut
            , Box
    "["
                Box -> Box -> Box
    Boxes.<>
              Alignment -> [Box] -> Box
    forall (f :: * -> *). Foldable f => Alignment -> f Box -> Box
    Boxes.vcat Alignment
    Boxes.left
                ((Name -> Box) -> [Name] -> [Box]
    forall a b. (a -> b) -> [a] -> [b]
    map (\Name
    n -> Name -> Box
    prettyName Name
    n Box -> Box -> Box
    Boxes.<> Box
    ",") [Name]
    names [Box] -> [Box] -> [Box]
    forall a. [a] -> [a] -> [a]
    ++
                 [Name -> Box
    prettyName Name
    name Box -> Box -> Box
    Boxes.<> Box
    "]"])
            )
            where
            nota :: NewNotation
    nota    = NotationSection -> NewNotation
    sectNotation NotationSection
    sect
            section :: [NotationPart]
    section = String -> [NotationPart] -> [NotationPart]
    qualifyFirstIdPart
                        ((Name -> String -> String) -> String -> [Name] -> String
    forall a b. (a -> b -> b) -> b -> [a] -> b
    forall (t :: * -> *) a b.
    Foldable t =>
    (a -> b -> b) -> b -> t a -> b
    foldr (\Name
    x String
    s -> Name -> String
    C.nameToRawName Name
    x String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    "." String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    s)
                               String
    ""
                               (List1 Name -> [Name]
    forall a. NonEmpty a -> [a]
    List1.init (QName -> List1 Name
    C.qnameParts (NewNotation -> QName
    notaName NewNotation
    nota))))
                        ([NotationPart] -> [NotationPart]
    spacesBetweenAdjacentIds ([NotationPart] -> [NotationPart])
    -> [NotationPart] -> [NotationPart]
    forall a b. (a -> b) -> a -> b
    $
                         [NotationPart] -> [NotationPart]
    trim (NewNotation -> [NotationPart]
    notation NewNotation
    nota))

            qualifyFirstIdPart :: String -> [NotationPart] -> [NotationPart]
    qualifyFirstIdPart String
    _ []              = []
            qualifyFirstIdPart String
    q (IdPart Ranged String
    x : [NotationPart]
    ps) = Ranged String -> NotationPart
    IdPart ((String -> String) -> Ranged String -> Ranged String
    forall a b. (a -> b) -> Ranged a -> Ranged b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap (String
    q String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++) Ranged String
    x) NotationPart -> [NotationPart] -> [NotationPart]
    forall a. a -> [a] -> [a]
    : [NotationPart]
    ps
            qualifyFirstIdPart String
    q (NotationPart
    p : [NotationPart]
    ps)        = NotationPart
    p NotationPart -> [NotationPart] -> [NotationPart]
    forall a. a -> [a] -> [a]
    : String -> [NotationPart] -> [NotationPart]
    qualifyFirstIdPart String
    q [NotationPart]
    ps

            spacesBetweenAdjacentIds :: [NotationPart] -> [NotationPart]
    spacesBetweenAdjacentIds (IdPart Ranged String
    x : ps :: [NotationPart]
    ps@(IdPart Ranged String
    _ : [NotationPart]
    _)) =
              Ranged String -> NotationPart
    IdPart Ranged String
    x NotationPart -> [NotationPart] -> [NotationPart]
    forall a. a -> [a] -> [a]
    : Ranged String -> NotationPart
    IdPart (String -> Ranged String
    forall a. a -> Ranged a
    unranged String
    " ") NotationPart -> [NotationPart] -> [NotationPart]
    forall a. a -> [a] -> [a]
    : [NotationPart] -> [NotationPart]
    spacesBetweenAdjacentIds [NotationPart]
    ps
            spacesBetweenAdjacentIds (NotationPart
    p : [NotationPart]
    ps) =
              NotationPart
    p NotationPart -> [NotationPart] -> [NotationPart]
    forall a. a -> [a] -> [a]
    : [NotationPart] -> [NotationPart]
    spacesBetweenAdjacentIds [NotationPart]
    ps
            spacesBetweenAdjacentIds [] = []

            trim :: [NotationPart] -> [NotationPart]
    trim = case NotationSection -> NotationKind
    sectKind NotationSection
    sect of
              NotationKind
    InfixNotation   -> [NotationPart] -> [NotationPart]
    trimLeft ([NotationPart] -> [NotationPart])
    -> ([NotationPart] -> [NotationPart])
    -> [NotationPart]
    -> [NotationPart]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [NotationPart] -> [NotationPart]
    trimRight
              NotationKind
    PrefixNotation  -> [NotationPart] -> [NotationPart]
    trimRight
              NotationKind
    PostfixNotation -> [NotationPart] -> [NotationPart]
    trimLeft
              NotationKind
    NonfixNotation  -> [NotationPart] -> [NotationPart]
    forall a. a -> a
    id
              NotationKind
    NoNotation      -> [NotationPart] -> [NotationPart]
    forall a. HasCallStack => a
    __IMPOSSIBLE__

            ([Name]
    names, Name
    name) = List1 Name -> ([Name], Name)
    forall a. List1 a -> ([a], a)
    List1.initLast (List1 Name -> ([Name], Name)) -> List1 Name -> ([Name], Name)
    forall a b. (a -> b) -> a -> b
    $ Set1 Name -> List1 Name
    forall a. NESet a -> NonEmpty a
    Set1.toList (Set1 Name -> List1 Name) -> Set1 Name -> List1 Name
    forall a b. (a -> b) -> a -> b
    $ NewNotation -> Set1 Name
    notaNames NewNotation
    nota

            strut :: Box
    strut = Int -> Int -> Box
    Boxes.emptyBox ([Name] -> Int
    forall a. [a] -> Int
    forall (t :: * -> *) a. Foldable t => t a -> Int
    length [Name]
    names) Int
    0

            kind :: String
    kind = case NotationSection -> NotationKind
    sectKind NotationSection
    sect of
              NotationKind
    PrefixNotation  -> String
    "prefix"
              NotationKind
    PostfixNotation -> String
    "postfix"
              NotationKind
    NonfixNotation  -> String
    "closed"
              NotationKind
    NoNotation      -> String
    forall a. HasCallStack => a
    __IMPOSSIBLE__
              NotationKind
    InfixNotation   ->
                case Fixity -> Associativity
    fixityAssoc (Fixity -> Associativity) -> Fixity -> Associativity
    forall a b. (a -> b) -> a -> b
    $ NewNotation -> Fixity
    notaFixity NewNotation
    nota of
                  Associativity
    NonAssoc   -> String
    "infix"
                  Associativity
    LeftAssoc  -> String
    "infixl"
                  Associativity
    RightAssoc -> String
    "infixr"

    {- UNUSED
        AmbiguousParseForPatternSynonym p ps -> fsep (
          pwords "Don't know how to parse" ++ [pretty p <> "."] ++
          pwords "Could mean any one of:"
          ) $$ nest 2 (vcat $ map pretty ps)
    -}

    {- UNUSED
        IncompletePatternMatching v args -> fsep $
          pwords "Incomplete pattern matching for" ++ [prettyTCM v <> "."] ++
          pwords "No match for" ++ map prettyTCM args
    -}

        SplitError SplitError
    e -> SplitError -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => SplitError -> m Doc
    prettyTCM SplitError
    e

        ImpossibleConstructor QName
    c NegativeUnification
    neg -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "The case for the constructor " [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    c] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    " is impossible" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [NegativeUnification -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => NegativeUnification -> m Doc
    prettyTCM NegativeUnification
    neg] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Possible solution: remove the clause, or use an absurd pattern ()."

        TypeError
    DatatypeIndexPolarity -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Cannot annotate datatype indices with polarity other than @mixed"

        RecursiveRecordNeedsInductivity QName
    q -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
          [ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Recursive record"
          , [ QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    q ]
          , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "needs to be declared as either inductive or coinductive"
          ]

        InstanceNoCandidate Type
    t [(Term, TCErr)]
    errs -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          [ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "No instance of type" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    t] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "was found in scope."
          , [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ ((Term, TCErr) -> m Doc) -> [(Term, TCErr)] -> [m Doc]
    forall a b. (a -> b) -> [a] -> [b]
    map (Term, TCErr) -> m Doc
    forall {m :: * -> *} {a} {a}.
    (MonadFresh NameId m, MonadInteractionPoints m,
     MonadStConcreteNames m, PureTCM m, IsString (m Doc), Null (m Doc),
     Semigroup (m Doc), PrettyTCM a, PrettyTCM a) =>
    (a, a) -> m Doc
    prCand [(Term, TCErr)]
    errs ]
          where
            prCand :: (a, a) -> m Doc
    prCand (a
    term, a
    err) =
              String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text String
    "-" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+>
                [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat [ a -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => a -> m Doc
    prettyTCM a
    term m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <?> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text String
    "was ruled out because"
                     , a -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => a -> m Doc
    prettyTCM a
    err ]

        UnquoteFailed UnquoteError
    e -> UnquoteError -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => UnquoteError -> m Doc
    prettyTCM UnquoteError
    e

        DeBruijnIndexOutOfScope Int
    i Telescope
    EmptyTel [] -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
            String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords (String -> [m Doc]) -> String -> [m Doc]
    forall a b. (a -> b) -> a -> b
    $ String
    "de Bruijn index " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ Int -> String
    forall a. Show a => a -> String
    show Int
    i String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    " is not in scope in the empty context"
        DeBruijnIndexOutOfScope Int
    i Telescope
    cxt [Name]
    names ->
            [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    sep [ String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (String
    "de Bruijn index " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ Int -> String
    forall a. Show a => a -> String
    show Int
    i String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    " is not in scope in the context")
                , m Doc -> m Doc
    forall (tcm :: * -> *) a.
    (MonadTCEnv tcm, ReadTCState tcm) =>
    tcm a -> tcm a
    inTopContext (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> m Doc -> m Doc
    forall b (m :: * -> *) a.
    (AddContext b, MonadAddContext m) =>
    b -> m a -> m a
    forall (m :: * -> *) a. MonadAddContext m => String -> m a -> m a
    addContext (String
    "_" :: String) (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Telescope -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Telescope -> m Doc
    prettyTCM Telescope
    cxt' ]
          where
            cxt' :: Telescope
    cxt' = Telescope
    cxt Telescope -> Telescope -> Telescope
    forall t. Abstract t => Telescope -> t -> t
    `abstract` Int -> Telescope -> Telescope
    forall a. Subst a => Int -> a -> a
    raise (Telescope -> Int
    forall a. Sized a => a -> Int
    size Telescope
    cxt) ([Name] -> Telescope
    nameCxt [Name]
    names)
            nameCxt :: [Name] -> I.Telescope
            nameCxt :: [Name] -> Telescope
    nameCxt [] = Telescope
    forall a. Tele a
    EmptyTel
            nameCxt (Name
    x : [Name]
    xs) = Dom Type -> Abs Telescope -> Telescope
    forall a. a -> Abs (Tele a) -> Tele a
    ExtendTel (Type -> Dom Type
    forall a. a -> Dom a
    defaultDom (Sort -> Term -> Type
    forall t a. Sort' t -> a -> Type'' t a
    El Sort
    HasCallStack => Sort
    __DUMMY_SORT__ (Term -> Type) -> Term -> Type
    forall a b. (a -> b) -> a -> b
    $ Int -> Term
    I.var Int
    0)) (Abs Telescope -> Telescope) -> Abs Telescope -> Telescope
    forall a b. (a -> b) -> a -> b
    $
              String -> Telescope -> Abs Telescope
    forall a. String -> a -> Abs a
    NoAbs (Name -> String
    forall a. Pretty a => a -> String
    P.prettyShow Name
    x) (Telescope -> Abs Telescope) -> Telescope -> Abs Telescope
    forall a b. (a -> b) -> a -> b
    $ [Name] -> Telescope
    nameCxt [Name]
    xs

        TypeError
    NeedOptionAllowExec -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Option --allow-exec needed to call external commands from macros"

        TypeError
    NeedOptionCopatterns -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Option --copatterns needed to enable destructor patterns"

        NeedOptionCubical Cubical
    cubical String
    reason -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
            [ [ m Doc
    "Option" ], [m Doc]
    opt, [ m Doc
    "required" ]
            , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    reason
            ]
          where
          opt :: [m Doc]
    opt = case Cubical
    cubical of
            Cubical
    CFull   -> [ m Doc
    "--cubical" ]
            Cubical
    CErased -> String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords (String -> [m Doc]) -> String -> [m Doc]
    forall a b. (a -> b) -> a -> b
    $ String
    "--cubical or --erased-cubical"

        TypeError
    NeedOptionPatternMatching -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Pattern matching is disabled (use option --pattern-matching to enable it)"

        TypeError
    NeedOptionProp       -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Universe Prop is disabled (use options --prop and --no-prop to enable/disable Prop)"

        TypeError
    NeedOptionRewriting  -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Option --rewriting needed to add and use rewrite rules"

        NeedOptionSizedTypes String
    reason -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Option --sized-types needed" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    reason

        TypeError
    NeedOptionTwoLevel   -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Universe SSet is disabled (use option --two-level to enable SSet)"

        TypeError
    NeedOptionUniversePolymorphism -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Universe polymorphism is disabled (use option --universe-polymorphism to allow level arguments to sorts)"

        GeneralizeNotSupportedHere QName
    x -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords (String -> [m Doc]) -> String -> [m Doc]
    forall a b. (a -> b) -> a -> b
    $ String
    "Generalizable variable " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ QName -> String
    forall a. Pretty a => a -> String
    prettyShow QName
    x String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    " is not supported here"

        TypeError
    GeneralizeCyclicDependency -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Cyclic dependency between generalized variables"

        GeneralizedVarInLetOpenedModule QName
    x -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Cannot use generalized variable from let-opened module: " [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          [QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    x]

        MultipleFixityDecls List1 (Name, Pair Fixity')
    xs ->
          [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    sep [ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Multiple fixity or syntax declarations for"
              , NonEmpty (m Doc) -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat (NonEmpty (m Doc) -> m Doc) -> NonEmpty (m Doc) -> m Doc
    forall a b. (a -> b) -> a -> b
    $ ((Name, Pair Fixity') -> m Doc)
    -> List1 (Name, Pair Fixity') -> NonEmpty (m Doc)
    forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap (Name, Pair Fixity') -> m Doc
    forall {m :: * -> *} {t :: * -> *} {a} {a}.
    (Semigroup (m Doc), Applicative m, IsString (m Doc), Foldable t,
     Pretty a, Pretty a, Functor t) =>
    (a, t a) -> m Doc
    f List1 (Name, Pair Fixity')
    xs
              ]
          where
            f :: (a, t a) -> m Doc
    f (a
    x, t a
    fs) = (a -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty a
    x m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    ": ") m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> t (m Doc) -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ((a -> m Doc) -> t a -> t (m Doc)
    forall a b. (a -> b) -> t a -> t b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap a -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty t a
    fs)

        MultiplePolarityPragmas List1 Name
    xs -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Multiple polarity pragmas for" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ (Name -> m Doc) -> [Name] -> [m Doc]
    forall a b. (a -> b) -> [a] -> [b]
    map Name -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty (List1 Name -> [Item (List1 Name)]
    forall l. IsList l => l -> [Item l]
    List1.toList List1 Name
    xs)

        CannotQuote CannotQuote
    what -> do
          String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "`quote' expects an unambiguous defined name," m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    $$ do
          [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "but here the argument is" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
            case CannotQuote
    what of
              CannotQuote
    CannotQuoteNothing ->
                String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "missing"
              CannotQuote
    CannotQuoteHidden ->
                String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "implicit"
              CannotQuoteAmbiguous (List2 QName
    x QName
    y [QName]
    zs) ->
                String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "ambiguous:" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [ AmbiguousQName -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty (AmbiguousQName -> m Doc) -> AmbiguousQName -> m Doc
    forall a b. (a -> b) -> a -> b
    $ List1 QName -> AmbiguousQName
    AmbQ (List1 QName -> AmbiguousQName) -> List1 QName -> AmbiguousQName
    forall a b. (a -> b) -> a -> b
    $ QName
    x QName -> [QName] -> List1 QName
    forall a. a -> [a] -> NonEmpty a
    :| QName
    y QName -> [QName] -> [QName]
    forall a. a -> [a] -> [a]
    : [QName]
    zs ]
              CannotQuoteExpression Expr
    e -> case Expr
    e of
                -- These expression can be quoted:
                A.Def' QName
    _ Suffix
    NoSuffix -> [m Doc]
    forall a. HasCallStack => a
    __IMPOSSIBLE__
                  -- Andreas, 2024-09-27, issue #7514:
                  -- Why only quote suffix-free universes?
                A.Macro        {} -> [m Doc]
    forall a. HasCallStack => a
    __IMPOSSIBLE__
                A.Proj         {} -> [m Doc]
    forall a. HasCallStack => a
    __IMPOSSIBLE__
                A.Con          {} -> [m Doc]
    forall a. HasCallStack => a
    __IMPOSSIBLE__
                A.DontCare     {} -> [m Doc]
    forall a. HasCallStack => a
    __IMPOSSIBLE__
                A.ScopedExpr   {} -> [m Doc]
    forall a. HasCallStack => a
    __IMPOSSIBLE__
                -- These cannot:
                A.PatternSyn   {} -> String -> [m Doc]
    other String
    "a pattern synonym:"
                A.Var          {} -> String -> [m Doc]
    other String
    "a variable:"
                A.Lit          {} -> String -> [m Doc]
    other String
    "a literal:"
                A.QuestionMark {} -> String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "a metavariable"
                A.Underscore   {} -> String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "a metavariable"
                Expr
    _ ->
                  String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "a compound expression"
                where
                  other :: String -> [m Doc]
    other String
    s = String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    s [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [ Expr -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Expr -> m Doc
    prettyTCM Expr
    e]
              CannotQuotePattern Arg (Named NamedName Pattern)
    p -> case Arg (Named NamedName Pattern) -> Pattern
    forall a. NamedArg a -> a
    namedArg Arg (Named NamedName Pattern)
    p of
                C.IdentP    {} -> [m Doc]
    forall a. HasCallStack => a
    __IMPOSSIBLE__
                C.HiddenP   {} -> [m Doc]
    forall a. HasCallStack => a
    __IMPOSSIBLE__
                C.InstanceP {} -> [m Doc]
    forall a. HasCallStack => a
    __IMPOSSIBLE__
                C.RawAppP   {} -> [m Doc]
    forall a. HasCallStack => a
    __IMPOSSIBLE__
                C.AbsurdP   {} -> String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "an absurd pattern"
                C.LitP      {} -> String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "a literal pattern"
                C.WildP     {} -> String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "a wildcard pattern"
                Pattern
    _ ->
                  String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "a compound pattern"

        CannotQuoteTerm CannotQuoteTerm
    what -> do
          String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "`quoteTerm' expects a single visible argument," m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    $$ do
          [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "but has been given" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
            case CannotQuoteTerm
    what of
              CannotQuoteTerm
    CannotQuoteTermNothing ->
                String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "none"
              CannotQuoteTerm
    CannotQuoteTermHidden ->
                String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "an implicit one"

        ConstructorNameOfNonRecord ResolvedName
    res -> case ResolvedName
    res of
          ResolvedName
    UnknownName -> m Doc
    forall a. HasCallStack => a
    __IMPOSSIBLE__ -- Turned into NotInScope when the name is resolved
          ResolvedName
    name ->
            let
              qn :: m Doc
              (m Doc
    qn, String
    whatis) = case ResolvedName
    name of
                DefinedName Access
    _ AbstractName
    nm Suffix
    _ -> (AbstractName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => AbstractName -> m Doc
    prettyTCM AbstractName
    nm,) case AbstractName -> KindOfName
    anameKind AbstractName
    nm of
                  KindOfName
    RecName                  -> String
    forall a. HasCallStack => a
    __IMPOSSIBLE__
                  KindOfName
    ConName                  -> String
    forall a. HasCallStack => a
    __IMPOSSIBLE__
                  KindOfName
    CoConName                -> String
    forall a. HasCallStack => a
    __IMPOSSIBLE__
                  KindOfName
    FldName                  -> String
    forall a. HasCallStack => a
    __IMPOSSIBLE__
                  KindOfName
    PatternSynName           -> String
    forall a. HasCallStack => a
    __IMPOSSIBLE__

                  KindOfName
    GeneralizeName           -> String
    "a generalized variable"
                  KindOfName
    DisallowedGeneralizeName -> String
    "a generalized variable"
                  KindOfName
    MacroName                -> String
    "a macro"
                  KindOfName
    QuotableName             -> String
    "a quotable name"

                  KindOfName
    DataName                 -> String
    "a data type"
                  KindOfName
    FunName                  -> String
    "a function"
                  KindOfName
    AxiomName                -> String
    "a postulate"
                  KindOfName
    PrimName                 -> String
    "a primitive"
                  KindOfName
    OtherDefName             -> String
    "a defined symbol"
                VarName Name
    a BindingSource
    _ -> (Name -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Name -> m Doc
    prettyTCM Name
    a, String
    "a local variable")
                FieldName (AbstractName
    a :| [AbstractName]
    _) -> (AbstractName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => AbstractName -> m Doc
    prettyTCM AbstractName
    a, String
    "a projection")
                ConstructorName Set1 Induction
    _ (AbstractName
    a :| [AbstractName]
    _) -> (AbstractName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => AbstractName -> m Doc
    prettyTCM AbstractName
    a, String
    "a constructor")
                PatternSynResName (AbstractName
    a :| [AbstractName]
    _) -> (AbstractName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => AbstractName -> m Doc
    prettyTCM AbstractName
    a, String
    "a pattern synonym")
            in [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Only record types have constructor names, but" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [m Doc
    qn, m Doc
    "is"] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords (String
    whatis String -> String -> String
    forall a. Semigroup a => a -> a -> a
    <> String
    ".")

        NonFatalErrors Set1 TCWarning
    ws -> NonEmpty (m Doc) -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vsep (NonEmpty (m Doc) -> m Doc) -> NonEmpty (m Doc) -> m Doc
    forall a b. (a -> b) -> a -> b
    $ (TCWarning -> m Doc) -> NonEmpty TCWarning -> NonEmpty (m Doc)
    forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap TCWarning -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => TCWarning -> m Doc
    prettyTCM (NonEmpty TCWarning -> NonEmpty (m Doc))
    -> NonEmpty TCWarning -> NonEmpty (m Doc)
    forall a b. (a -> b) -> a -> b
    $ Set1 TCWarning -> NonEmpty TCWarning
    forall a. NESet a -> NonEmpty a
    Set1.toAscList Set1 TCWarning
    ws

        ExplicitPolarityVsPragma QName
    p -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Polarity pragma used for " [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [ QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    p ] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    " but its type is already annotated with polarities."

        InstanceSearchDepthExhausted Term
    c Type
    a Int
    d -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords (String
    "Instance search depth exhausted (max depth: " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ Int -> String
    forall a. Show a => a -> String
    show Int
    d String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    ") for candidate") [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          [m Doc -> Int -> m Doc -> m Doc
    forall (m :: * -> *).
    Applicative m =>
    m Doc -> Int -> m Doc -> m Doc
    hang (Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    c m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> m Doc
    ":") Int
    2 (Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    a)]

        TriedToCopyConstrainedPrim QName
    q -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Cannot create a module containing a copy of" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    q]

        InvalidInstanceHeadType Type
    _ WhyInvalidInstanceType
    why -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ case WhyInvalidInstanceType
    why of
          WhyInvalidInstanceType
    ImproperInstHead -> String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Instance search can only be used to find elements in a named type"
          WhyInvalidInstanceType
    ImproperInstTele -> String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Instance search cannot be used to find elements in an explicit function type"

        SortOfSplitVarError Maybe Blocker
    _ Doc
    doc -> Doc -> m Doc
    forall a. a -> m a
    forall (m :: * -> *) a. Monad m => a -> m a
    return Doc
    doc

        ReferencesFutureVariables Term
    term (Int
    disallowed :| [Int]
    _) Arg Term
    lock Int
    leftmost
          | Int
    disallowed Int -> Int -> Bool
    forall a. Eq a => a -> a -> Bool
    == Int
    leftmost
          -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "The lock variable"
                 [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ m Doc -> [m Doc]
    forall a. a -> [a]
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (Name -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Name -> m Doc
    prettyTCM (Name -> m Doc) -> m Name -> m Doc
    forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
    =<< Int -> m Name
    forall (m :: * -> *). (MonadDebug m, MonadTCEnv m) => Int -> m Name
    nameOfBV Int
    disallowed)
                 [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "can not appear simultaneously in the \"later\" term"
                 [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ m Doc -> [m Doc]
    forall a. a -> [a]
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    term)
                 [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "and in the lock term"
                 [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ m Doc -> [m Doc]
    forall a. a -> [a]
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (Arg Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Arg Term -> m Doc
    prettyTCM Arg Term
    lock m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    ".")

        ReferencesFutureVariables Term
    term (Int
    disallowed :| [Int]
    rest) Arg Term
    lock Int
    leftmost -> do
          explain <- Doc -> Doc -> Bool
    forall a. Eq a => a -> a -> Bool
    (/=) (Doc -> Doc -> Bool) -> m Doc -> m (Doc -> Bool)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Arg Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Arg Term -> m Doc
    prettyTCM Arg Term
    lock m (Doc -> Bool) -> m Doc -> m Bool
    forall a b. m (a -> b) -> m a -> m b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> (Name -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Name -> m Doc
    prettyTCM (Name -> m Doc) -> m Name -> m Doc
    forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
    =<< Int -> m Name
    forall (m :: * -> *). (MonadDebug m, MonadTCEnv m) => Int -> m Name
    nameOfBV Int
    leftmost)
          let
            name = Name -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Name -> m Doc
    prettyTCM (Name -> m Doc) -> m Name -> m Doc
    forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
    =<< Int -> m Name
    forall (m :: * -> *). (MonadDebug m, MonadTCEnv m) => Int -> m Name
    nameOfBV Int
    leftmost
            mod = case Arg Term -> Lock
    forall a. LensLock a => a -> Lock
    getLock Arg Term
    lock of
              IsLock LockOrigin
    LockOLock -> m Doc
    "@lock"
              IsLock LockOrigin
    LockOTick -> m Doc
    "@tick"
              Lock
    _ -> m Doc
    forall a. HasCallStack => a
    __IMPOSSIBLE__
          vcat $ concat
            [ pure . fsep $ concat
              [ pwords "The variable", pure (prettyTCM =<< nameOfBV disallowed), pwords "can not be mentioned here,"
              , pwords "since it was not introduced before the variable", pure (name <> ".")
              ]
            , [ fsep ( pwords "Variables introduced after"
                    ++ pure name
                    ++ pwords "can not be used, since that is the leftmost" ++ pure mod ++ pwords "variable in the locking term"
                    ++ pure (prettyTCM lock <> "."))
              | explain
              ]
            , [ fsep ( pwords "The following"
                      ++ P.singPlural rest (pwords "variable is") (pwords "variables are")
                      ++ pwords "not allowed here, either:"
                      ++ punctuate comma (map (prettyTCM <=< nameOfBV) rest))
              | not (null rest)
              ]
            ]

        DoesNotMentionTicks Term
    term Type
    ty Arg Term
    lock ->
          let
            mod :: String
    mod = case Arg Term -> Lock
    forall a. LensLock a => a -> Lock
    getLock Arg Term
    lock of
              IsLock LockOrigin
    LockOLock -> String
    "@lock"
              IsLock LockOrigin
    LockOTick -> String
    "@tick"
              Lock
    _ -> String
    forall a. HasCallStack => a
    __IMPOSSIBLE__
          in
            [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat
            [ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
                String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "The term"
                [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Arg Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Arg Term -> m Doc
    prettyTCM Arg Term
    lock m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    ","]
                [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "given as an argument to the guarded value"
            , Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    term m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> m Doc
    ":" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    ty)
            , [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep (String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords (String
    "can not be used as a " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    mod String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    " argument, since it does not mention any " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    mod String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    " variables."))
            ]

        MismatchedProjectionsError QName
    left QName
    right -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "The projections" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    left] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "and" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    right] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "do not match"

        AttributeKindNotEnabled String
    kind String
    opt String
    s -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          [String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text String
    kind] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "attributes have not been enabled (use" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          [String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text String
    opt] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "to enable them):" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          [String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text String
    s]

        InvalidProjectionParameter NamedArg Expr
    arg -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Invalid projection parameter " [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          [NamedArg Expr -> m Doc
    forall a (m :: * -> *).
    (ToConcrete a, Pretty (ConOfAbs a), MonadAbsToCon m) =>
    a -> m Doc
    prettyA NamedArg Expr
    arg]

        TypeError
    TacticAttributeNotAllowed -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "The @tactic attribute is not allowed here"

        CannotRewriteByNonEquation Type
    t ->
          m Doc
    "Cannot rewrite by equation of type" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    t

        MacroResultTypeMismatch Type
    expectedType ->
          [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    sep [ m Doc
    "Result type of a macro must be", Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    expectedType ]

        NamedWhereModuleInRefinedContext [Term]
    args [String]
    names -> do
          let pr :: String -> a -> m Doc
    pr String
    x a
    v = String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (String
    x String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    " =") m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> a -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => a -> m Doc
    prettyTCM a
    v
          [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat
            [ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep (String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords (String -> [m Doc]) -> String -> [m Doc]
    forall a b. (a -> b) -> a -> b
    $ String
    "Named where-modules are not allowed when module parameters have been refined by pattern matching. " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++
                              String
    "See https://github.com/agda/agda/issues/2897.")
            , String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String
    "In this case the module parameter" String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++
                      (if Bool -> Bool
    not ([Term] -> Bool
    forall a. Null a => a -> Bool
    null [Term]
    args) then String
    "s have" else String
    " has") String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++
                      String
    " been refined to"
            , Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat ((String -> Term -> m Doc) -> [String] -> [Term] -> [m Doc]
    forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
    zipWith String -> Term -> m Doc
    forall {m :: * -> *} {a}.
    (PrettyTCM a, MonadFresh NameId m, MonadInteractionPoints m,
     MonadStConcreteNames m, PureTCM m, IsString (m Doc), Null (m Doc),
     Semigroup (m Doc)) =>
    String -> a -> m Doc
    pr [String]
    names [Term]
    args) ]

        CannotGenerateHCompClause Type
    ty -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
            [ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Cannot generate hcomp clause at type"
            , [ Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    ty ]
            ]

        CannotGenerateTransportClause QName
    f Closure (Abs Type)
    clos ->
          Closure (Abs Type) -> (Abs Type -> m Doc) -> m Doc
    forall (m :: * -> *) c a b.
    (MonadTCEnv m, ReadTCState m, LensClosure c a) =>
    c -> (a -> m b) -> m b
    enterClosure Closure (Abs Type)
    clos \ Abs Type
    failed_t -> (String, Dom Type) -> m Doc -> m Doc
    forall b (m :: * -> *) a.
    (AddContext b, MonadAddContext m) =>
    b -> m a -> m a
    forall (m :: * -> *) a.
    MonadAddContext m =>
    (String, Dom Type) -> m a -> m a
    addContext (String
    "i" :: String, Dom Type
    HasCallStack => Dom Type
    __DUMMY_DOM__) (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat
            [ m Doc
    "Could not generate a transport clause for" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    f
            , m Doc
    "because a term of type" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM (Abs Type -> Type
    forall a. Abs a -> a
    unAbs Abs Type
    failed_t)
            , m Doc
    "lives in the sort" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> Sort -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Sort -> m Doc
    prettyTCM (Type -> Sort
    forall a. LensSort a => a -> Sort
    getSort (Abs Type -> Type
    forall a. Abs a -> a
    unAbs Abs Type
    failed_t))
            , m Doc
    "and thus can not be transported"
            ]

        CubicalNotErasure QName
    q -> QName -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettySigCubicalNotErasure QName
    q

        CubicalPrimitiveNotFullyApplied QName
    c ->
          QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    c m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> m Doc
    "must be fully applied"

        ExpectedIntervalLiteral Expr
    e -> do
          i0 <- Term -> Maybe Term -> Term
    forall a. a -> Maybe a -> a
    fromMaybe Term
    forall a. HasCallStack => a
    __IMPOSSIBLE__ (Maybe Term -> Term) -> m (Maybe Term) -> m Term
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> BuiltinId -> m (Maybe Term)
    forall (m :: * -> *). HasBuiltins m => BuiltinId -> m (Maybe Term)
    getBuiltin' BuiltinId
    builtinIZero
          i1 <- fromMaybe __IMPOSSIBLE__ <$> getBuiltin' builtinIOne
          fsep $ concat
            [ pwords "Expected an interval literal"
            , [ parens $ fsep [ prettyTCM i0, "or", prettyTCM i1 ] ]
            , pwords "but found:"
            , [ prettyTCM e ]
            ]

        TypeError
    PatternInPathLambda ->
          String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "Patterns are not allowed in Path-lambdas"

        TypeError
    PatternInSystem ->
          String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "Pattern matching or path copatterns not allowed in systems"

        TypeError
    FaceConstraintDisjunction ->
          String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "Cannot have disjunctions in a face constraint"

        TypeError
    FaceConstraintUnsatisfiable ->
          String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "The face constraint is unsatisfiable"

        IllTypedPatternAfterWithAbstraction Pattern
    p -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat
          [ m Doc
    "Ill-typed pattern after with abstraction: " m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> Pattern -> m Doc
    forall a (m :: * -> *).
    (ToConcrete a, Pretty (ConOfAbs a), MonadAbsToCon m) =>
    a -> m Doc
    prettyA Pattern
    p
          , m Doc
    "(perhaps you can replace it by `_`?)"
          ]

        ComatchingDisabledForRecord QName
    recName ->
          m Doc
    "Copattern matching is disabled for record" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    recName

        IncorrectTypeForRewriteRelation Term
    v IncorrectTypeForRewriteRelationReason
    reason -> case IncorrectTypeForRewriteRelationReason
    reason of
          IncorrectTypeForRewriteRelationReason
    ShouldAcceptAtLeastTwoArguments -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    sep
            [ Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    v m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> m Doc
    " does not have the right type for a rewriting relation"
            , m Doc
    "because it should accept at least two arguments"
            ]
          IncorrectTypeForRewriteRelationReason
    FinalTwoArgumentsNotVisible -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    sep
            [ Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    v m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> m Doc
    " does not have the right type for a rewriting relation"
            , m Doc
    "because its two final arguments are not both visible."
            ]
          TypeDoesNotEndInSort Type
    core Telescope
    tel -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    sep
            [ Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    v m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> m Doc
    " does not have the right type for a rewriting relation"
            , m Doc
    "because its type does not end in a sort, but in "
              m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> do m Doc -> m Doc
    forall (tcm :: * -> *) a.
    (MonadTCEnv tcm, ReadTCState tcm) =>
    tcm a -> tcm a
    inTopContext (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Telescope -> m Doc -> m Doc
    forall b (m :: * -> *) a.
    (AddContext b, MonadAddContext m) =>
    b -> m a -> m a
    forall (m :: * -> *) a.
    MonadAddContext m =>
    Telescope -> m a -> m a
    addContext Telescope
    tel (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    core
            ]

        UnexpectedParameter LamBinding
    par -> do
          String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text String
    "Unexpected parameter" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> LamBinding -> m Doc
    forall a (m :: * -> *).
    (ToConcrete a, Pretty (ConOfAbs a), MonadAbsToCon m) =>
    a -> m Doc
    prettyA LamBinding
    par

        NoParameterOfName String
    x -> do
          String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (String
    "No parameter of name " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    x)

        UnexpectedModalityAnnotationInParameter LamBinding
    par -> do
          String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text String
    "Unexpected modality/relevance annotation in" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> LamBinding -> m Doc
    forall a (m :: * -> *).
    (ToConcrete a, Pretty (ConOfAbs a), MonadAbsToCon m) =>
    a -> m Doc
    prettyA LamBinding
    par

        SortDoesNotAdmitDataDefinitions QName
    name Sort
    s ->[m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep
          [ m Doc
    "The universe"
          , Sort -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Sort -> m Doc
    prettyTCM Sort
    s
          , m Doc
    "of"
          , QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    name
          , m Doc
    "does not admit data or record declarations"
          ]

        SortCannotDependOnItsIndex QName
    name Type
    t -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep
          [ m Doc
    "The sort of" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    name
          , m Doc
    "cannot depend on its indices in the type"
          , Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    t
          ]

        ExpectedBindingForParameter Dom Type
    a Abs Type
    b -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    sep
          [ m Doc
    "Expected binding for parameter"
          , String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (Abs Type -> String
    forall a. Abs a -> String
    absName Abs Type
    b) m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text String
    ":" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM (Dom Type -> Type
    forall t e. Dom' t e -> e
    unDom Dom Type
    a)
          ]

        UnexpectedTypeSignatureForParameter List1 (NamedArg Binder)
    xs -> do
          [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep (String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Unexpected type signature for" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [ List1 (NamedArg Binder) -> m Doc -> m Doc
    forall (m :: * -> *) a. (Functor m, Sized a) => a -> m Doc -> m Doc
    pluralS List1 (NamedArg Binder)
    xs m Doc
    "parameter" ]) m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> NonEmpty (m Doc) -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    sep ((NamedArg Binder -> m Doc)
    -> List1 (NamedArg Binder) -> NonEmpty (m Doc)
    forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap NamedArg Binder -> m Doc
    forall a (m :: * -> *).
    (ToConcrete a, Pretty (ConOfAbs a), MonadAbsToCon m) =>
    a -> m Doc
    prettyA List1 (NamedArg Binder)
    xs)

        UnusableAtModality WhyCheckModality
    why Modality
    mod Term
    t -> do
          compatible <- m Bool
    forall (m :: * -> *). HasOptions m => m Bool
    cubicalCompatibleOption
          cubical <- isJust <$> cubicalOption
          let
            context
              | Bool
    cubical    = String
    "in Cubical Agda,"
              | Bool
    compatible = String
    "to maintain compatibility with Cubical Agda,"
              | Bool
    otherwise  = String
    "when --without-K is enabled,"

            explanation String
    what
              | Bool
    cubical Bool -> Bool -> Bool
    || Bool
    compatible =
                [ m Doc
    ""
                , [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ( m Doc
    "Note:"m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    :String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    context
                      [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    what [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "must be usable at the modality"
                      [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "in which the function was defined, since it will be"
                      [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "used for computing transports"
                      )
                , m Doc
    ""
                ]
              | Bool
    otherwise = []
          case why of
            WhyCheckModality
    IndexedClause ->
              [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
                ( [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ( String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "This clause has target type"
                      [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    t]
                      [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "which is not usable at the required modality"
                      [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Modality -> m Doc
    forall (m :: * -> *). HasOptions m => Modality -> m Doc
    attributesForModality Modality
    mod m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    "."]
                       )
                m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : String -> [m Doc]
    explanation String
    "the target type")

            -- Arguments sometimes need to be transported too:
            IndexedClauseArg Name
    forced Name
    the_arg ->
              [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
                ( [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep (String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "The argument" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Name -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Name -> m Doc
    prettyTCM Name
    the_arg] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "has type")
                m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    t)
                m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ( String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "which is not usable at the required modality"
                      [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Modality -> m Doc
    forall (m :: * -> *). HasOptions m => Modality -> m Doc
    attributesForModality Modality
    mod m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    "."] )
                m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : String -> [m Doc]
    explanation String
    "this argument's type")

            -- Note: if a generated clause is modality-incorrect, that's a
            -- bug in the LHS modality check
            WhyCheckModality
    GeneratedClause ->
              String -> m Doc
    forall (m :: * -> *) a.
    (HasCallStack, MonadDebug m) =>
    String -> m a
    __IMPOSSIBLE_VERBOSE__ (String -> m Doc) -> (Doc -> String) -> Doc -> m Doc
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Doc -> String
    forall a. Show a => a -> String
    show (Doc -> m Doc) -> m Doc -> m Doc
    forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
    =<<
                       Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    t
                  m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> m Doc
    "is not usable at the required modality"
                  m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> Modality -> m Doc
    forall (m :: * -> *). HasOptions m => Modality -> m Doc
    attributesForModality Modality
    mod
            WhyCheckModality
    _ -> Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    t m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> m Doc
    "is not usable at the required modality"
             m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> Modality -> m Doc
    forall (m :: * -> *). HasOptions m => Modality -> m Doc
    attributesForModality Modality
    mod

        CubicalCompilationNotSupported Cubical
    cubical -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
          [ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords (String -> [m Doc]) -> String -> [m Doc]
    forall a b. (a -> b) -> a -> b
    $ String
    "Compilation of code that uses"
          , [ String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Cubical -> String
    cubicalOptionString Cubical
    cubical ]
          , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords (String -> [m Doc]) -> String -> [m Doc]
    forall a b. (a -> b) -> a -> b
    $ String
    "is not supported."
          ]

        TypeError
    QualifiedLocalModule -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "Local modules cannot have qualified names"

        BackendDoesNotSupportOnlyScopeChecking Text
    backend -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
          [ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "The backend"
          , [ Text -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Text -> m Doc
    prettyTCM Text
    backend ]
          , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "does not support --only-scope-checking."
          ]

        UnknownBackend Text
    backend Set Text
    backends -> Doc -> m Doc
    forall a. a -> m a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (Doc -> m Doc) -> Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [Doc] -> Doc
    forall (t :: * -> *). Foldable t => t Doc -> Doc
    P.vcat ([Doc] -> Doc) -> [Doc] -> Doc
    forall a b. (a -> b) -> a -> b
    $ [[Doc]] -> [Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
          [ [ [Doc] -> Doc
    forall (t :: * -> *). Foldable t => t Doc -> Doc
    P.hcat [ Doc
    "No backend called '", Text -> Doc
    forall a. Pretty a => a -> Doc
    P.pretty Text
    backend, Doc
    "' " ] ]
          , [ Doc
    "Installed backend(s):" ]
          , (Text -> Doc) -> [Text] -> [Doc]
    forall a b. (a -> b) -> [a] -> [b]
    map ((Doc
    "-" Doc -> Doc -> Doc
    forall a. Doc a -> Doc a -> Doc a
    P.<+>) (Doc -> Doc) -> (Text -> Doc) -> Text -> Doc
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Text -> Doc
    forall a. Pretty a => a -> Doc
    P.pretty) ([Text] -> [Doc]) -> [Text] -> [Doc]
    forall a b. (a -> b) -> a -> b
    $ Set Text -> [Text]
    forall a. Set a -> [a]
    Set.toAscList Set Text
    backends
          ]

        CustomBackendError Text
    backend Doc
    err -> (Text -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty Text
    backend m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    ":") m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <?> Doc -> m Doc
    forall a. a -> m a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Doc
    err

        GHCBackendError GHCBackendError
    err -> GHCBackendError -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => GHCBackendError -> m Doc
    prettyTCM GHCBackendError
    err

        JSBackendError JSBackendError
    err -> JSBackendError -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => JSBackendError -> m Doc
    prettyTCM JSBackendError
    err

        InteractionError InteractionError
    err -> InteractionError -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => InteractionError -> m Doc
    prettyTCM InteractionError
    err

        where
        mpar :: a -> a -> m Doc -> m Doc
    mpar a
    n a
    args
          | a
    n a -> a -> Bool
    forall a. Ord a => a -> a -> Bool
    > a
    0 Bool -> Bool -> Bool
    && Bool -> Bool
    not (a -> Bool
    forall a. Null a => a -> Bool
    null a
    args) = m Doc -> m Doc
    forall (m :: * -> *). Functor m => m Doc -> m Doc
    parens
          | Bool
    otherwise                = m Doc -> m Doc
    forall a. a -> a
    id

        prettyArg :: MonadPretty m => Arg (I.Pattern' a) -> m Doc
        prettyArg :: forall a. MonadPretty m => Arg (Pattern' a) -> m Doc
    prettyArg (Arg ArgInfo
    info Pattern' a
    x) = case ArgInfo -> Hiding
    forall a. LensHiding a => a -> Hiding
    getHiding ArgInfo
    info of
          Hiding
    Hidden     -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => m Doc -> m Doc
    braces (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Integer -> Pattern' a -> m Doc
    forall a. MonadPretty m => Integer -> Pattern' a -> m Doc
    prettyPat Integer
    0 Pattern' a
    x
          Instance{} -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => m Doc -> m Doc
    dbraces (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Integer -> Pattern' a -> m Doc
    forall a. MonadPretty m => Integer -> Pattern' a -> m Doc
    prettyPat Integer
    0 Pattern' a
    x
          Hiding
    NotHidden  -> Integer -> Pattern' a -> m Doc
    forall a. MonadPretty m => Integer -> Pattern' a -> m Doc
    prettyPat Integer
    1 Pattern' a
    x

        prettyPat :: MonadPretty m => Integer -> (I.Pattern' a) -> m Doc
        prettyPat :: forall a. MonadPretty m => Integer -> Pattern' a -> m Doc
    prettyPat Integer
    _ (I.VarP PatternInfo
    _ a
    _) = m Doc
    "_"
        prettyPat Integer
    _ (I.DotP PatternInfo
    _ Term
    _) = m Doc
    "._"
        prettyPat Integer
    n (I.ConP ConHead
    c ConPatternInfo
    _ [NamedArg (Pattern' a)]
    args) =
          Integer -> [NamedArg (Pattern' a)] -> m Doc -> m Doc
    forall {a} {a} {m :: * -> *}.
    (Ord a, Num a, Null a, Functor m) =>
    a -> a -> m Doc -> m Doc
    mpar Integer
    n [NamedArg (Pattern' a)]
    args (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $
            ConHead -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => ConHead -> m Doc
    prettyTCM ConHead
    c m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ((NamedArg (Pattern' a) -> m Doc)
    -> [NamedArg (Pattern' a)] -> [m Doc]
    forall a b. (a -> b) -> [a] -> [b]
    map (Arg (Pattern' a) -> m Doc
    forall a. MonadPretty m => Arg (Pattern' a) -> m Doc
    prettyArg (Arg (Pattern' a) -> m Doc)
    -> (NamedArg (Pattern' a) -> Arg (Pattern' a))
    -> NamedArg (Pattern' a)
    -> m Doc
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Named NamedName (Pattern' a) -> Pattern' a)
    -> NamedArg (Pattern' a) -> Arg (Pattern' a)
    forall a b. (a -> b) -> Arg a -> Arg b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Named NamedName (Pattern' a) -> Pattern' a
    forall name a. Named name a -> a
    namedThing) [NamedArg (Pattern' a)]
    args)
        prettyPat Integer
    n (I.DefP PatternInfo
    o QName
    q [NamedArg (Pattern' a)]
    args) =
          Integer -> [NamedArg (Pattern' a)] -> m Doc -> m Doc
    forall {a} {a} {m :: * -> *}.
    (Ord a, Num a, Null a, Functor m) =>
    a -> a -> m Doc -> m Doc
    mpar Integer
    n [NamedArg (Pattern' a)]
    args (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $
            QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    q m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ((NamedArg (Pattern' a) -> m Doc)
    -> [NamedArg (Pattern' a)] -> [m Doc]
    forall a b. (a -> b) -> [a] -> [b]
    map (Arg (Pattern' a) -> m Doc
    forall a. MonadPretty m => Arg (Pattern' a) -> m Doc
    prettyArg (Arg (Pattern' a) -> m Doc)
    -> (NamedArg (Pattern' a) -> Arg (Pattern' a))
    -> NamedArg (Pattern' a)
    -> m Doc
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Named NamedName (Pattern' a) -> Pattern' a)
    -> NamedArg (Pattern' a) -> Arg (Pattern' a)
    forall a b. (a -> b) -> Arg a -> Arg b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Named NamedName (Pattern' a) -> Pattern' a
    forall name a. Named name a -> a
    namedThing) [NamedArg (Pattern' a)]
    args)
        prettyPat Integer
    _ (I.LitP PatternInfo
    _ Literal
    l) = Literal -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Literal -> m Doc
    prettyTCM Literal
    l
        prettyPat Integer
    _ (I.ProjP ProjOrigin
    _ QName
    p) = m Doc
    "." m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    p
        prettyPat Integer
    _ (I.IApplyP PatternInfo
    _ Term
    _ Term
    _ a
    _) = m Doc
    "_"

    instance PrettyTCM ExecError where
      prettyTCM :: forall (m :: * -> *). MonadPretty m => ExecError -> m Doc
    prettyTCM = \case

        ExeNotTrusted Text
    exe ExeMap
    exes -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          ([m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
             [ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Could not find"
             , Text -> [m Doc]
    forall (m :: * -> *) a. (MonadPretty m, Pretty a) => a -> [m Doc]
    q Text
    exe
             , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "in list of trusted executables:"
             ]) m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    :
          [ String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String
    "  - " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ Text -> String
    Text.unpack Text
    exe | Text
    exe <- ExeMap -> [Text]
    forall k a. Map k a -> [k]
    Map.keys ExeMap
    exes ]

        ExeNotFound Text
    exe String
    fp -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
          [ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Could not find file"
          , String -> [m Doc]
    forall (m :: * -> *) a. (MonadPretty m, Pretty a) => a -> [m Doc]
    q String
    fp
          , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "for trusted executable"
          , String -> [m Doc]
    forall (m :: * -> *) a. (MonadPretty m, Pretty a) => a -> [m Doc]
    q String
    fp
          ]

        ExeNotExecutable Text
    exe String
    fp -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
          [ [ m Doc
    "File" ]
          , String -> [m Doc]
    forall (m :: * -> *) a. (MonadPretty m, Pretty a) => a -> [m Doc]
    q String
    fp
          , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "for trusted executable"
          , Text -> [m Doc]
    forall (m :: * -> *) a. (MonadPretty m, Pretty a) => a -> [m Doc]
    q Text
    exe
          , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "does not have permission to execute"
          ]

        where
          q :: (MonadPretty m, P.Pretty a) => a -> [m Doc]
          q :: forall (m :: * -> *) a. (MonadPretty m, Pretty a) => a -> [m Doc]
    q = m Doc -> [m Doc]
    forall el coll. Singleton el coll => el -> coll
    singleton (m Doc -> [m Doc]) -> (a -> m Doc) -> a -> [m Doc]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . m Doc -> m Doc
    forall (m :: * -> *). Functor m => m Doc -> m Doc
    quotes (m Doc -> m Doc) -> (a -> m Doc) -> a -> m Doc
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . a -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty

    instance PrettyTCM GHCBackendError where
      prettyTCM :: forall (m :: * -> *). MonadPretty m => GHCBackendError -> m Doc
    prettyTCM = \case

        ConstructorCountMismatch QName
    d [QName]
    cs [String]
    hsCons -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
          [ [ QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    d, m Doc
    "has", String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (Int -> String
    forall a. Show a => a -> String
    show Int
    n), m Doc
    "constructors,", m Doc
    "but" ]
          , [ m Doc
    "only" | Int
    hn Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    > Int
    0, Int
    hn Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    < Int
    n ]
          , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    n_forms_are
          , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords (String -> [m Doc]) -> String -> [m Doc]
    forall a b. (a -> b) -> a -> b
    $ String
    "given [" String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ [String] -> String
    unwords [String]
    hsCons String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    "]"
          ]
          where
            n :: Int
    n  = [QName] -> Int
    forall a. [a] -> Int
    forall (t :: * -> *) a. Foldable t => t a -> Int
    length [QName]
    cs
            hn :: Int
    hn = [String] -> Int
    forall a. [a] -> Int
    forall (t :: * -> *) a. Foldable t => t a -> Int
    length [String]
    hsCons
            n_forms_are :: String
    n_forms_are = case Int
    hn of
              Int
    1 -> String
    "1 Haskell constructor is"
              Int
    _ -> Int -> String
    forall a. Show a => a -> String
    show Int
    hn String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    " Haskell constructors are"

        NotAHaskellType Term
    top WhyNotAHaskellType
    offender -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat
          [ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
            [ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "The type", [ Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    top ]
            , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "cannot be translated to a corresponding Haskell type, because it contains"
            , WhyNotAHaskellType -> [m Doc]
    forall {m :: * -> *}.
    (Semigroup (m Doc), MonadFresh NameId m, MonadInteractionPoints m,
     MonadStConcreteNames m, PureTCM m, IsString (m Doc),
     Null (m Doc)) =>
    WhyNotAHaskellType -> [m Doc]
    reason WhyNotAHaskellType
    offender
            ]
          , WhyNotAHaskellType -> m Doc
    forall {m :: * -> *}.
    (Null (m Doc), IsString (m Doc), MonadFresh NameId m,
     MonadInteractionPoints m, MonadStConcreteNames m, PureTCM m,
     Semigroup (m Doc)) =>
    WhyNotAHaskellType -> m Doc
    possibleFix WhyNotAHaskellType
    offender
          ]
          where
          reason :: WhyNotAHaskellType -> [m Doc]
    reason (BadLambda        Term
    v) = String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "the lambda term" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    v m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    "."]
          reason (BadMeta          Term
    v) = String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "a meta variable" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    v m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    "."]
          reason (BadDontCare      Term
    v) = String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "an erased term" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    v m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    "."]
          reason (NotCompiled      QName
    x) = String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "a name that is not compiled"
                                        [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [m Doc -> m Doc
    forall (m :: * -> *). Functor m => m Doc -> m Doc
    parens (QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    x) m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    "."]
          reason (NoPragmaFor      QName
    x) = QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    x m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "which does not have a COMPILE pragma."
          reason (WrongPragmaFor Range
    _ QName
    x) = QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    x m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "which has the wrong kind of COMPILE pragma."

          possibleFix :: WhyNotAHaskellType -> m Doc
    possibleFix BadLambda{}     = m Doc
    forall a. Null a => a
    empty
          possibleFix BadMeta{}       = m Doc
    forall a. Null a => a
    empty
          possibleFix BadDontCare{}   = m Doc
    forall a. Null a => a
    empty
          possibleFix NotCompiled{}   = m Doc
    forall a. Null a => a
    empty
          possibleFix (NoPragmaFor QName
    d) = QName -> m Doc -> m Doc
    forall {m :: * -> *}.
    (IsString (m Doc), MonadFresh NameId m, MonadInteractionPoints m,
     MonadStConcreteNames m, PureTCM m, Null (m Doc),
     Semigroup (m Doc)) =>
    QName -> m Doc -> m Doc
    suggestPragma QName
    d (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ m Doc
    "add a pragma"
          possibleFix (WrongPragmaFor Range
    r QName
    d) = QName -> m Doc -> m Doc
    forall {m :: * -> *}.
    (IsString (m Doc), MonadFresh NameId m, MonadInteractionPoints m,
     MonadStConcreteNames m, PureTCM m, Null (m Doc),
     Semigroup (m Doc)) =>
    QName -> m Doc -> m Doc
    suggestPragma QName
    d (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $
            [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    sep [ m Doc
    "replace the value-level pragma at", Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Range -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty Range
    r, m Doc
    "by" ]

          suggestPragma :: QName -> m Doc -> m Doc
    suggestPragma QName
    d m Doc
    action = do
            def    <- Definition -> Defn
    theDef (Definition -> Defn) -> m Definition -> m Defn
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> QName -> m Definition
    forall (m :: * -> *). HasConstInfo m => QName -> m Definition
    getConstInfo QName
    d
            let dataPragma a
    n = (a
    "data type HsD", String
    "data HsD (" String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String -> [String] -> String
    forall a. [a] -> [[a]] -> [a]
    intercalate String
    " | " [ String
    "C" String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ a -> String
    forall a. Show a => a -> String
    show a
    i | a
    i <- [a
    1..a
    n] ] String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    ")")
                (hsThing, pragma) =
                  case def of
                    Datatype{ dataCons :: Defn -> [QName]
    dataCons = [QName]
    cs } -> Int -> (String, String)
    forall {a} {a}.
    (IsString a, Num a, Enum a, Show a) =>
    a -> (a, String)
    dataPragma ([QName] -> Int
    forall a. [a] -> Int
    forall (t :: * -> *) a. Foldable t => t a -> Int
    length [QName]
    cs)
                    Record{}                  -> Integer -> (String, String)
    forall {a} {a}.
    (IsString a, Num a, Enum a, Show a) =>
    a -> (a, String)
    dataPragma Integer
    1
                    Defn
    _                         -> (String
    "type HsT", String
    "type HsT")
            vcat [ sep ["Possible fix:", action]
                 , nest 2 $ hsep [ "{-# COMPILE GHC", prettyTCM d, "=", text pragma, "#-}" ]
                 , text ("for a suitable Haskell " ++ hsThing ++ ".")
                 ]

        WrongTypeOfMain QName
    io Type
    ty -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
          [ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "The type of main should be", [ QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    io ], String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "A, for some A."
          , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "The given type is:", [ Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    ty ]
          ]

    instance PrettyTCM JSBackendError where
      prettyTCM :: forall (m :: * -> *). MonadPretty m => JSBackendError -> m Doc
    prettyTCM = \case
        JSBackendError
    BadCompilePragma -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    sep
          [ m Doc
    "Badly formed COMPILE JS pragma. Expected"
          , m Doc
    "{-# COMPILE JS <name> = <js> #-}"
          ]

    instance PrettyTCM InteractionError where
      prettyTCM :: forall (m :: * -> *). MonadPretty m => InteractionError -> m Doc
    prettyTCM = \case
        CannotGive Expr
    e       -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Failed to give" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [ Expr -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Expr -> m Doc
    prettyTCM Expr
    e ]

        CannotRefine String
    s     -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Cannot refine" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    s

        CaseSplitError Doc
    doc -> Doc -> m Doc
    forall a. a -> m a
    forall (m :: * -> *) a. Monad m => a -> m a
    return Doc
    doc

        ExpectedIdentifier Expr
    e -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat
          [ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Expected identifier, but found:"
          , m Doc -> [m Doc]
    forall a. a -> [a]
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (m Doc -> [m Doc]) -> m Doc -> [m Doc]
    forall a b. (a -> b) -> a -> b
    $ Expr -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty Expr
    e
          ]

        InteractionError
    ExpectedApplication -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "Expected an argument of the form f e1 e2 .. en"

        NoActionForInteractionPoint InteractionId
    ii -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat
          [ String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String
    "No type nor action available for hole " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ InteractionId -> String
    forall a. Pretty a => a -> String
    prettyShow InteractionId
    ii String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    "."
          , String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String
    "Possible cause: the hole has not been reached during type checking (do you see yellow?)"
          ]

        NoSuchInteractionPoint InteractionId
    ii ->
          [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep [ m Doc
    "Unknown", m Doc
    "interaction", m Doc
    "point", InteractionId -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => InteractionId -> m Doc
    prettyTCM InteractionId
    ii ]

        InteractionError
    UnexpectedWhere -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "`where' clauses are not supported in holes"

    instance PrettyTCM UnquoteError where
      prettyTCM :: forall (m :: * -> *). MonadPretty m => UnquoteError -> m Doc
    prettyTCM = \case

        BlockedOnMeta TCState
    _ Blocker
    m -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords (String -> [m Doc]) -> String -> [m Doc]
    forall a b. (a -> b) -> a -> b
    $ String
    "Unquote failed because of unsolved meta variables."

        CannotDeclareHiddenFunction QName
    f -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Cannot declare hidden function" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [ QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    f ]

        UnquoteError
    CommitAfterDef -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "Cannot use commitTC after declaring new definitions"

        ConInsteadOfDef QName
    x String
    def String
    con -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords (String
    "Use " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    con String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    " instead of " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    def String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    " for constructor") [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          [QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    x]

        DefineDataNotData QName
    x -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          [QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    x] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "is not declared as a datatype or record, or it already has a definition."

        DefInsteadOfCon QName
    x String
    def String
    con -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords (String
    "Use " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    def String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    " instead of " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    con String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    " for non-constructor")
          [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    x]

        MissingDeclaration QName
    x -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Missing declaration for" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [ QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    x ]

        MissingDefinition QName
    x -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Missing definition for" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [ QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    x ]

        UnquoteError
    NakedUnquote -> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "`unquote' must be applied to a term"

        NonCanonical String
    kind Term
    t ->
          String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords (String
    "Cannot unquote non-canonical " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    kind)
          m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    $$ Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    t)

        PatLamWithoutClauses Term
    _ -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Cannot unquote pattern lambda without clauses. Use a single `absurd-clause` for absurd lambdas."

        StaleMeta TopLevelModuleName
    m MetaId
    x ->
          [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    sep
            [ m Doc
    "Cannot unquote stale metavariable"
            , TopLevelModuleName -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty TopLevelModuleName
    m m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    "._" m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> Word64 -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty (MetaId -> Word64
    metaId MetaId
    x)
            ]

        TooManyParameters Int
    npars Expr
    e -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    sep
          [ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat [ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Cannot shave", [Int -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty Int
    npars], String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "parameters off type" ]
          , Expr -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Expr -> m Doc
    prettyTCM Expr
    e
          ]

        UnboundName QName
    x -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Unbound name:" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    x]

    instance PrettyTCM MissingTypeSignatureInfo where
      prettyTCM :: forall (m :: * -> *).
    MonadPretty m =>
    MissingTypeSignatureInfo -> m Doc
    prettyTCM = \case
        MissingDataSignature Name
    x       -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep [ m Doc
    "data"  , m Doc
    "definition", Name -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Name -> m Doc
    prettyTCM Name
    x ]
        MissingRecordSignature Name
    x     -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep [ m Doc
    "record", m Doc
    "definition", Name -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Name -> m Doc
    prettyTCM Name
    x ]
        MissingFunctionSignature LHS
    lhs -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep [ m Doc
    "left", m Doc
    "hand", m Doc
    "side", LHS -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => LHS -> m Doc
    prettyTCM LHS
    lhs ]

    notCmp :: MonadPretty m => Comparison -> m Doc
    notCmp :: forall (m :: * -> *). MonadPretty m => Comparison -> m Doc
    notCmp Comparison
    cmp = m Doc
    "!" m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> Comparison -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Comparison -> m Doc
    prettyTCM Comparison
    cmp

    -- | Print two terms that are supposedly unequal.
    --   If they print to the same identifier, add some explanation
    --   why they are different nevertheless.
    prettyInEqual :: MonadPretty m => Term -> Term -> m (Doc, Doc, Doc)
    prettyInEqual :: forall (m :: * -> *).
    MonadPretty m =>
    Term -> Term -> m (Doc, Doc, Doc)
    prettyInEqual Term
    t1 Term
    t2 = do
      d1 <- Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    t1
      d2 <- prettyTCM t2
      (d1, d2,) <$> do
         -- if printed differently, no extra explanation needed
        if P.render d1 /= P.render d2 then empty else do
          (v1, v2) <- instantiate (t1, t2)
          case (v1, v2) of
            (I.Var Int
    i1 Elims
    _, I.Var Int
    i2 Elims
    _)
              | Int
    i1 Int -> Int -> Bool
    forall a. Eq a => a -> a -> Bool
    == Int
    i2  -> m Doc
    forall (m :: * -> *). MonadPretty m => m Doc
    generic -- possible, see issue 1826
              | Bool
    otherwise -> Int -> Int -> m Doc
    forall (m :: * -> *). MonadPretty m => Int -> Int -> m Doc
    varVar Int
    i1 Int
    i2
            (I.Def{}, I.Con{}) -> m Doc
    forall a. HasCallStack => a
    __IMPOSSIBLE__  -- ambiguous identifiers
            (I.Con{}, I.Def{}) -> m Doc
    forall a. HasCallStack => a
    __IMPOSSIBLE__
            (I.Var{}, I.Def{}) -> m Doc
    forall (m :: * -> *). MonadPretty m => m Doc
    varDef
            (I.Def{}, I.Var{}) -> m Doc
    forall (m :: * -> *). MonadPretty m => m Doc
    varDef
            (I.Var{}, I.Con{}) -> m Doc
    forall (m :: * -> *). MonadPretty m => m Doc
    varCon
            (I.Con{}, I.Var{}) -> m Doc
    forall (m :: * -> *). MonadPretty m => m Doc
    varCon
            (I.Def QName
    x Elims
    _, I.Def QName
    y Elims
    _)
              | QName -> Bool
    isExtendedLambdaName QName
    x, QName -> Bool
    isExtendedLambdaName QName
    y -> QName -> QName -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> QName -> m Doc
    extLamExtLam QName
    x QName
    y
            (Term, Term)
    _                  -> m Doc
    forall a. Null a => a
    empty
      where
        varDef, varCon, generic :: MonadPretty m => m Doc
        varDef :: forall (m :: * -> *). MonadPretty m => m Doc
    varDef = m Doc -> m Doc
    forall (m :: * -> *). Functor m => m Doc -> m Doc
    parens (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "because one is a variable and one a defined identifier"
        varCon :: forall (m :: * -> *). MonadPretty m => m Doc
    varCon = m Doc -> m Doc
    forall (m :: * -> *). Functor m => m Doc -> m Doc
    parens (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "because one is a variable and one a constructor"
        generic :: forall (m :: * -> *). MonadPretty m => m Doc
    generic = m Doc -> m Doc
    forall (m :: * -> *). Functor m => m Doc -> m Doc
    parens (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String
    "although these terms are looking the same, " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++
          String
    "they contain different but identically rendered identifiers somewhere"
        varVar :: MonadPretty m => Int -> Int -> m Doc
        varVar :: forall (m :: * -> *). MonadPretty m => Int -> Int -> m Doc
    varVar Int
    i Int
    j = m Doc -> m Doc
    forall (m :: * -> *). Functor m => m Doc -> m Doc
    parens (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $
                       String
    "because one has de Bruijn index " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ Int -> String
    forall a. Show a => a -> String
    show Int
    i
                       String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    " and the other " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ Int -> String
    forall a. Show a => a -> String
    show Int
    j

        extLamExtLam :: MonadPretty m => QName -> QName -> m Doc
        extLamExtLam :: forall (m :: * -> *). MonadPretty m => QName -> QName -> m Doc
    extLamExtLam QName
    a QName
    b = [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat
          [ String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "Because they are distinct extended lambdas: one is defined at"
          , m Doc
    "  " m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> Range -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty (Name -> Range
    nameBindingSite (QName -> Name
    qnameName QName
    a))
          , String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "and the other at"
          , m Doc
    "  " m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> (Range -> m Doc
    forall (m :: * -> *) a. (Applicative m, Pretty a) => a -> m Doc
    pretty (Name -> Range
    nameBindingSite (QName -> Name
    qnameName QName
    b)) m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    ",")
          , String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    fwords String
    "so they have different internal representations."
          ]

    class PrettyUnequal a where
      prettyUnequal :: MonadPretty m => a -> m Doc -> a -> m Doc

    instance PrettyUnequal Term where
      prettyUnequal :: forall (m :: * -> *).
    MonadPretty m =>
    Term -> m Doc -> Term -> m Doc
    prettyUnequal Term
    t1 m Doc
    ncmp Term
    t2 = do
        (d1, d2, d) <- Term -> Term -> m (Doc, Doc, Doc)
    forall (m :: * -> *).
    MonadPretty m =>
    Term -> Term -> m (Doc, Doc, Doc)
    prettyInEqual Term
    t1 Term
    t2
        fsep $ return d1 : ncmp : return d2 : return d : []

    instance PrettyUnequal I.Type where
      prettyUnequal :: forall (m :: * -> *).
    MonadPretty m =>
    Type -> m Doc -> Type -> m Doc
    prettyUnequal Type
    t1 m Doc
    ncmp Type
    t2 = Term -> m Doc -> Term -> m Doc
    forall a (m :: * -> *).
    (PrettyUnequal a, MonadPretty m) =>
    a -> m Doc -> a -> m Doc
    forall (m :: * -> *).
    MonadPretty m =>
    Term -> m Doc -> Term -> m Doc
    prettyUnequal (Type -> Term
    forall t a. Type'' t a -> a
    unEl Type
    t1) m Doc
    ncmp (Type -> Term
    forall t a. Type'' t a -> a
    unEl Type
    t2)

    instance PrettyTCM SplitError where
      prettyTCM :: forall m. MonadPretty m => SplitError -> m Doc
      prettyTCM :: forall (m :: * -> *). MonadPretty m => SplitError -> m Doc
    prettyTCM SplitError
    err = case SplitError
    err of
        NotADatatype Closure Type
    t -> Closure Type -> (Type -> m Doc) -> m Doc
    forall (m :: * -> *) c a b.
    (MonadTCEnv m, ReadTCState m, LensClosure c a) =>
    c -> (a -> m b) -> m b
    enterClosure Closure Type
    t ((Type -> m Doc) -> m Doc) -> (Type -> m Doc) -> m Doc
    forall a b. (a -> b) -> a -> b
    $ \ Type
    t -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Cannot split on argument of non-datatype" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    t]

        BlockedType Blocker
    b Closure Type
    t -> Closure Type -> (Type -> m Doc) -> m Doc
    forall (m :: * -> *) c a b.
    (MonadTCEnv m, ReadTCState m, LensClosure c a) =>
    c -> (a -> m b) -> m b
    enterClosure Closure Type
    t ((Type -> m Doc) -> m Doc) -> (Type -> m Doc) -> m Doc
    forall a b. (a -> b) -> a -> b
    $ \ Type
    t -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Cannot split on argument of unresolved type" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    t]

        ErasedDatatype ErasedDatatypeReason
    reason Closure Type
    t -> Closure Type -> (Type -> m Doc) -> m Doc
    forall (m :: * -> *) c a b.
    (MonadTCEnv m, ReadTCState m, LensClosure c a) =>
    c -> (a -> m b) -> m b
    enterClosure Closure Type
    t ((Type -> m Doc) -> m Doc) -> (Type -> m Doc) -> m Doc
    forall a b. (a -> b) -> a -> b
    $ \ Type
    t -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Cannot branch on erased argument of datatype" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          [Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    t] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          case ErasedDatatypeReason
    reason of
            ErasedDatatypeReason
    NoErasedMatches ->
              String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "because the option --erased-matches is not active"
            ErasedDatatypeReason
    NoK ->
              String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "because the K rule is turned off"
            ErasedDatatypeReason
    SeveralConstructors ->
              []

        CoinductiveDatatype Closure Type
    t -> Closure Type -> (Type -> m Doc) -> m Doc
    forall (m :: * -> *) c a b.
    (MonadTCEnv m, ReadTCState m, LensClosure c a) =>
    c -> (a -> m b) -> m b
    enterClosure Closure Type
    t ((Type -> m Doc) -> m Doc) -> (Type -> m Doc) -> m Doc
    forall a b. (a -> b) -> a -> b
    $ \ Type
    t -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Cannot pattern match on the coinductive type" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    t]

    {- UNUSED
        NoRecordConstructor t -> fsep $
          pwords "Cannot pattern match on record" ++ [prettyTCM t] ++
          pwords "because it has no constructor"
     -}

        UnificationStuck Maybe Blocker
    b QName
    c Telescope
    tel Args
    cIxs Args
    gIxs [UnificationFailure]
    errs
          | Args -> Int
    forall a. [a] -> Int
    forall (t :: * -> *) a. Foldable t => t a -> Int
    length Args
    cIxs Int -> Int -> Bool
    forall a. Eq a => a -> a -> Bool
    /= Args -> Int
    forall a. [a] -> Int
    forall (t :: * -> *) a. Foldable t => t a -> Int
    length Args
    gIxs -> m Doc
    forall a. HasCallStack => a
    __IMPOSSIBLE__
          | Bool
    otherwise                  -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat ([m Doc] -> m Doc) -> ([[m Doc]] -> [m Doc]) -> [[m Doc]] -> m Doc
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat ([[m Doc]] -> m Doc) -> [[m Doc]] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
            [ [ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> ([[m Doc]] -> [m Doc]) -> [[m Doc]] -> m Doc
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [[m Doc]] -> [m Doc]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat ([[m Doc]] -> m Doc) -> [[m Doc]] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
                [ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "I'm not sure if there should be a case for the constructor"
                , [QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    c m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    ","]
                , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "because I get stuck when trying to solve the following"
                , String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "unification problems (inferred index ≟ expected index):"
                ]
              ]
            , (Arg Term -> Arg Term -> m Doc) -> Args -> Args -> [m Doc]
    forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
    zipWith Arg Term -> Arg Term -> m Doc
    prEq Args
    cIxs Args
    gIxs
            , if [UnificationFailure] -> Bool
    forall a. Null a => a -> Bool
    null [UnificationFailure]
    errs then [] else
                ([m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [ m Doc
    "Possible", [UnificationFailure] -> m Doc -> m Doc
    forall (m :: * -> *) a. (Functor m, Sized a) => a -> m Doc -> m Doc
    pluralS [UnificationFailure]
    errs m Doc
    "reason" ] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "why unification failed:")
                m Doc -> [m Doc] -> [m Doc]
    forall a. a -> [a] -> [a]
    : (UnificationFailure -> m Doc) -> [UnificationFailure] -> [m Doc]
    forall a b. (a -> b) -> [a] -> [b]
    map (Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (m Doc -> m Doc)
    -> (UnificationFailure -> m Doc) -> UnificationFailure -> m Doc
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . UnificationFailure -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => UnificationFailure -> m Doc
    prettyTCM) [UnificationFailure]
    errs
            ]
          where
            -- Andreas, 2019-08-08, issue #3943
            -- To not print hidden indices just as {_}, we strip the Arg and print
            -- the hiding information manually.
            prEq :: Arg Term -> Arg Term -> m Doc
            prEq :: Arg Term -> Arg Term -> m Doc
    prEq Arg Term
    cIx Arg Term
    gIx = Telescope -> m Doc -> m Doc
    forall b (m :: * -> *) a.
    (AddContext b, MonadAddContext m) =>
    b -> m a -> m a
    forall (m :: * -> *) a.
    MonadAddContext m =>
    Telescope -> m a -> m a
    addContext Telescope
    tel (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    hsep [ Arg Term -> m Doc
    forall {f :: * -> *} {a}.
    (PrettyTCM a, MonadFresh NameId f, MonadInteractionPoints f,
     MonadStConcreteNames f, PureTCM f, IsString (f Doc), Null (f Doc),
     Semigroup (f Doc)) =>
    Arg a -> f Doc
    pr Arg Term
    cIx , m Doc
    "≟" , Arg Term -> m Doc
    forall {f :: * -> *} {a}.
    (PrettyTCM a, MonadFresh NameId f, MonadInteractionPoints f,
     MonadStConcreteNames f, PureTCM f, IsString (f Doc), Null (f Doc),
     Semigroup (f Doc)) =>
    Arg a -> f Doc
    pr Arg Term
    gIx ]
            pr :: Arg a -> f Doc
    pr Arg a
    arg = Arg a -> Doc -> Doc
    forall a. LensRelevance a => a -> Doc -> Doc
    prettyRelevance Arg a
    arg (Doc -> Doc) -> (Doc -> Doc) -> Doc -> Doc
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Arg a -> (Doc -> Doc) -> Doc -> Doc
    forall a. LensHiding a => a -> (Doc -> Doc) -> Doc -> Doc
    prettyHiding Arg a
    arg Doc -> Doc
    forall a. a -> a
    id (Doc -> Doc) -> f Doc -> f Doc
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> a -> f Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => a -> m Doc
    prettyTCM (Arg a -> a
    forall e. Arg e -> e
    unArg Arg a
    arg)

        SplitError
    CosplitCatchall -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Cannot split into projections because not all clauses have a projection copattern"

        SplitError
    CosplitNoTarget -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Cannot split into projections because target type is unknown"

        CosplitNoRecordType Closure Type
    t -> Closure Type -> (Type -> m Doc) -> m Doc
    forall (m :: * -> *) c a b.
    (MonadTCEnv m, ReadTCState m, LensClosure c a) =>
    c -> (a -> m b) -> m b
    enterClosure Closure Type
    t ((Type -> m Doc) -> m Doc) -> (Type -> m Doc) -> m Doc
    forall a b. (a -> b) -> a -> b
    $ \Type
    t -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Cannot split into projections because the target type "
          [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    t] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    " is not a record type"

        CannotCreateMissingClause QName
    f (Telescope, [NamedArg DeBruijnPattern])
    cl Doc
    msg Closure (Abs Type)
    t -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep (
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Cannot generate inferred clause for" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    f m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    "."] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Case to handle:") m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    $$ Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 ([m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [(Telescope, [NamedArg DeBruijnPattern]) -> m Doc
    display (Telescope, [NamedArg DeBruijnPattern])
    cl])
                                    m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    $$ ((Doc -> m Doc
    forall a. a -> m a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Doc
    msg m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> Closure (Abs Type) -> (Abs Type -> m Doc) -> m Doc
    forall (m :: * -> *) c a b.
    (MonadTCEnv m, ReadTCState m, LensClosure c a) =>
    c -> (a -> m b) -> m b
    enterClosure Closure (Abs Type)
    t Abs Type -> m Doc
    displayAbs) m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    ".")
            where
            displayAbs :: Abs I.Type -> m Doc
            displayAbs :: Abs Type -> m Doc
    displayAbs (Abs String
    x Type
    t) = String -> m Doc -> m Doc
    forall b (m :: * -> *) a.
    (AddContext b, MonadAddContext m) =>
    b -> m a -> m a
    forall (m :: * -> *) a. MonadAddContext m => String -> m a -> m a
    addContext String
    x (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    t
            displayAbs (NoAbs String
    x Type
    t) = Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    t
            display :: (Telescope, [NamedArg DeBruijnPattern]) -> m Doc
    display (Telescope
    tel, [NamedArg DeBruijnPattern]
    ps) = NamedClause -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => NamedClause -> m Doc
    prettyTCM (NamedClause -> m Doc) -> NamedClause -> m Doc
    forall a b. (a -> b) -> a -> b
    $ QName -> Bool -> Clause -> NamedClause
    NamedClause QName
    f Bool
    True (Clause -> NamedClause) -> Clause -> NamedClause
    forall a b. (a -> b) -> a -> b
    $
              Clause
    forall a. Null a => a
    empty { clauseTel = tel, namedClausePats = ps }

        GenericSplitError String
    s -> [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Split failed:" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    s

    instance PrettyTCM NegativeUnification where
      prettyTCM :: forall (m :: * -> *). MonadPretty m => NegativeUnification -> m Doc
    prettyTCM NegativeUnification
    err = case NegativeUnification
    err of
        UnifyConflict Telescope
    tel Term
    u Term
    v -> Telescope -> m Doc -> m Doc
    forall b (m :: * -> *) a.
    (AddContext b, MonadAddContext m) =>
    b -> m a -> m a
    forall (m :: * -> *) a.
    MonadAddContext m =>
    Telescope -> m a -> m a
    addContext Telescope
    tel (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          [ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "because unification ended with a conflicting equation "
          , Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    u m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> m Doc
    "≟" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    v
          ]

        UnifyCycle Telescope
    tel Int
    i Term
    u -> Telescope -> m Doc -> m Doc
    forall b (m :: * -> *) a.
    (AddContext b, MonadAddContext m) =>
    b -> m a -> m a
    forall (m :: * -> *) a.
    MonadAddContext m =>
    Telescope -> m a -> m a
    addContext Telescope
    tel (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          [ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "because unification ended with a cyclic equation "
          , Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM (Int -> Term
    var Int
    i) m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> m Doc
    "≟" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    u
          ]

    instance PrettyTCM UnificationFailure where
      prettyTCM :: forall (m :: * -> *). MonadPretty m => UnificationFailure -> m Doc
    prettyTCM UnificationFailure
    err = case UnificationFailure
    err of
        UnifyIndicesNotVars Telescope
    tel Type
    a Term
    u Term
    v Args
    ixs -> Telescope -> m Doc -> m Doc
    forall b (m :: * -> *) a.
    (AddContext b, MonadAddContext m) =>
    b -> m a -> m a
    forall (m :: * -> *) a.
    MonadAddContext m =>
    Telescope -> m a -> m a
    addContext Telescope
    tel (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Cannot apply injectivity to the equation" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    u] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "=" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    v] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "of type" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    a] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "because I cannot generalize over the indices" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          [[m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    prettyList ((Arg Term -> m Doc) -> Args -> [m Doc]
    forall a b. (a -> b) -> [a] -> [b]
    map Arg Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Arg Term -> m Doc
    prettyTCM Args
    ixs) m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    "."]

        UnifyRecursiveEq Telescope
    tel Type
    a Int
    i Term
    u -> Telescope -> m Doc -> m Doc
    forall b (m :: * -> *) a.
    (AddContext b, MonadAddContext m) =>
    b -> m a -> m a
    forall (m :: * -> *) a.
    MonadAddContext m =>
    Telescope -> m a -> m a
    addContext Telescope
    tel (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Cannot solve variable " [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM (Int -> Term
    var Int
    i)] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    " of type " [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    a] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    " with solution " [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    u] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    " because the variable occurs in the solution," [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    " or in the type of one of the variables in the solution."

        UnifyReflexiveEq Telescope
    tel Type
    a Term
    u -> Telescope -> m Doc -> m Doc
    forall b (m :: * -> *) a.
    (AddContext b, MonadAddContext m) =>
    b -> m a -> m a
    forall (m :: * -> *) a.
    MonadAddContext m =>
    Telescope -> m a -> m a
    addContext Telescope
    tel (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Cannot eliminate reflexive equation" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    u] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "=" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    u] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "of type" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    a] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "because K has been disabled."

        UnifyUnusableModality Telescope
    tel Type
    a Int
    i Term
    u Modality
    mod -> Telescope -> m Doc -> m Doc
    forall b (m :: * -> *) a.
    (AddContext b, MonadAddContext m) =>
    b -> m a -> m a
    forall (m :: * -> *) a.
    MonadAddContext m =>
    Telescope -> m a -> m a
    addContext Telescope
    tel (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    fsep ([m Doc] -> m Doc) -> [m Doc] -> m Doc
    forall a b. (a -> b) -> a -> b
    $
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "Cannot solve variable " [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM (Int -> Term
    var Int
    i)] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "of type " [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Type -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Type -> m Doc
    prettyTCM Type
    a] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "with solution " [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++ [Term -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Term -> m Doc
    prettyTCM Term
    u] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "because the solution cannot be used at" [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
                 [ String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (Relevance -> String
    forall a. Verbalize a => a -> String
    verbalize (Relevance -> String) -> Relevance -> String
    forall a b. (a -> b) -> a -> b
    $ Modality -> Relevance
    forall a. LensRelevance a => a -> Relevance
    getRelevance Modality
    mod) m Doc -> m Doc -> m Doc
    forall a. Semigroup a => a -> a -> a
    <> m Doc
    ","
                 , String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (String -> m Doc) -> String -> m Doc
    forall a b. (a -> b) -> a -> b
    $ Quantity -> String
    forall a. Verbalize a => a -> String
    verbalize (Quantity -> String) -> Quantity -> String
    forall a b. (a -> b) -> a -> b
    $ Modality -> Quantity
    forall a. LensQuantity a => a -> Quantity
    getQuantity Modality
    mod ] [m Doc] -> [m Doc] -> [m Doc]
    forall a. [a] -> [a] -> [a]
    ++
          String -> [m Doc]
    forall (m :: * -> *). Applicative m => String -> [m Doc]
    pwords String
    "modality"

    explainWhyInScope :: forall m. MonadPretty m => WhyInScopeData -> m Doc
    explainWhyInScope :: forall (m :: * -> *). MonadPretty m => WhyInScopeData -> m Doc
    explainWhyInScope (WhyInScopeData QName
    y String
    _ Maybe LocalVar
    Nothing [] []) = String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (QName -> String
    forall a. Pretty a => a -> String
    prettyShow  QName
    y String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    " is not in scope.")
    explainWhyInScope (WhyInScopeData QName
    y String
    _ Maybe LocalVar
    v [AbstractName]
    xs [AbstractModule]
    ms) = [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat
      [ String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (QName -> String
    forall a. Pretty a => a -> String
    prettyShow QName
    y String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    " is in scope as")
      , Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat [Maybe LocalVar -> [AbstractName] -> m Doc
    variable Maybe LocalVar
    v [AbstractName]
    xs, [AbstractModule] -> m Doc
    modules [AbstractModule]
    ms]
      ]
      where
        -- variable :: Maybe _ -> [_] -> m Doc
        variable :: Maybe LocalVar -> [AbstractName] -> m Doc
    variable Maybe LocalVar
    Nothing [AbstractName]
    vs = [AbstractName] -> m Doc
    names [AbstractName]
    vs
        variable (Just LocalVar
    x) [AbstractName]
    vs
          | [AbstractName] -> Bool
    forall a. Null a => a -> Bool
    null [AbstractName]
    vs   = m Doc
    asVar
          | Bool
    otherwise = [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat
             [ [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    sep [ m Doc
    asVar, Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ LocalVar -> m Doc
    shadowing LocalVar
    x]
             , Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ [AbstractName] -> m Doc
    names [AbstractName]
    vs
             ]
          where
            asVar :: m Doc
            asVar :: m Doc
    asVar = do
              m Doc
    "* a variable bound at" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> Range -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Range -> m Doc
    prettyTCM (Name -> Range
    nameBindingSite (Name -> Range) -> Name -> Range
    forall a b. (a -> b) -> a -> b
    $ LocalVar -> Name
    localVar LocalVar
    x)
            shadowing :: LocalVar -> m Doc
            shadowing :: LocalVar -> m Doc
    shadowing (LocalVar Name
    _ BindingSource
    _ [])    = m Doc
    "shadowing"
            shadowing LocalVar
    _ = m Doc
    "in conflict with"
        names :: [AbstractName] -> m Doc
    names   = [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat ([m Doc] -> m Doc)
    -> ([AbstractName] -> [m Doc]) -> [AbstractName] -> m Doc
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (AbstractName -> m Doc) -> [AbstractName] -> [m Doc]
    forall a b. (a -> b) -> [a] -> [b]
    map AbstractName -> m Doc
    pName
        modules :: [AbstractModule] -> m Doc
    modules = [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    vcat ([m Doc] -> m Doc)
    -> ([AbstractModule] -> [m Doc]) -> [AbstractModule] -> m Doc
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (AbstractModule -> m Doc) -> [AbstractModule] -> [m Doc]
    forall a b. (a -> b) -> [a] -> [b]
    map AbstractModule -> m Doc
    pMod

        pKind :: KindOfName -> m Doc
    pKind = \case
          KindOfName
    ConName                  -> m Doc
    "constructor"
          KindOfName
    CoConName                -> m Doc
    "coinductive constructor"
          KindOfName
    FldName                  -> m Doc
    "record field"
          KindOfName
    PatternSynName           -> m Doc
    "pattern synonym"
          KindOfName
    GeneralizeName           -> m Doc
    "generalizable variable"
          KindOfName
    DisallowedGeneralizeName -> m Doc
    "generalizable variable from let open"
          KindOfName
    MacroName                -> m Doc
    "macro name"
          KindOfName
    QuotableName             -> m Doc
    "quotable name"
          -- previously DefName:
          KindOfName
    DataName                 -> m Doc
    "data type"
          KindOfName
    RecName                  -> m Doc
    "record type"
          KindOfName
    AxiomName                -> m Doc
    "postulate"
          KindOfName
    PrimName                 -> m Doc
    "primitive function"
          KindOfName
    FunName                  -> m Doc
    "defined name"
          KindOfName
    OtherDefName             -> m Doc
    "defined name"

        pName :: AbstractName -> m Doc
        pName :: AbstractName -> m Doc
    pName AbstractName
    a = [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    sep
          [ m Doc
    "* a"
            m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> KindOfName -> m Doc
    pKind (AbstractName -> KindOfName
    anameKind AbstractName
    a)
            m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (QName -> String
    forall a. Pretty a => a -> String
    prettyShow (QName -> String) -> QName -> String
    forall a b. (a -> b) -> a -> b
    $ AbstractName -> QName
    anameName AbstractName
    a)
          , Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ m Doc
    "brought into scope by"
          ] m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    $$
          Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (Range -> WhyInScope -> m Doc
    pWhy (Name -> Range
    nameBindingSite (Name -> Range) -> Name -> Range
    forall a b. (a -> b) -> a -> b
    $ QName -> Name
    qnameName (QName -> Name) -> QName -> Name
    forall a b. (a -> b) -> a -> b
    $ AbstractName -> QName
    anameName AbstractName
    a) (AbstractName -> WhyInScope
    anameLineage AbstractName
    a))
        pMod :: AbstractModule -> m Doc
        pMod :: AbstractModule -> m Doc
    pMod  AbstractModule
    a = [m Doc] -> m Doc
    forall (m :: * -> *) (t :: * -> *).
    (Applicative m, Foldable t) =>
    t (m Doc) -> m Doc
    sep
          [ m Doc
    "* a module" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> String -> m Doc
    forall (m :: * -> *). Applicative m => String -> m Doc
    text (ModuleName -> String
    forall a. Pretty a => a -> String
    prettyShow (ModuleName -> String) -> ModuleName -> String
    forall a b. (a -> b) -> a -> b
    $ AbstractModule -> ModuleName
    amodName AbstractModule
    a)
          , Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (m Doc -> m Doc) -> m Doc -> m Doc
    forall a b. (a -> b) -> a -> b
    $ m Doc
    "brought into scope by"
          ] m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    $$
          Int -> m Doc -> m Doc
    forall (m :: * -> *). Functor m => Int -> m Doc -> m Doc
    nest Int
    2 (Range -> WhyInScope -> m Doc
    pWhy (Name -> Range
    nameBindingSite (Name -> Range) -> Name -> Range
    forall a b. (a -> b) -> a -> b
    $ QName -> Name
    qnameName (QName -> Name) -> QName -> Name
    forall a b. (a -> b) -> a -> b
    $ ModuleName -> QName
    mnameToQName (ModuleName -> QName) -> ModuleName -> QName
    forall a b. (a -> b) -> a -> b
    $ AbstractModule -> ModuleName
    amodName AbstractModule
    a) (AbstractModule -> WhyInScope
    amodLineage AbstractModule
    a))

        pWhy :: Range -> WhyInScope -> m Doc
        pWhy :: Range -> WhyInScope -> m Doc
    pWhy Range
    r WhyInScope
    Defined = m Doc
    "- its definition at" m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> Range -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Range -> m Doc
    prettyTCM Range
    r
        pWhy Range
    r (Opened (C.QName Name
    x) WhyInScope
    w) | Name -> Bool
    forall a. IsNoName a => a -> Bool
    isNoName Name
    x = Range -> WhyInScope -> m Doc
    pWhy Range
    r WhyInScope
    w
        pWhy Range
    r (Opened QName
    m WhyInScope
    w) =
          m Doc
    "- the opening of"
          m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    m
          m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> m Doc
    "at"
          m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> Range -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Range -> m Doc
    prettyTCM (QName -> Range
    forall a. HasRange a => a -> Range
    getRange QName
    m)
          m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    $$
          Range -> WhyInScope -> m Doc
    pWhy Range
    r WhyInScope
    w
        pWhy Range
    r (Applied QName
    m WhyInScope
    w) =
          m Doc
    "- the application of"
          m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> QName -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => QName -> m Doc
    prettyTCM QName
    m
          m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> m Doc
    "at"
          m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    <+> Range -> m Doc
    forall a (m :: * -> *). (PrettyTCM a, MonadPretty m) => a -> m Doc
    forall (m :: * -> *). MonadPretty m => Range -> m Doc
    prettyTCM (QName -> Range
    forall a. HasRange a => a -> Range
    getRange QName
    m)
          m Doc -> m Doc -> m Doc
    forall (m :: * -> *). Applicative m => m Doc -> m Doc -> m Doc
    $$
          Range -> WhyInScope -> m Doc
    pWhy Range
    r WhyInScope
    w

    ---------------------------------------------------------------------------
    -- * Natural language
    ---------------------------------------------------------------------------

    class Verbalize a where
      verbalize :: a -> String

    instance Verbalize Hiding where
      verbalize :: Hiding -> String
    verbalize = Hiding -> String
    hidingToString

    instance Verbalize Relevance where
      verbalize :: Relevance -> String
    verbalize = \case
          Relevant        {} -> String
    "relevant"
          Irrelevant      {} -> String
    "irrelevant"
          ShapeIrrelevant {} -> String
    "shape-irrelevant"

    instance Verbalize Quantity where
      verbalize :: Quantity -> String
    verbalize = \case
        Quantity0{} -> String
    "erased"
        Quantity1{} -> String
    "linear"
        Quantityω{} -> String
    "unrestricted"

    instance Verbalize Cohesion where
      verbalize :: Cohesion -> String
    verbalize = \case
          Cohesion
    Flat       -> String
    "flat"
          Cohesion
    Continuous -> String
    "continuous"
          Cohesion
    Squash     -> String
    "squashed"

    instance Verbalize ModalPolarity where
      verbalize :: ModalPolarity -> String
    verbalize = \case
          ModalPolarity
    UnusedPolarity -> String
    "unused"
          ModalPolarity
    StrictlyPositive -> String
    "strictly positive"
          ModalPolarity
    Positive -> String
    "positive"
          ModalPolarity
    Negative -> String
    "negative"
          ModalPolarity
    MixedPolarity -> String
    "mixed"

    instance Verbalize PolarityModality where
      verbalize :: PolarityModality -> String
    verbalize (PolarityModality ModalPolarity
    p ModalPolarity
    o ModalPolarity
    l) = ModalPolarity -> String
    forall a. Verbalize a => a -> String
    verbalize ModalPolarity
    p

    instance Verbalize Modality where
      verbalize :: Modality -> String
    verbalize Modality
    mod | Modality
    mod Modality -> Modality -> Bool
    forall a. Eq a => a -> a -> Bool
    == Modality
    defaultModality Bool -> Bool -> Bool
    || Modality
    mod Modality -> Modality -> Bool
    forall a. Eq a => a -> a -> Bool
    == Modality
    defaultCheckModality = String
    "default"
      verbalize Modality
    mod | Modality
    mod Modality -> Modality -> Bool
    forall a. Eq a => a -> a -> Bool
    == Modality
    defaultModality = String
    "default"
      verbalize (Modality Relevance
    rel Quantity
    qnt Cohesion
    coh PolarityModality
    pol) = String -> [String] -> String
    forall a. [a] -> [[a]] -> [a]
    intercalate String
    ", " ([String] -> String) -> [String] -> String
    forall a b. (a -> b) -> a -> b
    $
        [ Relevance -> String
    forall a. Verbalize a => a -> String
    verbalize Relevance
    rel | Relevance
    rel Relevance -> Relevance -> Bool
    forall a. Eq a => a -> a -> Bool
    /= Relevance
    defaultRelevance ] [String] -> [String] -> [String]
    forall a. [a] -> [a] -> [a]
    ++
        [ Quantity -> String
    forall a. Verbalize a => a -> String
    verbalize Quantity
    qnt | Quantity
    qnt Quantity -> Quantity -> Bool
    forall a. Eq a => a -> a -> Bool
    /= Quantity
    defaultQuantity ] [String] -> [String] -> [String]
    forall a. [a] -> [a] -> [a]
    ++
        [ Cohesion -> String
    forall a. Verbalize a => a -> String
    verbalize Cohesion
    coh | Cohesion
    coh Cohesion -> Cohesion -> Bool
    forall a. Eq a => a -> a -> Bool
    /= Cohesion
    defaultCohesion ] [String] -> [String] -> [String]
    forall a. [a] -> [a] -> [a]
    ++
        [ PolarityModality -> String
    forall a. Verbalize a => a -> String
    verbalize PolarityModality
    pol | PolarityModality
    pol PolarityModality -> PolarityModality -> Bool
    forall a. Eq a => a -> a -> Bool
    /= PolarityModality
    defaultPolarity , PolarityModality
    pol PolarityModality -> PolarityModality -> Bool
    forall a. Eq a => a -> a -> Bool
    /= Modality -> PolarityModality
    modPolarity Modality
    defaultCheckModality ]

    -- | Indefinite article.
    data Indefinite a = Indefinite a

    instance Verbalize a => Verbalize (Indefinite a) where
      verbalize :: Indefinite a -> String
    verbalize (Indefinite a
    a) =
        case a -> String
    forall a. Verbalize a => a -> String
    verbalize a
    a of
          String
    "" -> String
    ""
          w :: String
    w@(Char
    c:String
    cs) | Char
    c Char -> String -> Bool
    forall a. Eq a => a -> [a] -> Bool
    forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
    `elem` [Char
    'a',Char
    'e',Char
    'i',Char
    'o'] -> String
    "an " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    w
                   | Bool
    otherwise                  -> String
    "a " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    w
          -- Aarne Ranta would whip me if he saw this.