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

Commit 692c3f2

Browse files
committed
🔥 Term.
1 parent b9ba190 commit 692c3f2

1 file changed

Lines changed: 1 addition & 36 deletions

File tree

  • semantic-analysis/src/Analysis/Syntax

semantic-analysis/src/Analysis/Syntax/Python.hs

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
-- | This belongs in @semantic-python@ instead of @semantic-analysis@, but for the sake of expedience…
99
module Analysis.Syntax.Python
1010
( -- * Syntax
11-
Term(..)
12-
, subterms
11+
T.Term(..)
1312
, Python(..)
1413
, pattern Noop''
1514
, pattern Iff''
@@ -37,45 +36,11 @@ import Control.Effect.Labelled
3736
import Control.Effect.Reader
3837
import Data.Function (fix)
3938
import Data.List.NonEmpty (NonEmpty)
40-
import qualified Data.Set as Set
4139
import Data.Text (Text)
4240
import Source.Span (Span)
4341

4442
-- Syntax
4543

46-
data Term
47-
= Var Name
48-
| Noop
49-
| Iff Term Term Term
50-
| Bool Bool
51-
| String Text
52-
| Throw Term
53-
| Let Name Term Term
54-
| Term :>> Term
55-
| Import (NonEmpty Text)
56-
| Function Name [Name] Term
57-
| Call Term [Term]
58-
| Locate Span Term
59-
deriving (Eq, Ord, Show)
60-
61-
infixl 1 :>>
62-
63-
subterms :: Term -> Set.Set Term
64-
subterms t = Set.singleton t <> case t of
65-
Var _ -> mempty
66-
Noop -> mempty
67-
Iff c t e -> subterms c <> subterms t <> subterms e
68-
Bool _ -> mempty
69-
String _ -> mempty
70-
Throw t -> subterms t
71-
Let _ v b -> subterms v <> subterms b
72-
a :>> b -> subterms a <> subterms b
73-
Import _ -> mempty
74-
Function _ _ b -> subterms b
75-
Call f as -> subterms f <> foldMap subterms as
76-
Locate _ b -> subterms b
77-
78-
7944
data Python (arity :: T.Nat) where
8045
Noop' :: Python T.N0
8146
Iff' :: Python T.N3

0 commit comments

Comments
 (0)