minor cleanup

This commit is contained in:
Arya Irani 2018-08-13 12:25:16 -04:00
parent 5bb74984b7
commit 7d843f1660

View File

@ -71,11 +71,8 @@ renderTypeError :: forall v a. (Var v, Annotated a, Eq a, Show a)
renderTypeError env e src = AT.AnnotatedDocument . Seq.fromList $ case e of
Mismatch {..} ->
[ (fromString . annotatedToEnglish) mismatchSite
-- , " has a type mismatch:\n\n"
, " has a type mismatch (", AT.Describe Color.ErrorSite, " below):\n\n"
, AT.Blockquote $ AT.markup (fromString src)
(Set.fromList $
toList ((,Color.ErrorSite) <$> rangeForAnnotated mismatchSite))
, annotatedAsErrorSite src mismatchSite
, "\n"
, "The two types involved are:\n\n"
, " ", AT.Text $ styleInOverallType env overallType1 leaf1 Color.Type1
@ -119,8 +116,11 @@ renderTypeError env e src = AT.AnnotatedDocument . Seq.fromList $ case e of
, "Here is a summary of the Note:\n"
] ++ summary note
where
maxTermDisplay = 20
renderTerm e = let s = show e in -- todo: pretty print
if length s > 10 then fromString (take 10 s <> "...") else fromString s
if length s > maxTermDisplay
then fromString (take maxTermDisplay s <> "...")
else fromString s
summary :: C.Note v a -> [AT.Section Color.Style]
summary note =
[ " simple cause:\n"
@ -296,10 +296,6 @@ rangeForAnnotated a = case ann a of
Intrinsic -> Nothing
Ann start end -> Just $ Range start end
-- highlightString :: String -> [()]
--
typeErrorFromNote :: forall loc v. (Ord loc, Var v) => C.Note v loc -> TypeError v loc
typeErrorFromNote n@(C.Note (C.TypeMismatch ctx) path) =
let