on master help sign in
Compose Docs
commit1a62f62b3031bd86ad383031f6a4866f9676d260 authorJason Felice <jason.m.felice@gmail.com> dateThu 7 Dec 2017, 11:03 (9 years ago) parent1dc09ac
2 files changed+15−15
src/Idris/Output.hs+14−14 test/literate001/expected+1−1
src/Idris/Output.hs+14−14
@@ -83,7 +83,7 @@ iWarn fc err =
8383 layoutSource :: FC -> String -> Maybe OutputDoc
8484 layoutSource (FC fn (si, sj) (ei, ej)) src =
8585 if haveSource
86− then Just (string source)
86+ then Just source
8787 else Nothing
8888 where
8989 sourceLine :: Maybe String
@@ -92,25 +92,25 @@ iWarn fc err =
9292 haveSource :: Bool
9393 haveSource = isJust sourceLine
9494
95− line1 :: String
96− line1 = replicate (length (show si)) ' ' ++ " |"
95+ line1 :: OutputDoc
96+ line1 = text $ replicate (length (show si)) ' ' ++ " |"
9797
98− line2 :: String
99− line2 = show si ++ " | " ++ fromJust sourceLine
98+ line2 :: OutputDoc
99+ line2 = text $ show si ++ " | " ++ fromJust sourceLine
100100
101− highlight :: String
102− highlight = replicate (end - sj + 1) ch ++ ellipsis
101+ indicator :: OutputDoc
102+ indicator = text (replicate (end - sj + 1) ch) <> ellipsis
103103 where
104104 (end, ch, ellipsis) = case (si == ei, sj == ej) of
105− (True , True ) -> (ej, '^', "")
106− (True , False) -> (ej, '~', "")
107− (False, _ ) -> (length (fromJust sourceLine), '~', " ...")
105+ (True , True ) -> (ej, '^', empty)
106+ (True , False) -> (ej, '~', empty)
107+ (False, _ ) -> (length (fromJust sourceLine), '~', text " ...")
108108
109− line3 :: String
110− line3 = line1 ++ " " ++ replicate (sj - 1) ' ' ++ highlight
109+ line3 :: OutputDoc
110+ line3 = line1 <> text (replicate sj ' ') <> indicator
111111
112− source :: String
113− source = line1 ++ "\n" ++ line2 ++ "\n" ++ line3
112+ source :: OutputDoc
113+ source = line1 <$$> line2 <$$> line3
114114 layoutSource _ _ = Nothing
115115
116116 layoutWarning :: OutputDoc -> Maybe OutputDoc -> OutputDoc -> OutputDoc
test/literate001/expected+1−1
@@ -1,7 +1,7 @@
11./test003a.lidr:1:0:
22 |
331 | Broken
4− | ^
4+ |^
55Program line next to comment
66
77'a'