Skip to content

Commit

Permalink
Alter Direction Eq instance
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisPenner committed Jan 9, 2025
1 parent 3707bf2 commit 080ae94
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion unison-runtime/src/Unison/Runtime/ANF.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,18 @@ type Cte v = CTE v (ANormal v)
type Ctx v = Directed () [Cte v]

data Direction a = Indirect a | Direct
deriving (Eq, Ord, Show, Functor, Foldable, Traversable)
deriving (Show, Functor, Foldable, Traversable)

instance Eq (Direction a) where
Indirect _ == Indirect _ = True
Direct == Direct = True
_ == _ = False

instance Ord (Direction a) where
compare (Indirect _) (Indirect _) = EQ
compare (Indirect _) Direct = LT
compare Direct (Indirect _) = GT
compare Direct Direct = EQ

directed :: (Foldable f) => f (Cte v) -> Directed () (f (Cte v))
directed x = (foldMap f x, x)
Expand Down

0 comments on commit 080ae94

Please sign in to comment.