@@ -133,41 +133,47 @@ port name tipe maybeMessage =
133133-- TO REPORT
134134
135135
136−namingError :: Text -> Text -> Report.Report
137−namingError pre post =
138− Report.report "NAMING ERROR" Nothing pre (text post)
139−
140−
141136toReport :: RenderType.Localizer -> Error -> Report.Report
142137toReport localizer err =
143138 case err of
144139 Var (VarError kind name problem suggestions) ->
145− let var = kind <> " `" <> name <> "`"
140+ let
141+ variableName =
142+ kind <> " `" <> name <> "`"
143+
144+ learnMore =
145+ Help.toHint $
146+ "New to Elm? Unsure exactly how `import` works? Learn all about it here: "
147+ <> Help.hintLink "imports"
148+
149+ namingError overview maybeStarter specializedSuggestions =
150+ Report.report "NAMING ERROR" Nothing overview $
151+ maybeYouWant maybeStarter specializedSuggestions (Just learnMore)
146152 in
147153 case problem of
148154 Ambiguous ->
149155 namingError
150− ("This usage of " <> var <> " is ambiguous.")
151− (maybeYouWant suggestions)
156+ ("This usage of " <> variableName <> " is ambiguous.")
157+ Nothing
158+ suggestions
152159
153160 UnknownQualifier qualifier localName ->
154161 namingError
155− ("Cannot find " <> var <> ".")
156− ( "No module called `" <> qualifier <> "` has been imported. "
157− <> maybeYouWant (map (\modul -> modul <> "." <> localName) suggestions)
158− )
162+ ("Cannot find " <> variableName)
163+ (Just $ text $ "No module called `" <> qualifier <> "` has been imported.")
164+ (map (\modul -> modul <> "." <> localName) suggestions)
159165
160166 QualifiedUnknown qualifier localName ->
161167 namingError
162− ("Cannot find " <> var <> ".")
163− ( "`" <> qualifier <> "` does not expose `" <> localName <> "`. "
164− <> maybeYouWant (map (\v -> qualifier <> "." <> v) suggestions)
165− )
168+ ("Cannot find " <> variableName)
169+ (Just $ text $ "`" <> qualifier <> "` does not expose `" <> localName <> "`.")
170+ (map (\v -> qualifier <> "." <> v) suggestions)
166171
167172 ExposedUnknown ->
168173 namingError
169− ("Cannot find " <> var)
170− (maybeYouWant suggestions)
174+ ("Cannot find " <> variableName)
175+ Nothing
176+ suggestions
171177
172178 BadRecursion region def defs ->
173179 case defs of
@@ -234,27 +240,25 @@ toReport localizer err =
234240 )
235241
236242 Import name importError ->
237− let moduleName = ModuleName.toText name
238− in
239243 case importError of
240244 ModuleNotFound suggestions ->
241− namingError
242− ("Could not find a module named `" <> moduleName <> "`")
243− (maybeYouWant suggestions)
245+ Report.report "IMPORT ERROR" Nothing
246+ ("Could not find a module named `" <> ModuleName.toText name <> "`")
247+ (maybeYouWant Nothing suggestions Nothing)
244248
245249 ValueNotFound value suggestions ->
246− namingError
247− ("Module `" <> moduleName <> "` does not expose `" <> value <> "`")
248− (maybeYouWant suggestions)
250+ Report.report "IMPORT ERROR" Nothing
251+ ("Module `" <> ModuleName.toText name <> "` does not expose `" <> value <> "`")
252+ (maybeYouWant Nothing suggestions Nothing)
249253
250254 Export name suggestions ->
251− namingError
252− ("Could not export `" <> name <> "` which is not defined in this module.")
253− (maybeYouWant suggestions)
255+ Report.report "EXPOSING ERROR" Nothing
256+ ("Could not expose `" <> name <> "` which is not defined in this module.")
257+ (maybeYouWant Nothing suggestions Nothing)
254258
255259 DuplicateExport name ->
256− namingError
257− ("You are trying to export `" <> name <> "` multiple times!")
260+ Report.report "EXPOSING ERROR" Nothing
261+ ("You are trying to expose `" <> name <> "` multiple times!")
258262 "Remove duplicates until there is only one listed."
259263
260264 Port (PortError name tipe maybeMessage) ->