@@ -42,8 +42,8 @@ module Idris.Core.TT(
42 , intTyName, isInjective, isTypeConst, lookupCtxt
42 , intTyName, isInjective, isTypeConst, lookupCtxt
43 , lookupCtxtExact, lookupCtxtName, mapCtxt, mkApp, nativeTyWidth
43 , lookupCtxtExact, lookupCtxtName, mapCtxt, mkApp, nativeTyWidth
44 , nextName, noOccurrence, nsroot, occurrences
44 , nextName, noOccurrence, nsroot, occurrences
45− , pEraseType, pmap, pprintRaw, pprintTT, prettyEnv, psubst, pToV
45+ , pEraseType, pmap, pprintRaw, pprintTT, pprintTTClause, prettyEnv, psubst
46− , pToVs, pureTerm, raw_apply, raw_unapply, refsIn, safeForget
46+ , pToV, pToVs, pureTerm, raw_apply, raw_unapply, refsIn, safeForget
47 , safeForgetEnv, showCG, showEnv, showEnvDbg, showSep
47 , safeForgetEnv, showCG, showEnv, showEnvDbg, showSep
48 , sInstanceN, sMN, sNS, spanFC, str, subst, substNames, substTerm
48 , sInstanceN, sMN, sNS, spanFC, str, subst, substNames, substTerm
49 , substV, sUN, tcname, termSmallerThan, tfail, thead, tnull
49 , substV, sUN, tcname, termSmallerThan, tfail, thead, tnull
@@ -54,8 +54,8 @@ module Idris.Core.TT(
54-- Work around AMP without CPP
54-- Work around AMP without CPP
55import Prelude (Eq(..), Show(..), Ord(..), Functor(..), Monad(..), String, Int,
55import Prelude (Eq(..), Show(..), Ord(..), Functor(..), Monad(..), String, Int,
56 Integer, Ordering(..), Maybe(..), Num(..), Bool(..), Enum(..),
56 Integer, Ordering(..), Maybe(..), Num(..), Bool(..), Enum(..),
57− Read(..), FilePath, Double, (&&), (||), ($), (.), div, error, fst,
57+ Read(..), FilePath, Double, (&&), (||), ($), (.), div, error, flip,
58− snd, not, mod, read, otherwise)
58+ fst, snd, not, mod, read, otherwise)
60import Control.Applicative (Applicative (..), Alternative)
60import Control.Applicative (Applicative (..), Alternative)
61import qualified Control.Applicative as A (Alternative (..))
61import qualified Control.Applicative as A (Alternative (..))
@@ -1811,6 +1811,23 @@ pprintTT bound tm = pp startPrec bound tm
1811 | outer > inner = lparen <> doc <> rparen
1811 | outer > inner = lparen <> doc <> rparen
1812 | otherwise = doc
1812 | otherwise = doc
1814+pprintTTClause :: [(Name, Type)] -> Term -> Term -> Doc OutputAnnotation
1815+pprintTTClause pvars lhs rhs =
1816+ vars pvars . group . align $
1817+ pprintTT (map fst pvars) lhs <$>
1819+ (pprintTT (map fst pvars) rhs)
1820+ where vars [] terms = terms
1821+ vars (v:vs) terms =
1822+ annotate AnnKeyword (text "var") <+>
1823+ group (align (sep (punctuate comma (reverse (bindVars [] (v:vs)))))) <+>
1824+ annotate AnnKeyword (text ".") <$>
1827+ bindVars ns ((n, ty):vs) =
1828+ bindingOf n False <+> colon <+> pprintTT ns ty : bindVars (n:ns) vs
1814-- | Pretty-print a raw term.
1831-- | Pretty-print a raw term.
1815pprintRaw :: [Name] -- ^ Bound names, for highlighting
1832pprintRaw :: [Name] -- ^ Bound names, for highlighting
1816 -> Raw -- ^ The term to pretty-print
1833 -> Raw -- ^ The term to pretty-print