8000 Adds punctuation to error messages by pete-ts · Pull Request #1122 · unisonweb/unison · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Adds punctuation to error messages #1122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTORS.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ The format for this list: name, GitHub handle, and then optional blurb about wha
* Alvaro Carrasco (@alvaroc1)
* Vladislav Zavialov (@int-index)
* Aaron Novstrup (@anovstrup)
* Pete Tsamouris (@pete-ts)
9 changes: 5 additions & 4 deletions parser-typechecker/src/Unison/Codebase/FileCodebase.hs
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,19 @@ initCodebase :: FilePath -> IO (Codebase IO Symbol Ann)
initCodebase dir = do
let path = dir </> codebasePath
let theCodebase = codebase1 V1.formatSymbol formatAnn path
let prettyDir = P.endSentence . P.string $ dir
whenM (exists path) $
do PT.putPrettyLn'
. P.warnCallout
. P.wrap
$ "It looks like there's already a codebase in: "
<> P.string dir
<> prettyDir
exitFailure
PT.putPrettyLn'
. P.warnCallout
. P.wrap
$ "Initializing a new codebase in: "
<> P.string dir
<> prettyDir
initialize path
Codebase.initializeCodebase theCodebase
pure theCodebase
Expand All @@ -149,14 +150,14 @@ getCodebaseOrExit mdir = do
Just dir -> pure
( dir
, "No codebase exists in "
<> P.string dir
<> (P.endSentence . P.string $ dir)
<> P.newline
<> "Run `ucm -codebase "
<> P.string dir
<> " init` to create one, then try again!" )
Nothing -> do
dir <- getHomeDirectory
let errMsg = P.lines [ "No codebase exists in " <> P.string dir
let errMsg = P.lines [ "No codebase exists in " <> (P.endSentence . P.string $ dir)
, "Run `ucm init` to create one, then try again!" ]
pure (dir, errMsg)

Expand Down
4 changes: 4 additions & 0 deletions parser-typechecker/src/Unison/Util/Pretty.hs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ module Unison.Util.Pretty (
spacedMap,
spacesIfBreak,
string,
endSentence,
surroundCommas,
syntaxToColor,
text,
Expand Down Expand Up @@ -448,6 +449,9 @@ num n = fromString (show n)
string :: IsString s => String -> Pretty s
string = fromString

endSentence :: IsString s => Pretty s -> Pretty s
endSentence p = group (p <> ".")

shown :: (Show a, IsString s) => a -> Pretty s
shown = fromString . show

Expand Down
0