module UVMHS.Lib.Parser.ParserError where import UVMHS.Core import UVMHS.Lib.Window import UVMHS.Lib.Pretty import UVMHS.Lib.Parser.Loc data ParserErrorInfo = ParserErrorInfo { ParserErrorInfo -> WindowR Doc Doc parserErrorInfoPrefix ∷ WindowR Doc Doc , ParserErrorInfo -> WindowR Doc Doc parserErrorInfoContext ∷ WindowR Doc Doc , ParserErrorInfo -> Text parserErrorInfoStackHead ∷ 𝕊 , ParserErrorInfo -> 𝐼 Text parserErrorInfoStackTail ∷ 𝐼 𝕊 } data ParserError t = ParserError { forall {k} (t :: k). ParserError t -> AddBT Loc parserErrorTokenLoc ∷ AddBT Loc , forall {k} (t :: k). ParserError t -> WindowR Doc Doc parserErrorTokenContext ∷ WindowR Doc Doc , forall {k} (t :: k). ParserError t -> WindowL Doc Doc parserErrorTokenSuffix ∷ WindowL Doc Doc , forall {k} (t :: k). ParserError t -> 𝐼 ParserErrorInfo parserErrorFailures ∷ 𝐼 ParserErrorInfo } instance Append (ParserError t) where e₁ :: ParserError t e₁@(ParserError AddBT Loc l₁ WindowR Doc Doc d₁ WindowL Doc Doc s₁ 𝐼 ParserErrorInfo f₁) ⧺ :: ParserError t -> ParserError t -> ParserError t ⧺ e₂ :: ParserError t e₂@(ParserError AddBT Loc l₂ WindowR Doc Doc _ WindowL Doc Doc _ 𝐼 ParserErrorInfo f₂) = case AddBT Loc l₁ AddBT Loc -> AddBT Loc -> Ordering forall a. Ord a => a -> a -> Ordering ⋚ AddBT Loc l₂ of Ordering LT → ParserError t e₂ Ordering EQ → AddBT Loc -> WindowR Doc Doc -> WindowL Doc Doc -> 𝐼 ParserErrorInfo -> ParserError t forall {k} (t :: k). AddBT Loc -> WindowR Doc Doc -> WindowL Doc Doc -> 𝐼 ParserErrorInfo -> ParserError t ParserError AddBT Loc l₁ WindowR Doc Doc d₁ WindowL Doc Doc s₁ (𝐼 ParserErrorInfo -> ParserError t) -> 𝐼 ParserErrorInfo -> ParserError t forall a b. (a -> b) -> a -> b $ 𝐼 ParserErrorInfo f₁ 𝐼 ParserErrorInfo -> 𝐼 ParserErrorInfo -> 𝐼 ParserErrorInfo forall a. Append a => a -> a -> a ⧺ 𝐼 ParserErrorInfo f₂ Ordering GT → ParserError t e₁ data ParserErrorStackTraces = ParserErrorStackTraces { ParserErrorStackTraces -> 𝑃 Text parserErrorStackTracesMessages ∷ 𝑃 𝕊 , ParserErrorStackTraces -> Text ⇰ ParserErrorStackTraces parserErrorStackTracesChain ∷ 𝕊 ⇰ ParserErrorStackTraces } deriving (ParserErrorStackTraces -> ParserErrorStackTraces -> 𝔹 (ParserErrorStackTraces -> ParserErrorStackTraces -> 𝔹) -> (ParserErrorStackTraces -> ParserErrorStackTraces -> 𝔹) -> Eq ParserErrorStackTraces forall a. (a -> a -> 𝔹) -> (a -> a -> 𝔹) -> Eq a $c== :: ParserErrorStackTraces -> ParserErrorStackTraces -> 𝔹 == :: ParserErrorStackTraces -> ParserErrorStackTraces -> 𝔹 $c/= :: ParserErrorStackTraces -> ParserErrorStackTraces -> 𝔹 /= :: ParserErrorStackTraces -> ParserErrorStackTraces -> 𝔹 Eq, Eq ParserErrorStackTraces Eq ParserErrorStackTraces => (ParserErrorStackTraces -> ParserErrorStackTraces -> Ordering) -> (ParserErrorStackTraces -> ParserErrorStackTraces -> 𝔹) -> (ParserErrorStackTraces -> ParserErrorStackTraces -> 𝔹) -> (ParserErrorStackTraces -> ParserErrorStackTraces -> 𝔹) -> (ParserErrorStackTraces -> ParserErrorStackTraces -> 𝔹) -> (ParserErrorStackTraces -> ParserErrorStackTraces -> ParserErrorStackTraces) -> (ParserErrorStackTraces -> ParserErrorStackTraces -> ParserErrorStackTraces) -> Ord ParserErrorStackTraces ParserErrorStackTraces -> ParserErrorStackTraces -> 𝔹 ParserErrorStackTraces -> ParserErrorStackTraces -> Ordering ParserErrorStackTraces -> ParserErrorStackTraces -> ParserErrorStackTraces forall a. Eq a => (a -> a -> Ordering) -> (a -> a -> 𝔹) -> (a -> a -> 𝔹) -> (a -> a -> 𝔹) -> (a -> a -> 𝔹) -> (a -> a -> a) -> (a -> a -> a) -> Ord a $ccompare :: ParserErrorStackTraces -> ParserErrorStackTraces -> Ordering compare :: ParserErrorStackTraces -> ParserErrorStackTraces -> Ordering $c< :: ParserErrorStackTraces -> ParserErrorStackTraces -> 𝔹 < :: ParserErrorStackTraces -> ParserErrorStackTraces -> 𝔹 $c<= :: ParserErrorStackTraces -> ParserErrorStackTraces -> 𝔹 <= :: ParserErrorStackTraces -> ParserErrorStackTraces -> 𝔹 $c> :: ParserErrorStackTraces -> ParserErrorStackTraces -> 𝔹 > :: ParserErrorStackTraces -> ParserErrorStackTraces -> 𝔹 $c>= :: ParserErrorStackTraces -> ParserErrorStackTraces -> 𝔹 >= :: ParserErrorStackTraces -> ParserErrorStackTraces -> 𝔹 $cmax :: ParserErrorStackTraces -> ParserErrorStackTraces -> ParserErrorStackTraces max :: ParserErrorStackTraces -> ParserErrorStackTraces -> ParserErrorStackTraces $cmin :: ParserErrorStackTraces -> ParserErrorStackTraces -> ParserErrorStackTraces min :: ParserErrorStackTraces -> ParserErrorStackTraces -> ParserErrorStackTraces Ord) makeLenses ''ParserErrorStackTraces makePrettyRecord ''ParserErrorStackTraces instance Bot ParserErrorStackTraces where bot :: ParserErrorStackTraces bot = 𝑃 Text -> (Text ⇰ ParserErrorStackTraces) -> ParserErrorStackTraces ParserErrorStackTraces 𝑃 Text forall a. Bot a => a bot Text ⇰ ParserErrorStackTraces forall a. Bot a => a bot instance Join ParserErrorStackTraces where ParserErrorStackTraces 𝑃 Text fin₁ Text ⇰ ParserErrorStackTraces ch₁ ⊔ :: ParserErrorStackTraces -> ParserErrorStackTraces -> ParserErrorStackTraces ⊔ ParserErrorStackTraces 𝑃 Text fin₂ Text ⇰ ParserErrorStackTraces ch₂ = 𝑃 Text -> (Text ⇰ ParserErrorStackTraces) -> ParserErrorStackTraces ParserErrorStackTraces (𝑃 Text fin₁ 𝑃 Text -> 𝑃 Text -> 𝑃 Text forall a. Join a => a -> a -> a ⊔ 𝑃 Text fin₂) (Text ⇰ ParserErrorStackTraces ch₁ (Text ⇰ ParserErrorStackTraces) -> (Text ⇰ ParserErrorStackTraces) -> Text ⇰ ParserErrorStackTraces forall a. Join a => a -> a -> a ⊔ Text ⇰ ParserErrorStackTraces ch₂) instance JoinLattice ParserErrorStackTraces stackTraces ∷ 𝕊 → 𝐼 𝕊 → ParserErrorStackTraces stackTraces :: Text -> 𝐼 Text -> ParserErrorStackTraces stackTraces Text fin 𝐼 Text msgs = 𝐼 Text -> ParserErrorStackTraces -> (Text -> ParserErrorStackTraces -> ParserErrorStackTraces) -> ParserErrorStackTraces forall a t b. ToIter a t => t -> b -> (a -> b -> b) -> b foldrOnFrom 𝐼 Text msgs (𝑃 Text -> (Text ⇰ ParserErrorStackTraces) -> ParserErrorStackTraces ParserErrorStackTraces (Text -> 𝑃 Text forall a t. Single a t => a -> t single Text fin) Text ⇰ ParserErrorStackTraces forall a. Bot a => a bot) ((Text -> ParserErrorStackTraces -> ParserErrorStackTraces) -> ParserErrorStackTraces) -> (Text -> ParserErrorStackTraces -> ParserErrorStackTraces) -> ParserErrorStackTraces forall a b. (a -> b) -> a -> b $ \ Text msg ParserErrorStackTraces tr → 𝑃 Text -> (Text ⇰ ParserErrorStackTraces) -> ParserErrorStackTraces ParserErrorStackTraces 𝑃 Text forall a. Bot a => a bot ((Text ⇰ ParserErrorStackTraces) -> ParserErrorStackTraces) -> (Text ⇰ ParserErrorStackTraces) -> ParserErrorStackTraces forall a b. (a -> b) -> a -> b $ Text msg Text -> ParserErrorStackTraces -> Text ⇰ ParserErrorStackTraces forall a. Text -> a -> Text ⇰ a forall k s (d :: * -> *) a. Dict k s d => k -> a -> d a ↦ ParserErrorStackTraces tr parserErrorFailuresMap ∷ 𝐼 ParserErrorInfo → (𝕊 ∧ 𝔹) ⇰ WindowR Doc Doc ∧ WindowR Doc Doc ∧ ParserErrorStackTraces parserErrorFailuresMap :: 𝐼 ParserErrorInfo -> (Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces) parserErrorFailuresMap 𝐼 ParserErrorInfo eis = ((Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) -> (((Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) -> ((Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) -> (Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) -> 𝐼 ((Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) -> (Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces) forall a t b. ToIter a t => b -> (a -> b -> b) -> t -> b fold (Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces) forall a. Bot a => a bot ((((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces) -> ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces) -> (WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces) -> ((Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) -> ((Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) -> (Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces) forall a. (a -> a -> a) -> ((Text ∧ 𝔹) ⇰ a) -> ((Text ∧ 𝔹) ⇰ a) -> (Text ∧ 𝔹) ⇰ a forall k s (d :: * -> *) a. Dict k s d => (a -> a -> a) -> d a -> d a -> d a dunionBy ((((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces) -> ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces) -> (WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces) -> ((Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) -> ((Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) -> (Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) -> (((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces) -> ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces) -> (WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces) -> ((Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) -> ((Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) -> (Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces) forall a b. (a -> b) -> a -> b $ \ (WindowR Doc Doc c' :* WindowR Doc Doc p' :* ParserErrorStackTraces t₁) (WindowR Doc Doc _ :* WindowR Doc Doc _ :* ParserErrorStackTraces t₂) → WindowR Doc Doc c' WindowR Doc Doc -> WindowR Doc Doc -> WindowR Doc Doc ∧ WindowR Doc Doc forall a b. a -> b -> a ∧ b :* WindowR Doc Doc p' (WindowR Doc Doc ∧ WindowR Doc Doc) -> ParserErrorStackTraces -> (WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces forall a b. a -> b -> a ∧ b :* (ParserErrorStackTraces t₁ ParserErrorStackTraces -> ParserErrorStackTraces -> ParserErrorStackTraces forall a. Join a => a -> a -> a ⊔ ParserErrorStackTraces t₂)) (𝐼 ((Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) -> (Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) -> 𝐼 ((Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) -> (Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces) forall a b. (a -> b) -> a -> b $ 𝐼 ParserErrorInfo -> (ParserErrorInfo -> (Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) -> 𝐼 ((Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) forall (t :: * -> *) a b. Functor t => t a -> (a -> b) -> t b mapOn 𝐼 ParserErrorInfo eis ((ParserErrorInfo -> (Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) -> 𝐼 ((Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces))) -> (ParserErrorInfo -> (Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) -> 𝐼 ((Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) forall a b. (a -> b) -> a -> b $ \ (ParserErrorInfo WindowR Doc Doc p WindowR Doc Doc c Text sh 𝐼 Text st) → (Doc -> Text ppRender (WindowR Doc Doc -> Doc forall a t. (Monoid a, ToIter a t) => t -> a concat WindowR Doc Doc c) Text -> 𝔹 -> Text ∧ 𝔹 forall a b. a -> b -> a ∧ b :* WindowR Doc Doc -> 𝔹 forall i a. WindowR i a -> 𝔹 overflowR WindowR Doc Doc c) (Text ∧ 𝔹) -> ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces) -> (Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces) forall a. (Text ∧ 𝔹) -> a -> (Text ∧ 𝔹) ⇰ a forall k s (d :: * -> *) a. Dict k s d => k -> a -> d a ↦ (WindowR Doc Doc p WindowR Doc Doc -> WindowR Doc Doc -> WindowR Doc Doc ∧ WindowR Doc Doc forall a b. a -> b -> a ∧ b :* WindowR Doc Doc c (WindowR Doc Doc ∧ WindowR Doc Doc) -> ParserErrorStackTraces -> (WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces forall a b. a -> b -> a ∧ b :* Text -> 𝐼 Text -> ParserErrorStackTraces stackTraces Text sh 𝐼 Text st) displaySourceError ∷ 𝕊 → AddNull (ParserError t) → Doc displaySourceError :: forall {k} (t :: k). Text -> AddNull (ParserError t) -> Doc displaySourceError Text so AddNull (ParserError t) peM = 𝐼 Doc -> Doc forall t. ToIter Doc t => t -> Doc ppVertical (𝐼 Doc -> Doc) -> 𝐼 Doc -> Doc forall a b. (a -> b) -> a -> b $ [𝐼 Doc] -> 𝐼 Doc forall a t. (Monoid a, ToIter a t) => t -> a concat [ Doc -> 𝐼 Doc forall a. a -> 𝐼 a forall (m :: * -> *) a. Return m => a -> m a return (Doc -> 𝐼 Doc) -> Doc -> 𝐼 Doc forall a b. (a -> b) -> a -> b $ Text -> Doc ppHeader Text "Parse Failure" , Doc -> 𝐼 Doc forall a. a -> 𝐼 a forall (m :: * -> *) a. Return m => a -> m a return (Doc -> 𝐼 Doc) -> Doc -> 𝐼 Doc forall a b. (a -> b) -> a -> b $ Text -> Doc ppHeader Text "Source:" , if Text so Text -> Text -> 𝔹 forall a. Eq a => a -> a -> 𝔹 ≡ Text forall a. Null a => a null then 𝐼 Doc forall a. 𝐼 a forall {k} (m :: k -> *) (a :: k). MonadNondet m => m a mzero else Doc -> 𝐼 Doc forall a. a -> 𝐼 a forall (m :: * -> *) a. Return m => a -> m a return (Doc -> 𝐼 Doc) -> Doc -> 𝐼 Doc forall a b. (a -> b) -> a -> b $ [Doc] -> Doc forall t. ToIter Doc t => t -> Doc ppHorizontal [Text -> Doc ppErr Text ">",Doc -> Doc ppBD (Doc -> Doc) -> Doc -> Doc forall a b. (a -> b) -> a -> b $ Text -> Doc ppString Text so] , case AddNull (ParserError t) peM of AddNull (ParserError t) Null → Doc -> 𝐼 Doc forall a. a -> 𝐼 a forall (m :: * -> *) a. Return m => a -> m a return (Doc -> 𝐼 Doc) -> Doc -> 𝐼 Doc forall a b. (a -> b) -> a -> b $ Text -> Doc ppErr Text "> No Reported Errors" AddNull (ParserError AddBT Loc l WindowR Doc Doc tc WindowL Doc Doc ts 𝐼 ParserErrorInfo fs) → [𝐼 Doc] -> 𝐼 Doc forall a t. (Monoid a, ToIter a t) => t -> a concat [ Doc -> 𝐼 Doc forall a. a -> 𝐼 a forall (m :: * -> *) a. Return m => a -> m a return (Doc -> 𝐼 Doc) -> Doc -> 𝐼 Doc forall a b. (a -> b) -> a -> b $ [Doc] -> Doc forall t. ToIter Doc t => t -> Doc ppHorizontal [ Text -> Doc ppErr Text ">" , [Doc] -> Doc forall a t. (Monoid a, ToIter a t) => t -> a concat [ Text -> Doc ppString Text "line:" , AddBT ℕ64 -> Doc forall a. Pretty a => a -> Doc pretty (AddBT ℕ64 -> Doc) -> AddBT ℕ64 -> Doc forall a b. (a -> b) -> a -> b $ ℕ64 -> ℕ64 forall a. (One a, Plus a) => a -> a succ (ℕ64 -> ℕ64) -> (Loc -> ℕ64) -> Loc -> ℕ64 forall b c a. (b -> c) -> (a -> b) -> a -> c ∘ Loc -> ℕ64 locRow (Loc -> ℕ64) -> AddBT Loc -> AddBT ℕ64 forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b ^$ AddBT Loc l ] , [Doc] -> Doc forall a t. (Monoid a, ToIter a t) => t -> a concat [ Text -> Doc ppString Text "column:" , AddBT ℕ64 -> Doc forall a. Pretty a => a -> Doc pretty (AddBT ℕ64 -> Doc) -> AddBT ℕ64 -> Doc forall a b. (a -> b) -> a -> b $ ℕ64 -> ℕ64 forall a. (One a, Plus a) => a -> a succ (ℕ64 -> ℕ64) -> (Loc -> ℕ64) -> Loc -> ℕ64 forall b c a. (b -> c) -> (a -> b) -> a -> c ∘ Loc -> ℕ64 locCol (Loc -> ℕ64) -> AddBT Loc -> AddBT ℕ64 forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b ^$ AddBT Loc l ] ] , Doc -> 𝐼 Doc forall a. a -> 𝐼 a forall (m :: * -> *) a. Return m => a -> m a return (Doc -> 𝐼 Doc) -> Doc -> 𝐼 Doc forall a b. (a -> b) -> a -> b $ Text -> Doc ppHeader Text "One of:" , Doc -> 𝐼 Doc -> 𝐼 Doc forall a t. ToIter a t => a -> t -> 𝐼 a inbetween (Text -> Doc ppHeader Text "OR") (𝐼 Doc -> 𝐼 Doc) -> 𝐼 Doc -> 𝐼 Doc forall a b. (a -> b) -> a -> b $ 𝐼 ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces) -> (((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces) -> Doc) -> 𝐼 Doc forall (t :: * -> *) a b. Functor t => t a -> (a -> b) -> t b mapOn ((((Text ∧ 𝔹) ∧ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) -> (WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces) -> 𝐼 ((Text ∧ 𝔹) ∧ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) -> 𝐼 ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces) forall a b. (a -> b) -> 𝐼 a -> 𝐼 b forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b map ((Text ∧ 𝔹) ∧ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) -> (WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces forall a b. (a ∧ b) -> b snd (𝐼 ((Text ∧ 𝔹) ∧ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) -> 𝐼 ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) -> 𝐼 ((Text ∧ 𝔹) ∧ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) -> 𝐼 ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces) forall a b. (a -> b) -> a -> b $ ((Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) -> 𝐼 ((Text ∧ 𝔹) ∧ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) forall a t. ToIter a t => t -> 𝐼 a iter (((Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) -> 𝐼 ((Text ∧ 𝔹) ∧ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces))) -> ((Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) -> 𝐼 ((Text ∧ 𝔹) ∧ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces)) forall a b. (a -> b) -> a -> b $ 𝐼 ParserErrorInfo -> (Text ∧ 𝔹) ⇰ ((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces) parserErrorFailuresMap 𝐼 ParserErrorInfo fs) ((((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces) -> Doc) -> 𝐼 Doc) -> (((WindowR Doc Doc ∧ WindowR Doc Doc) ∧ ParserErrorStackTraces) -> Doc) -> 𝐼 Doc forall a b. (a -> b) -> a -> b $ \ (WindowR Doc Doc pp :* WindowR Doc Doc pc :* ParserErrorStackTraces ets) → [Doc] -> Doc forall t. ToIter Doc t => t -> Doc ppVertical [ [Doc] -> Doc forall a t. (Monoid a, ToIter a t) => t -> a concat [ WindowR Doc Doc -> Doc renderWindowR WindowR Doc Doc pp , ℂ -> Color -> Doc -> Doc ppUT ℂ '^' Color green (Doc -> Doc) -> Doc -> Doc forall a b. (a -> b) -> a -> b $ WindowR Doc Doc -> Doc renderWindowR WindowR Doc Doc pc , ℂ -> Color -> Doc -> Doc ppUT ℂ '^' Color red (Doc -> Doc) -> Doc -> Doc forall a b. (a -> b) -> a -> b $ WindowR Doc Doc -> Doc renderWindowR WindowR Doc Doc tc , WindowL Doc Doc -> Doc renderWindowL WindowL Doc Doc ts ] , ParserErrorStackTraces -> Doc displayErrorTraces ParserErrorStackTraces ets ] ] ] displayErrorTraces ∷ ParserErrorStackTraces → Doc displayErrorTraces :: ParserErrorStackTraces -> Doc displayErrorTraces (ParserErrorStackTraces 𝑃 Text final Text ⇰ ParserErrorStackTraces chain) = 𝐼 Doc -> Doc forall t. ToIter Doc t => t -> Doc ppVertical (𝐼 Doc -> Doc) -> 𝐼 Doc -> Doc forall a b. (a -> b) -> a -> b $ [𝐼 Doc] -> 𝐼 Doc forall a t. (Monoid a, ToIter a t) => t -> a concat [ case 𝑃 Text -> 𝔹 forall a t. ToIter a t => t -> 𝔹 isEmpty 𝑃 Text final of 𝔹 True → 𝐼 Doc forall a. Null a => a null 𝔹 False → Doc -> 𝐼 Doc forall a. a -> 𝐼 a forall (m :: * -> *) a. Return m => a -> m a return (Doc -> 𝐼 Doc) -> Doc -> 𝐼 Doc forall a b. (a -> b) -> a -> b $ 𝐼 Doc -> Doc forall t. ToIter Doc t => t -> Doc ppHorizontal (𝐼 Doc -> Doc) -> 𝐼 Doc -> Doc forall a b. (a -> b) -> a -> b $ [𝐼 Doc] -> 𝐼 Doc forall a t. (Monoid a, ToIter a t) => t -> a concat [ Doc -> 𝐼 Doc forall a t. Single a t => a -> t single (Doc -> 𝐼 Doc) -> Doc -> 𝐼 Doc forall a b. (a -> b) -> a -> b $ Color -> Doc -> Doc ppFG Color red (Doc -> Doc) -> Doc -> Doc forall a b. (a -> b) -> a -> b $ Text -> Doc ppString Text "Expected" , Doc -> 𝐼 Doc -> 𝐼 Doc forall a t. ToIter a t => a -> t -> 𝐼 a inbetween (Color -> Doc -> Doc ppFG Color red (Doc -> Doc) -> Doc -> Doc forall a b. (a -> b) -> a -> b $ Text -> Doc ppString Text "OR") (𝐼 Doc -> 𝐼 Doc) -> 𝐼 Doc -> 𝐼 Doc forall a b. (a -> b) -> a -> b $ (Text -> Doc) -> 𝐼 Text -> 𝐼 Doc forall a b. (a -> b) -> 𝐼 a -> 𝐼 b forall (t :: * -> *) a b. Functor t => (a -> b) -> t a -> t b map Text -> Doc ppString (𝐼 Text -> 𝐼 Doc) -> 𝐼 Text -> 𝐼 Doc forall a b. (a -> b) -> a -> b $ 𝑃 Text -> 𝐼 Text forall a t. ToIter a t => t -> 𝐼 a iter 𝑃 Text final ] , 𝐼 (Text ∧ ParserErrorStackTraces) -> ((Text ∧ ParserErrorStackTraces) -> Doc) -> 𝐼 Doc forall (t :: * -> *) a b. Functor t => t a -> (a -> b) -> t b mapOn ((Text ⇰ ParserErrorStackTraces) -> 𝐼 (Text ∧ ParserErrorStackTraces) forall a t. ToIter a t => t -> 𝐼 a iter Text ⇰ ParserErrorStackTraces chain) (((Text ∧ ParserErrorStackTraces) -> Doc) -> 𝐼 Doc) -> ((Text ∧ ParserErrorStackTraces) -> Doc) -> 𝐼 Doc forall a b. (a -> b) -> a -> b $ \ (Text msg :* ParserErrorStackTraces tr) → [Doc] -> Doc forall t. ToIter Doc t => t -> Doc ppVertical [ [Doc] -> Doc forall t. ToIter Doc t => t -> Doc ppHorizontal [ Color -> Doc -> Doc ppFG Color green (Doc -> Doc) -> Doc -> Doc forall a b. (a -> b) -> a -> b $ Text -> Doc ppString Text "Parsing" , Text -> Doc ppString Text msg ] , [Doc] -> Doc forall a t. (Monoid a, ToIter a t) => t -> a concat [ℕ64 -> Doc ppSpace (ℕ64 -> Doc) -> ℕ64 -> Doc forall a b. (a -> b) -> a -> b $ ℕ -> ℕ64 𝕟64 ℕ 2,Doc -> Doc ppAlign (Doc -> Doc) -> Doc -> Doc forall a b. (a -> b) -> a -> b $ ParserErrorStackTraces -> Doc displayErrorTraces ParserErrorStackTraces tr] ] ]