@@ -83,7 +83,7 @@ iWarn fc err =
83 layoutSource :: FC -> String -> Maybe OutputDoc
83 layoutSource :: FC -> String -> Maybe OutputDoc
84 layoutSource (FC fn (si, sj) (ei, ej)) src =
84 layoutSource (FC fn (si, sj) (ei, ej)) src =
85 if haveSource
85 if haveSource
86− then Just (string source)
86+ then Just source
87 else Nothing
87 else Nothing
89 sourceLine :: Maybe String
89 sourceLine :: Maybe String
@@ -92,25 +92,25 @@ iWarn fc err =
92 haveSource :: Bool
92 haveSource :: Bool
93 haveSource = isJust sourceLine
93 haveSource = isJust sourceLine
95− line1 :: String
95+ line1 :: OutputDoc
96− line1 = replicate (length (show si)) ' ' ++ " |"
96+ line1 = text $ replicate (length (show si)) ' ' ++ " |"
98− line2 :: String
98+ line2 :: OutputDoc
99− line2 = show si ++ " | " ++ fromJust sourceLine
99+ line2 = text $ show si ++ " | " ++ fromJust sourceLine
101− highlight :: String
101+ indicator :: OutputDoc
102− highlight = replicate (end - sj + 1) ch ++ ellipsis
102+ indicator = text (replicate (end - sj + 1) ch) <> ellipsis
104 (end, ch, ellipsis) = case (si == ei, sj == ej) of
104 (end, ch, ellipsis) = case (si == ei, sj == ej) of
105− (True , True ) -> (ej, '^', "")
105+ (True , True ) -> (ej, '^', empty)
106− (True , False) -> (ej, '~', "")
106+ (True , False) -> (ej, '~', empty)
107− (False, _ ) -> (length (fromJust sourceLine), '~', " ...")
107+ (False, _ ) -> (length (fromJust sourceLine), '~', text " ...")
109− line3 :: String
109+ line3 :: OutputDoc
110− line3 = line1 ++ " " ++ replicate (sj - 1) ' ' ++ highlight
110+ line3 = line1 <> text (replicate sj ' ') <> indicator
112− source :: String
112+ source :: OutputDoc
113− source = line1 ++ "\n" ++ line2 ++ "\n" ++ line3
113+ source = line1 <$$> line2 <$$> line3
114 layoutSource _ _ = Nothing
114 layoutSource _ _ = Nothing
116 layoutWarning :: OutputDoc -> Maybe OutputDoc -> OutputDoc -> OutputDoc
116 layoutWarning :: OutputDoc -> Maybe OutputDoc -> OutputDoc -> OutputDoc