Skip to content

Commit

Permalink
Replace uppEQ by (fmap upp). #148
Browse files Browse the repository at this point in the history
  • Loading branch information
epost authored and marcosh committed Jan 21, 2020
1 parent f5b8472 commit fc49f42
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/Language/CQL/Schema.hs
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ toCollage (Schema ts ens' fks' atts' path_eqs' obs_eqs' _) =
where
tscol = tsToCol ts

eqs1 = Set.map (unitCtx *** uppEQ) path_eqs'
eqs2 = Set.map (unitCtx *** uppEQ) obs_eqs'
eqs3 = Set.map (up1Ctx *** uppEQ) (ceqs tscol)
eqs1 = Set.map (unitCtx *** fmap upp) path_eqs'
eqs2 = Set.map (unitCtx *** fmap upp) obs_eqs'
eqs3 = Set.map (up1Ctx *** fmap upp) (ceqs tscol)

unitCtx en = Map.singleton (Left ()) (Right en)

Expand Down
10 changes: 3 additions & 7 deletions src/Language/CQL/Term.hs
Original file line number Diff line number Diff line change
Expand Up @@ -367,13 +367,6 @@ instance Up x (x + y) where
instance Up y (x + y) where
upgr = Right

uppEQ
:: ( Up var var', Up ty ty' , Up sym sym', Up en en'
, Up fk fk' , Up att att', Up gen gen', Up sk sk' )
=> EQ var ty sym en fk att gen sk
-> EQ var' ty' sym' en' fk' att' gen' sk'
uppEQ (EQ (l,r)) = EQ (upp l, upp r)

--------------------------------------------------------------------------------------------------------------------
-- Theories

Expand All @@ -388,6 +381,9 @@ type EQ var ty sym en fk att gen sk = EQF (Term var ty sym en fk att gen sk)

newtype EQF a = EQ (a, a)

instance Functor EQF where
fmap f (EQ (l, r)) = EQ (f l, f r)

instance (Show a) => Show (EQF a) where
show (EQ (lhs, rhs)) = show lhs ++ " = " ++ show rhs

Expand Down

0 comments on commit fc49f42

Please sign in to comment.