@@ -9,12 +9,12 @@ Maintainer : The Idris Community.
9{-# LANGUAGE FlexibleInstances #-}
9{-# LANGUAGE FlexibleInstances #-}
10{-# OPTIONS_GHC -fwarn-incomplete-patterns #-}
10{-# OPTIONS_GHC -fwarn-incomplete-patterns #-}
12−module Idris.Output (clearHighlights, idemodePutSExp, iPrintError, iPrintFunTypes,
12+module Idris.Output (clearHighlights, emit, idemodePutSExp, iPrintError, iPrintFunTypes,
13 iPrintResult, iPrintTermWithType, iputGoal, iputStr, iputStrLn,
13 iPrintResult, iPrintTermWithType, iputGoal, iputStr, iputStrLn,
14 iRender, iRenderError, iRenderOutput, iRenderResult, iWarn,
14 iRender, iRenderError, iRenderOutput, iRenderResult, iWarn,
15 prettyDocumentedIst, printUndefinedNames, pshow, renderExternal,
15 prettyDocumentedIst, printUndefinedNames, pshow, renderExternal,
16 sendHighlighting, sendParserHighlighting, warnTotality,
16 sendHighlighting, sendParserHighlighting, warnTotality,
17− writeHighlights) where
17+ writeHighlights, OutputDoc(..), Warning(..)) where
19import Idris.AbsSyntax
19import Idris.AbsSyntax
20import Idris.Colours (hEndColourise, hStartColourise)
20import Idris.Colours (hEndColourise, hStartColourise)
@@ -53,6 +53,10 @@ pshow ist err = displayDecorated (consoleDecorate ist) .
54type OutputDoc = Doc OutputAnnotation
54type OutputDoc = Doc OutputAnnotation
57+ warningExtent :: a -> FC
58+ warningMessage :: a -> OutputDoc
56data Ann = AText String | ATagged OutputAnnotation Ann | ASplit Ann Ann
60data Ann = AText String | ATagged OutputAnnotation Ann | ASplit Ann Ann
58iWarn :: FC -> OutputDoc -> Idris ()
62iWarn :: FC -> OutputDoc -> Idris ()
@@ -165,6 +169,8 @@ iWarn fc err =
165 layoutWarning loc (Just src) err = loc <$$> src <$$> err <$$> empty
169 layoutWarning loc (Just src) err = loc <$$> src <$$> err <$$> empty
166 layoutWarning loc Nothing err = loc </> err
170 layoutWarning loc Nothing err = loc </> err
172+emit :: Warning w => w -> Idris ()
173+emit w = iWarn (warningExtent w) (warningMessage w)
169iRender :: Doc a -> Idris (SimpleDoc a)
175iRender :: Doc a -> Idris (SimpleDoc a)
170iRender d = do w <- getWidth
176iRender d = do w <- getWidth