diff --git a/builder/src/Reporting/Exit.hs b/builder/src/Reporting/Exit.hs index bbeca971..6ffd5357 100644 --- a/builder/src/Reporting/Exit.hs +++ b/builder/src/Reporting/Exit.hs @@ -133,7 +133,7 @@ diffToReport diff = [ D.indent 4 $ D.red $ D.fromChars $ Pkg.toChars pkg, "Maybe you want one of these instead?", D.indent 4 $ D.dullyellow $ D.vcat $ map (D.fromChars . Pkg.toChars) suggestions, - "But check to see all possibilities!" + "But check to see all possibilities!" ] DiffUnknownVersion _pkg vsn realVersions -> Help.docReport @@ -226,7 +226,7 @@ bumpToReport bump = "that", "version", "on", - ".", + ".", "That", "means", "there", @@ -2107,7 +2107,7 @@ makeToReport make = D.indent 2 $ D.fillSep [D.cyan "Html" <> ".text", D.dullyellow "\"Hello!\""] ], D.reflow $ - "Or use https://package.gren-lang.org/packages/gren/core/latest/Platform#worker to\ + "Or use https://packages.gren-lang.org/package/gren-lang/core/latest/module/Platform#worker to\ \ make a `main` with no user interface." ] _ : _ -> @@ -2134,7 +2134,7 @@ makeToReport make = D.indent 2 $ D.fillSep [D.cyan "Html" <> ".text", D.dullyellow "\"Hello!\""] ], D.reflow $ - "Or use https://package.gren-lang.org/packages/gren/core/latest/Platform#worker to\ + "Or use https://packages.gren-lang.org/package/gren-lang/core/latest/module/Platform#worker to\ \ make a `main` with no user interface." ] MakeCannotBuild buildProblem -> diff --git a/compiler/src/Reporting/Error/Canonicalize.hs b/compiler/src/Reporting/Error/Canonicalize.hs index 99fe0aac..ca0a8754 100644 --- a/compiler/src/Reporting/Error/Canonicalize.hs +++ b/compiler/src/Reporting/Error/Canonicalize.hs @@ -502,10 +502,10 @@ toReport source err = D.stack [ D.reflow $ "If you want the behavior of (%) like in JavaScript, switch to:\ - \ ", + \ ", D.reflow $ "If you want modular arithmetic like in math, switch to:\ - \ ", + \ ", D.reflow $ "The difference is how things work when negative numbers are involved." ] @@ -1097,85 +1097,6 @@ toQualString :: Name.Name -> Name.Name -> String toQualString prefix name = Name.toChars prefix ++ "." ++ Name.toChars name -{-- VAR ERROR - -varErrorToReport :: VarError -> Report.Report -varErrorToReport (VarError kind name problem suggestions) = - let - learnMore orMaybe = - D.reflow $ - orMaybe <> " `import` works different than you expect? Learn all about it here: " - <> D.hintLink "imports" - - namingError overview maybeStarter specializedSuggestions = - Report.reportDoc "NAMING ERROR" Nothing overview $ - case D.maybeYouWant' maybeStarter specializedSuggestions of - Nothing -> - learnMore "Maybe" - Just doc -> - D.stack [ doc, learnMore "Or maybe" ] - - specialNamingError specialHint = - Report.reportDoc "NAMING ERROR" Nothing (cannotFind kind name) (D.hsep specialHint) - in - case problem of - Ambiguous -> - namingError (ambiguous kind name) Nothing suggestions - - UnknownQualifier qualifier localName -> - namingError - (cannotFind kind name) - (Just $ text $ "No module called `" <> qualifier <> "` has been imported.") - (map (\modul -> modul <> "." <> localName) suggestions) - - QualifiedUnknown qualifier localName -> - namingError - (cannotFind kind name) - (Just $ text $ "`" <> qualifier <> "` does not expose `" <> localName <> "`.") - (map (\v -> qualifier <> "." <> v) suggestions) - - ExposedUnknown -> - case name of - "!=" -> specialNamingError (notEqualsHint name) - "!==" -> specialNamingError (notEqualsHint name) - "===" -> specialNamingError equalsHint - "%" -> specialNamingError modHint - _ -> namingError (cannotFind kind name) Nothing suggestions - -cannotFind :: VarKind -> Text -> [Doc] -cannotFind kind rawName = - let ( a, thing, name ) = toKindInfo kind rawName in - [ "Cannot", "find", a, thing, "named", D.dullyellow name <> ":" ] - -ambiguous :: VarKind -> Text -> [Doc] -ambiguous kind rawName = - let ( _a, thing, name ) = toKindInfo kind rawName in - [ "This", "usage", "of", "the", D.dullyellow name, thing, "is", "ambiguous." ] - -notEqualsHint :: Text -> [Doc] -notEqualsHint op = - [ "Looking", "for", "the", "“not", "equal”", "operator?", "The", "traditional" - , D.dullyellow $ text $ "(" <> op <> ")" - , "is", "replaced", "by", D.green "(/=)", "in", "Gren.", "It", "is", "meant" - , "to", "look", "like", "the", "“not", "equal”", "sign", "from", "math!", "(≠)" - ] - -equalsHint :: [Doc] -equalsHint = - [ "A", "special", D.dullyellow "(===)", "operator", "is", "not", "needed" - , "in", "Gren.", "We", "use", D.green "(==)", "for", "everything!" - ] - -modHint :: [Doc] -modHint = - [ "Rather", "than", "a", D.dullyellow "(%)", "operator," - , "Gren", "has", "a", D.green "modBy", "function." - , "Learn", "more", "here:" - , "" - ] - --} - -- ARG MISMATCH _argMismatchReport :: Code.Source -> A.Region -> String -> Name.Name -> Int -> Int -> Report.Report diff --git a/compiler/src/Reporting/Error/Docs.hs b/compiler/src/Reporting/Error/Docs.hs index 9aa04ef9..927a4d78 100644 --- a/compiler/src/Reporting/Error/Docs.hs +++ b/compiler/src/Reporting/Error/Docs.hs @@ -55,11 +55,10 @@ toReports source err = source region Nothing - ( D.reflow $ + ( D.reflow "You must have a documentation comment between the module\ \ declaration and the imports.", - D.reflow - "Learn more at " + D.empty ) ImplicitExposing region -> NE.singleton $ @@ -97,11 +96,8 @@ toSyntaxProblemReport source problem = region Nothing ( D.reflow "I was partway through parsing your module documentation, but I got stuck here:", - D.stack $ - [ D.reflow details, - D.toSimpleHint $ - "Read through for\ - \ tips on how to write module documentation!" + D.stack + [ D.reflow details ] ) in case problem of diff --git a/compiler/src/Reporting/Error/Syntax.hs b/compiler/src/Reporting/Error/Syntax.hs index d08809d5..94982115 100644 --- a/compiler/src/Reporting/Error/Syntax.hs +++ b/compiler/src/Reporting/Error/Syntax.hs @@ -634,7 +634,7 @@ noteForPortsInPackage = D.stack [ D.toSimpleNote $ "One of the major goals of the package ecosystem is to be completely written\ - \ in Gren. This means when you install an Gren package, you can be sure you are safe\ + \ in Gren. This means when you install a Gren package, you can be sure you are safe\ \ from security issues on install and that you are not going to get any runtime\ \ exceptions coming from your new dependency. This design also sets the ecosystem\ \ up to target other platforms more easily (like mobile phones, WebAssembly, etc.)\ @@ -792,7 +792,7 @@ toParseErrorReport source modul = "I got stuck here:", D.stack [ D.reflow $ - "I am not sure what is going on, but I recommend starting an Gren\ + "I am not sure what is going on, but I recommend starting a Gren\ \ file with the following lines:", D.indent 4 $ D.vcat $ @@ -803,7 +803,7 @@ toParseErrorReport source modul = ], D.reflow $ "You should be able to copy those lines directly into your file. Check out the\ - \ examples at for more help getting started!", + \ examples at for more help getting started!", D.toSimpleNote $ "This can also happen when something is indented too much!" ] diff --git a/hints/comparing-records.md b/hints/comparing-records.md index 7b9bef7d..8e015364 100644 --- a/hints/comparing-records.md +++ b/hints/comparing-records.md @@ -35,7 +35,7 @@ viewStudent student = li [] [ text student.name ] ``` -If you are worried about the performance of changing the order or updating information about particular students, you can start using the [`Html.Lazy`](https://package.gren-lang.org/packages/gren/html/latest/Html-Lazy) and [`Html.Keyed`](https://package.gren-lang.org/packages/gren/html/latest/Html-Keyed) modules. The updated code would look something like this: +If you are worried about the performance of changing the order or updating information about particular students, you can start using the [`Html.Lazy`](https://packages.gren-lang.org/package/gren-lang/browser/latest/module/Html.Lazy) and [`Html.Keyed`](https://packages.gren-lang.org/package/gren-lang/browser/latest/module/Html.Keyed) modules. The updated code would look something like this: ```gren import Html exposing (..) diff --git a/hints/imports.md b/hints/imports.md index 76e620d2..8d284769 100644 --- a/hints/imports.md +++ b/hints/imports.md @@ -8,7 +8,7 @@ When getting started with Gren, it is pretty common to have questions about how An Gren file is called a **module**. To access code in other files, you need to `import` it! -So say you want to use the [`div`](http://package.gren-lang.org/packages/gren-lang/html/latest/Html#div) function from the [`gren-lang/html`](http://package.gren-lang.org/packages/gren-lang/html/latest) package. The simplest way is to import it like this: +So say you want to use the [`div`](https://packages.gren-lang.org/package/gren-lang/browser/latest/module/Html#div) function from the [`gren-lang/browser`](https://packages.gren-lang.org/package/gren-lang/browser/latest/overview) package. The simplest way is to import it like this: ```gren import Html @@ -20,7 +20,7 @@ main = After saying `import Html` we can refer to anything inside that module as long as it is _qualified_. This works for: - **Values** — we can refer to `Html.text`, `Html.h1`, etc. -- **Types** — We can refer to [`Attribute`](http://package.gren-lang.org/packages/gren-lang/html/latest/Html#Attribute) as `Html.Attribute`. +- **Types** — We can refer to [`Attribute`](https://packages.gren-lang.org/package/gren-lang/browser/latest/module/Html#Attribute) as `Html.Attribute`. So if we add a type annotation to `main` it would look like this: @@ -32,7 +32,7 @@ main = Html.div [] [] ``` -We are referring to the [`Html`](http://package.gren-lang.org/packages/gren-lang/html/latest/Html#Html) type, using its _qualified_ name `Html.Html`. This can feel weird at first, but it starts feeling natural quite quickly! +We are referring to the [`Html`](https://packages.gren-lang.org/package/gren-lang/browser/latest/module/Html#Html) type, using its _qualified_ name `Html.Html`. This can feel weird at first, but it starts feeling natural quite quickly! > **Note:** Modules do not contain other modules. So the `Html` module _does not_ contain the `Html.Attributes` module. Those are separate names that happen to have some overlap. So if you say `import Html` you _do not_ get access to `Html.Attributes.style`. You must `import Html.Attributes` module separately. @@ -50,7 +50,7 @@ main = Html.div [ A.style "color" "red" ] [ Html.text "Hello!" ] ``` -Saying `import Html.Attributes as A` lets us refer to any value or type in `Html.Attributes` as long as it is qualified with an `A`. So now we can refer to [`style`](http://package.gren-lang.org/packages/gren-lang/html/latest/Html-Attributes#style) as `A.style`. +Saying `import Html.Attributes as A` lets us refer to any value or type in `Html.Attributes` as long as it is qualified with an `A`. So now we can refer to [`style`](https://packages.gren-lang.org/package/gren-lang/browser/version/6.0.0/module/Html.Attributes#style) as `A.style`.
diff --git a/hints/init.md b/hints/init.md index 76039c17..83411bf9 100644 --- a/hints/init.md +++ b/hints/init.md @@ -1,4 +1,4 @@ -# Creating an Gren project +# Creating a Gren project The main goal of `gren init` is to get you to this page! @@ -6,9 +6,9 @@ It just creates an `gren.json` file and a `src/` directory for your code. ## What is `gren.json`? -This file describes your project. It lists all of the packages you depend upon, so it will say the particular version of [`gren/core`](https://package.gren-lang.org/packages/gren/core/latest/) and [`gren/html`](https://package.gren-lang.org/packages/gren/html/latest/) that you are using. It makes builds reproducible! You can read a bit more about it [here](https://github.com/gren/compiler/blob/master/docs/gren.json/application.md). +This file describes your project. It lists all of the packages you depend upon, so it will say the particular version of [`gren-lang/core`](https://packages.gren-lang.org/package/gren-lang/core/latest/overview) and [`gren-lang/browser`](https://packages.gren-lang.org/package/gren-lang/browser/latest/overview) that you are using. It makes builds reproducible! You can read a bit more about it [here](https://gren-lang.org/book/appendix/gren_json/). -You should generally not edit it by hand. It is better to add new dependencies with commands like `gren install gren/http` or `gren install gren/json`. +You should generally not edit it by hand. It is better to add new dependencies with commands like `gren package install gren-lang/test` or `gren package install gren-lang/parser`. ## What goes in `src/`? diff --git a/hints/missing-patterns.md b/hints/missing-patterns.md index 8635c012..f9040756 100644 --- a/hints/missing-patterns.md +++ b/hints/missing-patterns.md @@ -49,7 +49,7 @@ Now the compiler will say "hey, what should `toName` do when it sees a `Visitor` Imagine that the `User` type appears in 20 or 30 functions across your project. When we add a `Visitor` variant, the compiler points out all the places that need to be updated. That is very convenient, but in a big project, maybe you want to get through it extra quickly. -In that case, it can be helpful to use [`Debug.todo`](https://package.gren-lang.org/packages/gren-lang/core/latest/Debug#todo) to leave some code incomplete: +In that case, it can be helpful to use [`Debug.todo`](https://packages.gren-lang.org/package/gren-lang/core/latest/module/Debug#todo) to leave some code incomplete: ```gren type User diff --git a/src/Terminal/Parser.gren b/src/Terminal/Parser.gren index 1fde1930..ab7ef5ea 100644 --- a/src/Terminal/Parser.gren +++ b/src/Terminal/Parser.gren @@ -230,7 +230,7 @@ parser = , PP.empty , PP.words """ - This tries to compile an Gren file named src/Main.gren, generating an index.html + This tries to compile a Gren file named src/Main.gren, generating an index.html file if possible. """ ]