Created
December 5, 2016 21:27
-
-
Save atacratic/bd9e08b43717dc50d31bcc2f27842a03 to your computer and use it in GitHub Desktop.
Idris namespaces are not privileged for disambiguation within their own scope
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- I would like to try two options for a bit of code, within the same file... | |
namespace Option1 | |
foo : Nat | |
bar : Nat -> Nat | |
bar n = n + foo | |
namespace Option2 | |
foo : Nat | |
bar : Nat -> Nat | |
bar n = n + foo - 1 | |
-- ... but I can't. I get: | |
-- Can't disambiguate name: Main.Option1.foo, Main.Option2.foo | |
-- Obviously, I could use two files. Or I could disambiguate the calls to foo with Option1.foo and | |
-- Option2.foo - but then I'd have to undo that edit when I commit to one of the options and get rid | |
-- of the namespace. | |
-- "using namespace" doesn't seem to exist, and "with <NAMESPACE> <EXPR>" is only for expressions. | |
-- Could disambiguation privilege the current namespace? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reply from Edwin: