This repository was archived by the owner on Apr 1, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
semantic-analysis/src/Analysis/Syntax Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ import Analysis.VM
3535import Control.Effect.Labelled
3636import Control.Effect.Reader
3737import Data.Function (fix )
38- import Data.Functor.Classes (Eq1 (.. ))
38+ import Data.Functor.Classes (Eq1 (.. ), Ord1 ( .. ) )
3939import Data.List.NonEmpty (NonEmpty )
4040import Data.Text (Text )
4141import Source.Span (Span )
@@ -132,6 +132,34 @@ instance Eq1 Python where
132132 (Locate' s1, Locate' s2) -> s1 == s2
133133 _ -> False
134134
135+ instance Ord1 Python where
136+ liftCompare _ a b = case (a, b) of
137+ (Noop' , Noop' ) -> EQ
138+ (Noop' , _) -> LT
139+ (Iff' , Iff' ) -> EQ
140+ (Iff' , _) -> LT
141+ (Bool' b1, Bool' b2) -> compare b1 b2
142+ (Bool' _, _) -> LT
143+ (String' s1, String' s2) -> compare s1 s2
144+ (String' _, _) -> LT
145+ (Throw' , Throw' ) -> EQ
146+ (Throw' , _) -> LT
147+ (Let' n1, Let' n2) -> compare n1 n2
148+ (Let' _, _) -> LT
149+ ((:>>>) , (:>>>) ) -> EQ
150+ ((:>>>) , _) -> LT
151+ (Import' i1, Import' i2) -> compare i1 i2
152+ (Import' _, _) -> LT
153+ (Function' n1 as1, Function' n2 as2) -> compare n1 n2 <> compare as1 as2
154+ (Function' _ _, _) -> LT
155+ (Call' , Call' ) -> EQ
156+ (Call' , _) -> LT
157+ (ANil' , ANil' ) -> EQ
158+ (ANil' , _) -> LT
159+ (ACons' , ACons' ) -> EQ
160+ (ACons' , _) -> LT
161+ (Locate' s1, Locate' s2) -> compare s1 s2
162+ (Locate' _, _) -> LT
135163
136164
137165-- Abstract interpretation
You can’t perform that action at this time.
0 commit comments