@@ -2,7 +2,7 @@
22module Reporting.Error.Helpers
33 ( (|>)
44 , functionName, hintLink, stack, reflowParagraph
5− , commaSep, capitalize, ordinalize
5+ , commaSep, capitalize, ordinalize, drawCycle
66 , nearbyNames, distance, maybeYouWant
77 )
88 where
@@ -11,7 +11,8 @@ import Data.Function (on)
1111import qualified Data.Char as Char
1212import qualified Data.List as List
1313import qualified Text.EditDistance as Dist
14−import Text.PrettyPrint.ANSI.Leijen (Doc, (<>), fillSep, hardline, text)
14+import Text.PrettyPrint.ANSI.Leijen
15+ ( Doc, (<>), dullyellow, fillSep, hardline, text, vcat )
1516
1617import qualified AST.Helpers as Help
1718import qualified Elm.Compiler.Version as Compiler
@@ -106,6 +107,25 @@ ordinalize number =
106107
107108
108109
110+drawCycle :: [String] -> Doc
111+drawCycle strings =
112+ let
113+ topLine =
114+ text "┌─────┐"
115+
116+ line str =
117+ text "│ " <> dullyellow (text str)
118+
119+ midLine =
120+ text "│ ↓"
121+
122+ bottomLine =
123+ text "└─────┘"
124+ in
125+ vcat (topLine : List.intersperse midLine (map line strings) ++ [ bottomLine ])
126+
127+
128+
109129-- NEARBY NAMES
110130
111131