Skip to content

Instantly share code, notes, and snippets.

@JoeyEremondi
Created August 25, 2015 23:48
Show Gist options
  • Save JoeyEremondi/e304c8af399fdc865aa4 to your computer and use it in GitHub Desktop.
Save JoeyEremondi/e304c8af399fdc865aa4 to your computer and use it in GitHub Desktop.
Storing interfaces with conflicting names--
{-
Possible actions to take with conflicting names:
1.
Try to guess which one the user meant, by seeing if there's a name (or set of names) used
only found in one.
Give an error if this can't be determined.
2.
Add syntax for importing a package, something like
import package johnpmayer elm-linear-algebra as Lin
import Lin.Math.Vector4
Then, give an error on any conficts not resolved this way
3. Always give an error, rely on package maintainers to avoid conflicting names.
-}
--Regardless, the correct answer is not "use whatever order Elm-make sees them"
--so here's a proposed change to allow for a fix
--AST.Module
type Interfaces = Map.Map Name [Interface]
--Elm.Compiler:
compile
:: Context
-> String
-> Map.Map PublicModule.Name [PublicModule.Interface]
-> (Dealiaser, [Warning], Either [Error] Result)
--Reporting.Error.Canonicalize
data ImportError
= ModuleNotFound [Module.Name]
| ValueNotFound String [String]
| AmbiguousImport [Var.PackageInfo]
--The idea is similar in Elm-make for reading interfaces
--We keep them in a dict of lists, not a dict of interfaces
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment