Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I avoid lower-case global variables being shadowed in types?

Tags:

idris

idris2

The following code compiles okay in Idris2:

C : Nat
C = 2

claim : C = 2
claim = Refl

but it fails if C is not capitalized:

c : Nat
c = 2

claim : c = 2
claim = Refl

The error message is

Warning: We are about to implicitly bind the following lowercase names. You may be unintentionally shadowing the associated global definitions: c is shadowing Main.c Error: While processing right hand side of claim. When unifying: 2 = 2 and: c = 2 Mismatch between: 2 and c.

Is there a way to tell Idris compiler not to shadow lowercase global names in types?

like image 780
haskell looks great Avatar asked Oct 19 '25 20:10

haskell looks great


1 Answers

I don't know if there's a compiler option or the like, but you can qualify c. If it's in module Foo, use

c : Nat
c = 2

claim : Foo.c = 2
claim = Refl
like image 53
joel Avatar answered Oct 24 '25 07:10

joel