Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit 1a6812e

Browse files
committed
Split out instances for Expression.
1 parent 2367717 commit 1a6812e

File tree

1 file changed

+12
-1
lines changed
  • semantic-python/src/Language/Python

1 file changed

+12
-1
lines changed

semantic-python/src/Language/Python/Core.hs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,23 @@ defaultCompile t = fail $ "compilation unimplemented for " <> show t
2121
deriving via CompileSum (Either l r) instance (Compile l, Compile r) => Compile (Either l r)
2222

2323
instance Compile Py.AssertStatement
24+
instance Compile Py.Await
2425
instance Compile Py.Block
26+
instance Compile Py.BooleanOperator
2527
instance Compile Py.BreakStatement
2628
instance Compile Py.ClassDefinition
29+
instance Compile Py.ComparisonOperator
2730

2831
deriving via CompileSum Py.CompoundStatement instance Compile Py.CompoundStatement
2932

33+
instance Compile Py.ConditionalExpression
3034
instance Compile Py.ContinueStatement
3135
instance Compile Py.DecoratedDefinition
3236
instance Compile Py.DeleteStatement
3337
instance Compile Py.ExecStatement
34-
instance Compile Py.Expression
38+
39+
deriving via CompileSum Py.Expression instance Compile Py.Expression
40+
3541
instance Compile Py.ExpressionStatement
3642
instance Compile Py.ForStatement
3743
instance Compile Py.FunctionDefinition
@@ -47,13 +53,17 @@ instance Compile Py.IfStatement where
4753

4854
instance Compile Py.ImportFromStatement
4955
instance Compile Py.ImportStatement
56+
instance Compile Py.Lambda
5057

5158
instance Compile Py.Module where
5259
compile (Module Nothing) = pure Unit
5360
compile (Module (Just statements)) = block <$> traverse compile statements
5461

62+
instance Compile Py.NamedExpression
5563
instance Compile Py.NonlocalStatement
64+
instance Compile Py.NotOperator
5665
instance Compile Py.PassStatement
66+
instance Compile Py.PrimaryExpression
5767
instance Compile Py.PrintStatement
5868
instance Compile Py.ReturnStatement
5969
instance Compile Py.RaiseStatement
@@ -81,6 +91,7 @@ instance Compile t => GCompileSum (M1 C c (M1 S s (K1 R t))) where
8191

8292
-- FIXME: depend on https://github.com/tree-sitter/haskell-tree-sitter/pull/90 so we can get rid of these orphan instances
8393
deriving instance Generic Py.CompoundStatement
94+
deriving instance Generic Py.Expression
8495
deriving instance Generic Py.SimpleStatement
8596

8697

0 commit comments

Comments
 (0)