diff --git a/compiler/module/src/symbol.rs b/compiler/module/src/symbol.rs index 351edbee69..468996317a 100644 --- a/compiler/module/src/symbol.rs +++ b/compiler/module/src/symbol.rs @@ -312,6 +312,12 @@ impl fmt::Debug for ModuleId { /// Stores a mapping between ModuleId and InlinableString. /// +/// base.Task +/// 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 +/// 3. pass this around to other modules getting headers parsed. when parsing interfaces we need to use this map to reference shortnames +/// 4. throw away short names. stash the module id in the can env under the resolved module name +/// 5. test: /// Each module name is stored twice, for faster lookups. /// Since these are interned strings, this shouldn't result in many total allocations in practice. #[derive(Debug, Clone)] diff --git a/examples/effect/Main.roc b/examples/effect/Main.roc index c13c2afb63..1fda6417ab 100644 --- a/examples/effect/Main.roc +++ b/examples/effect/Main.roc @@ -1,31 +1,9 @@ -app "effect-example" provides [ main ] imports [ Effect, RBTree ] +app "effect-example" + packages { base: "./platform" } + imports [ base.Task.{ Task, after } ] + provides [ main ] to base -toAndFro : Int -toAndFro = - empty : RBTree.Dict Int {} - empty = RBTree.empty - - empty - |> (\d -> RBTree.insert 1 {} d) - |> RBTree.toList - |> List.len - - - - -main : Effect.Effect {} as Fx +main : Task {} main = - # if RBTree.isEmpty empty then - if toAndFro == 2 then - Effect.putLine "Yay" - |> Effect.after (\{} -> Effect.getLine) - |> Effect.after (\line -> Effect.putLine line) - else - Effect.putLine "Nay" - - -# Effect.always "Write a thing" -# |> Effect.map (\line -> Str.concat line "!") -# |> Effect.after (\line -> Effect.putLine line) -# |> Effect.after (\{} -> Effect.getLine) -# |> Effect.after (\line -> Effect.putLine line) + Task.putLine "Hello world" + \ No newline at end of file diff --git a/examples/effect/platform/Pkg-Config.roc b/examples/effect/platform/Pkg-Config.roc index ec2c67ca43..78afc1799e 100644 --- a/examples/effect/platform/Pkg-Config.roc +++ b/examples/effect/platform/Pkg-Config.roc @@ -1,6 +1,6 @@ platform folkertdev/foo requires { main : Effect {} } - exposes [] + exposes [ Task ] packages {} imports [] provides [ mainForHost ] diff --git a/examples/effect/platform/Task.roc b/examples/effect/platform/Task.roc new file mode 100644 index 0000000000..10722f5905 --- /dev/null +++ b/examples/effect/platform/Task.roc @@ -0,0 +1,9 @@ +interface Task + exposes [ Task, putLine, after ] + imports [ Effect ] + +Task a : Effect.Effect a + +putLine = Effect.putLine + +after = Effect.after