summaryrefslogtreecommitdiff
path: root/src/Language/AST.hs
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2025-03-02 12:57:07 +0100
committerTom Smeding <tom@tomsmeding.com>2025-03-02 12:57:07 +0100
commit52184258f8eef227c743726770e984202e101919 (patch)
tree8011e731e2280245400a247e633fa84a3a487af8 /src/Language/AST.hs
parent54762c98901b21468fa9ff4205107360c3096cd3 (diff)
Compile: index into arrays
Diffstat (limited to 'src/Language/AST.hs')
-rw-r--r--src/Language/AST.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Language/AST.hs b/src/Language/AST.hs
index 022e797..387915b 100644
--- a/src/Language/AST.hs
+++ b/src/Language/AST.hs
@@ -17,7 +17,7 @@ module Language.AST where
import Data.Kind (Type)
import Data.Type.Equality
import GHC.OverloadedLabels
-import GHC.TypeLits (Symbol, SSymbol, symbolSing, KnownSymbol, TypeError, ErrorMessage(Text))
+import GHC.TypeLits (Symbol, SSymbol, symbolSing, KnownSymbol, TypeError, ErrorMessage(..))
import Array
import AST
@@ -77,6 +77,7 @@ deriving instance Show (NExpr env t)
type family Lookup name env where
Lookup "_" _ = TypeError (Text "Attempt to use variable with name '_'")
+ Lookup name '[] = TypeError (Text "Variable '" :<>: Text name :<>: Text "' not in scope")
Lookup name ('(name, t) : env) = t
Lookup name (_ : env) = Lookup name env