on master help sign in
Compose Docs
1a62f62Jason Felice
src/Idris/Output.hs+14−14
@@ -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
88 where
88 where
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
94
94
95− line1 :: String
95+ line1 :: OutputDoc
96− line1 = replicate (length (show si)) ' ' ++ " |"
96+ line1 = text $ replicate (length (show si)) ' ' ++ " |"
97
97
98− line2 :: String
98+ line2 :: OutputDoc
99− line2 = show si ++ " | " ++ fromJust sourceLine
99+ line2 = text $ show si ++ " | " ++ fromJust sourceLine
100
100
101− highlight :: String
101+ indicator :: OutputDoc
102− highlight = replicate (end - sj + 1) ch ++ ellipsis
102+ indicator = text (replicate (end - sj + 1) ch) <> ellipsis
103 where
103 where
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 " ...")
108
108
109− line3 :: String
109+ line3 :: OutputDoc
110− line3 = line1 ++ " " ++ replicate (sj - 1) ' ' ++ highlight
110+ line3 = line1 <> text (replicate sj ' ') <> indicator
111
111
112− source :: String
112+ source :: OutputDoc
113− source = line1 ++ "\n" ++ line2 ++ "\n" ++ line3
113+ source = line1 <$$> line2 <$$> line3
114 layoutSource _ _ = Nothing
114 layoutSource _ _ = Nothing
115
115
116 layoutWarning :: OutputDoc -> Maybe OutputDoc -> OutputDoc -> OutputDoc
116 layoutWarning :: OutputDoc -> Maybe OutputDoc -> OutputDoc -> OutputDoc
test/literate001/expected+1−1
@@ -1,7 +1,7 @@
1./test003a.lidr:1:0:
1./test003a.lidr:1:0:
2 |
2 |
31 | Broken
31 | Broken
4− | ^
4+ |^
5Program line next to comment
5Program line next to comment
6
6
7'a'
7'a'