Merge pull request #2192 from rtfeldman/rename-base-to-pf

Rename `base` package to `pf` everywhere, to match tutorial
This commit is contained in:
Richard Feldman 2021-12-14 22:00:22 -05:00 committed by GitHub
commit 01038ed53c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 94 additions and 94 deletions

View file

@ -1,7 +1,7 @@
app "multi-dep-str" app "multi-dep-str"
packages { base: "platform" } packages { pf: "platform" }
imports [ Dep1 ] imports [ Dep1 ]
provides [ main ] to base provides [ main ] to pf
main : Str main : Str
main = Dep1.str1 main = Dep1.str1

View file

@ -1,7 +1,7 @@
app "multi-dep-thunk" app "multi-dep-thunk"
packages { base: "platform" } packages { pf: "platform" }
imports [ Dep1 ] imports [ Dep1 ]
provides [ main ] to base provides [ main ] to pf
main : Str main : Str
main = Dep1.value1 {} main = Dep1.value1 {}

View file

@ -621,13 +621,13 @@ toStr : Num * -> Str
## Examples: ## Examples:
## ##
## In some countries (e.g. USA and UK), a comma is used to separate thousands: ## In some countries (e.g. USA and UK), a comma is used to separate thousands:
## >>> Num.format 1_000_000 { base: Decimal, wholeSep: { mark: ",", places: 3 } } ## >>> Num.format 1_000_000 { pf: Decimal, wholeSep: { mark: ",", places: 3 } }
## ##
## Sometimes when rendering bits, it's nice to group them into groups of 4: ## Sometimes when rendering bits, it's nice to group them into groups of 4:
## >>> Num.format 1_000_000 { base: Binary, wholeSep: { mark: " ", places: 4 } } ## >>> Num.format 1_000_000 { pf: Binary, wholeSep: { mark: " ", places: 4 } }
## ##
## It's also common to render hexadecimal in groups of 2: ## It's also common to render hexadecimal in groups of 2:
## >>> Num.format 1_000_000 { base: Hexadecimal, wholeSep: { mark: " ", places: 2 } } ## >>> Num.format 1_000_000 { pf: Hexadecimal, wholeSep: { mark: " ", places: 2 } }
format : format :
Num *, Num *,
{ {

View file

@ -2625,7 +2625,7 @@ mod test_fmt {
fn single_line_app() { fn single_line_app() {
module_formats_same(indoc!( module_formats_same(indoc!(
r#" r#"
app "Foo" packages { base: "platform" } imports [] provides [ main ] to base"# app "Foo" packages { pf: "platform" } imports [] provides [ main ] to pf"#
)); ));
} }

View file

@ -685,7 +685,7 @@ enum HeaderFor<'a> {
to_platform: To<'a>, to_platform: To<'a>,
}, },
PkgConfig { PkgConfig {
/// usually `base` /// usually `pf`
config_shorthand: &'a str, config_shorthand: &'a str,
/// the type scheme of the main function (required by the platform) /// the type scheme of the main function (required by the platform)
/// (currently unused) /// (currently unused)
@ -2846,7 +2846,7 @@ fn send_header<'a>(
// For each of our imports, add an entry to deps_by_name // For each of our imports, add an entry to deps_by_name
// //
// e.g. for `imports [ base.Foo.{ bar } ]`, add `Foo` to deps_by_name // e.g. for `imports [ pf.Foo.{ bar } ]`, add `Foo` to deps_by_name
// //
// Also build a list of imported_values_to_expose (like `bar` above.) // Also build a list of imported_values_to_expose (like `bar` above.)
for (qualified_module_name, exposed_idents, region) in imported.into_iter() { for (qualified_module_name, exposed_idents, region) in imported.into_iter() {
@ -3067,7 +3067,7 @@ fn send_header_two<'a>(
// For each of our imports, add an entry to deps_by_name // For each of our imports, add an entry to deps_by_name
// //
// e.g. for `imports [ base.Foo.{ bar } ]`, add `Foo` to deps_by_name // e.g. for `imports [ pf.Foo.{ bar } ]`, add `Foo` to deps_by_name
// //
// Also build a list of imported_values_to_expose (like `bar` above.) // Also build a list of imported_values_to_expose (like `bar` above.)
for (qualified_module_name, exposed_idents, region) in imported.into_iter() { for (qualified_module_name, exposed_idents, region) in imported.into_iter() {
@ -4429,7 +4429,7 @@ fn to_missing_platform_report(module_id: ModuleId, other: PlatformPath) -> Strin
alloc.reflow("I could not find a platform based on your input file."), alloc.reflow("I could not find a platform based on your input file."),
alloc.reflow(r"Does the module header contain an entry that looks like this:"), alloc.reflow(r"Does the module header contain an entry that looks like this:"),
alloc alloc
.parser_suggestion(" packages { base: \"platform\" }") .parser_suggestion(" packages { pf: \"platform\" }")
.indent(4), .indent(4),
alloc.reflow("See also TODO."), alloc.reflow("See also TODO."),
]); ]);

View file

@ -359,7 +359,7 @@ impl fmt::Debug for ModuleId {
} }
} }
/// base.Task /// pf.Task
/// 1. build mapping from short name to package /// 1. build mapping from short name to package
/// 2. when adding new modules from package we need to register them in some other map (this module id goes with short name) (shortname, module-name) -> moduleId /// 2. when adding new modules from package we need to register them in some other map (this module id goes with short name) (shortname, module-name) -> moduleId
/// 3. pass this around to other modules getting headers parsed. when parsing interfaces we need to use this map to reference shortnames /// 3. pass this around to other modules getting headers parsed. when parsing interfaces we need to use this map to reference shortnames

View file

@ -204,7 +204,7 @@ pub enum ImportsEntry<'a> {
Collection<'a, Loc<ExposesEntry<'a, &'a str>>>, Collection<'a, Loc<ExposesEntry<'a, &'a str>>>,
), ),
/// e.g. `base.Task` or `base.Task.{ after }` or `base.{ Task.{ Task, after } }` /// e.g. `pf.Task` or `pf.Task.{ after }` or `pf.{ Task.{ Task, after } }`
Package( Package(
&'a str, &'a str,
ModuleName<'a>, ModuleName<'a>,

View file

@ -786,7 +786,7 @@ fn imports_entry<'a>() -> impl Parser<'a, ImportsEntry<'a>, EImports> {
map_with_arena!( map_with_arena!(
and!( and!(
and!( and!(
// e.g. `base.` // e.g. `pf.`
maybe!(skip_second!( maybe!(skip_second!(
shortname(), shortname(),
word1(b'.', EImports::ShorthandDot) word1(b'.', EImports::ShorthandDot)

View file

@ -4,10 +4,10 @@ App {
"quicksort", "quicksort",
), ),
packages: [ packages: [
|L 1-1, C 15-33| Entry { |L 1-1, C 15-31| Entry {
shorthand: "base", shorthand: "pf",
spaces_after_shorthand: [], spaces_after_shorthand: [],
package_or_path: |L 1-1, C 21-33| Path( package_or_path: |L 1-1, C 19-31| Path(
PlainLine( PlainLine(
"./platform", "./platform",
), ),
@ -28,8 +28,8 @@ App {
"quicksort", "quicksort",
), ),
], ],
to: |L 3-3, C 30-34| ExistingPackage( to: |L 3-3, C 30-32| ExistingPackage(
"base", "pf",
), ),
before_header: [], before_header: [],
after_app_keyword: [], after_app_keyword: [],

View file

@ -1,4 +1,4 @@
app "quicksort" app "quicksort"
packages { base: "./platform" } packages { pf: "./platform" }
imports [ foo.Bar.Baz ] imports [ foo.Bar.Baz ]
provides [ quicksort ] to base provides [ quicksort ] to pf

View file

@ -4,10 +4,10 @@ App {
"quicksort", "quicksort",
), ),
packages: [ packages: [
|L 1-1, C 15-33| Entry { |L 1-1, C 15-31| Entry {
shorthand: "base", shorthand: "pf",
spaces_after_shorthand: [], spaces_after_shorthand: [],
package_or_path: |L 1-1, C 21-33| Path( package_or_path: |L 1-1, C 19-31| Path(
PlainLine( PlainLine(
"./platform", "./platform",
), ),
@ -53,8 +53,8 @@ App {
"quicksort", "quicksort",
), ),
], ],
to: |L 7-7, C 31-35| ExistingPackage( to: |L 7-7, C 31-33| ExistingPackage(
"base", "pf",
), ),
before_header: [], before_header: [],
after_app_keyword: [], after_app_keyword: [],

View file

@ -1,8 +1,8 @@
app "quicksort" app "quicksort"
packages { base: "./platform", } packages { pf: "./platform", }
imports [ foo.Bar.{ imports [ foo.Bar.{
Baz, Baz,
FortyTwo, FortyTwo,
# I'm a happy comment # I'm a happy comment
} ] } ]
provides [ quicksort, ] to base provides [ quicksort, ] to pf

View file

@ -58,9 +58,9 @@ mod insert_doc_syntax_highlighting {
pub const HELLO_WORLD: &str = r#" pub const HELLO_WORLD: &str = r#"
app "test-app" app "test-app"
packages { base: "platform" } packages { pf: "platform" }
imports [] imports []
provides [ main ] to base provides [ main ] to pf
main = "Hello, world!" main = "Hello, world!"

View file

@ -17,9 +17,9 @@ For convenience and consistency, there is only one way to format roc.
pub const HELLO_WORLD: &str = r#" pub const HELLO_WORLD: &str = r#"
app "test-app" app "test-app"
packages { base: "platform" } packages { pf: "platform" }
imports [] imports []
provides [ main ] to base provides [ main ] to pf
main = "Hello, world!" main = "Hello, world!"

View file

@ -1,7 +1,7 @@
app "cfold" app "cfold"
packages { base: "platform" } packages { pf: "platform" }
imports [base.Task] imports [pf.Task]
provides [ main ] to base provides [ main ] to pf
# adapted from https://github.com/koka-lang/koka/blob/master/test/bench/haskell/cfold.hs # adapted from https://github.com/koka-lang/koka/blob/master/test/bench/haskell/cfold.hs

View file

@ -1,7 +1,7 @@
app "closure" app "closure"
packages { base: "platform" } packages { pf: "platform" }
imports [base.Task] imports [pf.Task]
provides [ main ] to base provides [ main ] to pf
# see https://github.com/rtfeldman/roc/issues/985 # see https://github.com/rtfeldman/roc/issues/985

View file

@ -1,7 +1,7 @@
app "deriv" app "deriv"
packages { base: "platform" } packages { pf: "platform" }
imports [base.Task] imports [pf.Task]
provides [ main ] to base provides [ main ] to pf
# based on: https://github.com/koka-lang/koka/blob/master/test/bench/haskell/deriv.hs # based on: https://github.com/koka-lang/koka/blob/master/test/bench/haskell/deriv.hs

View file

@ -1,7 +1,7 @@
app "nqueens" app "nqueens"
packages { base: "platform" } packages { pf: "platform" }
imports [base.Task] imports [pf.Task]
provides [ main ] to base provides [ main ] to pf
main : Task.Task {} [] main : Task.Task {} []
main = main =

View file

@ -1,7 +1,7 @@
app "quicksortapp" app "quicksortapp"
packages { base: "platform" } packages { pf: "platform" }
imports [base.Task, Quicksort] imports [pf.Task, Quicksort]
provides [ main ] to base provides [ main ] to pf
main : Task.Task {} [] main : Task.Task {} []
main = main =

View file

@ -1,7 +1,7 @@
app "rbtree-ck" app "rbtree-ck"
packages { base: "platform" } packages { pf: "platform" }
imports [base.Task] imports [pf.Task]
provides [ main ] to base provides [ main ] to pf
Color : [ Red, Black ] Color : [ Red, Black ]

View file

@ -1,7 +1,7 @@
app "rbtree-del" app "rbtree-del"
packages { base: "platform" } packages { pf: "platform" }
imports [base.Task] imports [pf.Task]
provides [ main ] to base provides [ main ] to pf
Color : [ Red, Black ] Color : [ Red, Black ]

View file

@ -1,7 +1,7 @@
app "rbtree-insert" app "rbtree-insert"
packages { base: "platform" } packages { pf: "platform" }
imports [base.Task] imports [pf.Task]
provides [ main ] to base provides [ main ] to pf
main : Task.Task {} [] main : Task.Task {} []
main = main =

View file

@ -1,7 +1,7 @@
app "test-astar" app "test-astar"
packages { base: "platform" } packages { pf: "platform" }
imports [base.Task, AStar] imports [pf.Task, AStar]
provides [ main ] to base provides [ main ] to pf
main : Task.Task {} [] main : Task.Task {} []
main = main =

View file

@ -1,7 +1,7 @@
app "test-base64" app "test-base64"
packages { base: "platform" } packages { pf: "platform" }
imports [base.Task, Base64 ] imports [pf.Task, Base64 ]
provides [ main ] to base provides [ main ] to pf
IO a : Task.Task a [] IO a : Task.Task a []

View file

@ -1,9 +1,9 @@
#!/usr/bin/env roc #!/usr/bin/env roc
app "echo" app "echo"
packages { base: "platform" } packages { pf: "platform" }
imports [ base.Task.{ Task, await }, base.Stdout, base.Stdin ] imports [ pf.Task.{ Task, await }, pf.Stdout, pf.Stdin ]
provides [ main ] to base provides [ main ] to pf
main : Task {} * main : Task {} *
main = main =

View file

@ -1,7 +1,7 @@
app "effect-example" app "effect-example"
packages { base: "thing/platform-dir" } packages { pf: "thing/platform-dir" }
imports [fx.Effect] imports [fx.Effect]
provides [ main ] to base provides [ main ] to pf
main : Effect.Effect {} main : Effect.Effect {}
main = main =

View file

@ -1,6 +1,6 @@
interface Context interface Context
exposes [ Context, Data, with, getChar, Option, pushStack, popStack, toStr, inWhileScope ] exposes [ Context, Data, with, getChar, Option, pushStack, popStack, toStr, inWhileScope ]
imports [ base.File, base.Task.{ Task }, Variable.{ Variable } ] imports [ pf.File, pf.Task.{ Task }, Variable.{ Variable } ]
Option a : [ Some a, None ] Option a : [ Some a, None ]

View file

@ -1,8 +1,8 @@
#!/usr/bin/env roc #!/usr/bin/env roc
app "false" app "false"
packages { base: "platform" } packages { pf: "platform" }
imports [ base.Task.{ Task }, base.Stdout, base.Stdin, Context.{ Context }, Variable.{ Variable } ] imports [ pf.Task.{ Task }, pf.Stdout, pf.Stdin, Context.{ Context }, Variable.{ Variable } ]
provides [ main ] to base provides [ main ] to pf
# An interpreter for the False programming language: https://strlen.com/false-language/ # An interpreter for the False programming language: https://strlen.com/false-language/
# This is just a silly example to test this variety of program. # This is just a silly example to test this variety of program.

View file

@ -1,7 +1,7 @@
app "fib" app "fib"
packages { base: "platform" } packages { pf: "platform" }
imports [] imports []
provides [ main ] to base provides [ main ] to pf
main = \n -> fib n 0 1 main = \n -> fib n 0 1

View file

@ -1,7 +1,7 @@
app "hello-rust" app "hello-rust"
packages { base: "platform" } packages { pf: "platform" }
imports [] imports []
provides [ main ] to base provides [ main ] to pf
greeting = greeting =
hi = "Hello" hi = "Hello"

View file

@ -1,7 +1,7 @@
app "hello-swift" app "hello-swift"
packages { base: "platform" } packages { pf: "platform" }
imports [] imports []
provides [ main ] to base provides [ main ] to pf
main = main =
host = "Swift" host = "Swift"

View file

@ -1,7 +1,7 @@
app "hello-web" app "hello-web"
packages { base: "platform" } packages { pf: "platform" }
imports [] imports []
provides [ main ] to base provides [ main ] to pf
greeting = greeting =
hi = "Hello" hi = "Hello"

View file

@ -1,6 +1,6 @@
app "hello-world" app "hello-world"
packages { base: "platform" } packages { pf: "platform" }
imports [] imports []
provides [ main ] to base provides [ main ] to pf
main = "Hello, World!\n" main = "Hello, World!\n"

View file

@ -1,7 +1,7 @@
app "hello-world" app "hello-world"
packages { base: "platform" } packages { pf: "platform" }
imports [] imports []
provides [ main ] to base provides [ main ] to pf
greeting = greeting =
hi = "Hello" hi = "Hello"

View file

@ -1,7 +1,7 @@
app "quicksort" app "quicksort"
packages { base: "platform" } packages { pf: "platform" }
imports [] imports []
provides [ quicksort ] to base provides [ quicksort ] to pf
quicksort = \originalList -> quicksort = \originalList ->
n = List.len originalList n = List.len originalList

View file

@ -6048,9 +6048,9 @@ I need all branches in an `if` to have the same type!
indoc!( indoc!(
r#" r#"
app "test-base64" app "test-base64"
packages { base: "platform" } packages { pf: "platform" }
imports [base.Task, Base64 ] imports [pf.Task, Base64 ]
provides [ main, @Foo ] to base provides [ main, @Foo ] to pf
"# "#
), ),
indoc!( indoc!(
@ -6059,8 +6059,8 @@ I need all branches in an `if` to have the same type!
I am partway through parsing a provides list, but I got stuck here: I am partway through parsing a provides list, but I got stuck here:
3 imports [base.Task, Base64 ] 3 imports [pf.Task, Base64 ]
4 provides [ main, @Foo ] to base 4 provides [ main, @Foo ] to pf
^ ^
I was expecting a type name, value name or function name next, like I was expecting a type name, value name or function name next, like
@ -6116,7 +6116,7 @@ I need all branches in an `if` to have the same type!
r#" r#"
interface Foobar interface Foobar
exposes [ main, @Foo ] exposes [ main, @Foo ]
imports [base.Task, Base64 ] imports [pf.Task, Base64 ]
"# "#
), ),
indoc!( indoc!(
@ -6144,7 +6144,7 @@ I need all branches in an `if` to have the same type!
r#" r#"
interface foobar interface foobar
exposes [ main, @Foo ] exposes [ main, @Foo ]
imports [base.Task, Base64 ] imports [pf.Task, Base64 ]
"# "#
), ),
indoc!( indoc!(
@ -6170,7 +6170,7 @@ I need all branches in an `if` to have the same type!
r#" r#"
app foobar app foobar
exposes [ main, @Foo ] exposes [ main, @Foo ]
imports [base.Task, Base64 ] imports [pf.Task, Base64 ]
"# "#
), ),
indoc!( indoc!(