From da227888cec4ddfe514a655f128c034be5043548 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 8 Oct 2019 15:34:33 -0400 Subject: [PATCH] Rename Elem to Find. --- semantic-tags/src/AST/Element.hs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/semantic-tags/src/AST/Element.hs b/semantic-tags/src/AST/Element.hs index 9219ba50f..d1caecc74 100644 --- a/semantic-tags/src/AST/Element.hs +++ b/semantic-tags/src/AST/Element.hs @@ -12,8 +12,8 @@ class Element sub sup where -- | Project one element out of a sum type. prj :: sup a -> Maybe (sub a) -instance (Element' elem sub sup, elem ~ Elem sub sup) => Element sub sup where - prj = prj' @elem +instance (Element' side sub sup, side ~ Find sub sup) => Element sub sup where + prj = prj' @side pattern Prj :: Element sub sup => sub a -> sup a @@ -21,21 +21,21 @@ pattern Prj sub <- (prj -> Just sub) data Side = None | Here | L | R -type family Elem sub sup :: Side where - Elem t t = 'Here - Elem t (l :+: r) = Elem' 'L t l <> Elem' 'R t r - Elem _ _ = 'None +type family Find sub sup :: Side where + Find t t = 'Here + Find t (l :+: r) = Find' 'L t l <> Find' 'R t r + Find _ _ = 'None -type family Elem' (side :: Side) sub sup :: Side where - Elem' s t t = s - Elem' s t (l :+: r) = Elem' s t l <> Elem' s t r - Elem' _ _ _ = 'None +type family Find' (side :: Side) sub sup :: Side where + Find' s t t = s + Find' s t (l :+: r) = Find' s t l <> Find' s t r + Find' _ _ _ = 'None type family (a :: Side) <> (b :: Side) :: Side where 'None <> b = b a <> _ = a -class Element' (elem :: Side) sub sup where +class Element' (side :: Side) sub sup where prj' :: sup a -> Maybe (sub a) instance {-# OVERLAPPABLE #-}