quick commit

This commit is contained in:
rvcas 2020-11-24 21:47:25 -05:00
parent 29c1dc35de
commit 14368fafb8
4 changed files with 23 additions and 30 deletions

View file

@ -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)]

View file

@ -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"
Task.putLine "Hello world"
# 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)

View file

@ -1,6 +1,6 @@
platform folkertdev/foo
requires { main : Effect {} }
exposes []
exposes [ Task ]
packages {}
imports []
provides [ mainForHost ]

View file

@ -0,0 +1,9 @@
interface Task
exposes [ Task, putLine, after ]
imports [ Effect ]
Task a : Effect.Effect a
putLine = Effect.putLine
after = Effect.after