Use unidirectional pattern synonym

This commit is contained in:
George Thomas 2026-03-02 17:21:22 +00:00
parent a1a8f1c6f4
commit bd080c37aa

View File

@ -41,8 +41,8 @@ type Rule = Rule' ()
data Rule' a = Rule a (Atom' a) [Atom' a]
deriving (Eq, Ord, Show)
{-# COMPLETE (:-) #-}
pattern (:-) :: Atom' () -> [Atom' ()] -> Rule' ()
pattern a :- b = Rule () a b
pattern (:-) :: Atom' a -> [Atom' a] -> Rule' a
pattern a :- b <- Rule _ a b
type Program = Program' ()
data Program' a = Program a [Rule' a]
@ -63,7 +63,7 @@ instance HasConstants (Atom' a) where
constants (Atom _ _ ts) = constants ts
instance HasConstants (Rule' a) where
constants (Rule _ h b) = Set.union (constants h) (constants b)
constants (h :- b) = Set.union (constants h) (constants b)
instance HasConstants (Program' a) where
constants (Program _ rs) = constants rs