Skip to content

Commit d681402

Browse files
epostmarcosh
authored andcommitted
Reimplement mapVar (was really a setter) as mapTermVar. #148
1 parent e58ca07 commit d681402

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/Language/CQL/Schema.hs

+3-3
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ instance TyMap Show '[var, ty, sym, en, fk, att]
9090
, section "observation_equations " $ unlines $ eqs'' obs_eqs'
9191
]
9292
where
93-
fks'' = (\(k,(s,t)) -> show k ++ " : " ++ show s ++ " -> " ++ show t) <$> Map.toList fks'
94-
atts'' = (\(k,(s,t)) -> show k ++ " : " ++ show s ++ " -> " ++ show t) <$> Map.toList atts'
95-
eqs'' x = (\(en,EQ (l,r)) -> "forall x : " ++ show en ++ " . " ++ show (mapVar "x" l) ++ " = " ++ show (mapVar "x" r)) <$> Set.toList x
93+
fks'' = (\(k,(s,t)) -> show k ++ " : " ++ show s ++ " -> " ++ show t) <$> Map.toList fks'
94+
atts'' = (\(k,(s,t)) -> show k ++ " : " ++ show s ++ " -> " ++ show t) <$> Map.toList atts'
95+
eqs'' x = (\(en,EQ (l,r)) -> "forall x : " ++ show en ++ " . " ++ show (mapTermVar (const "x") l) ++ " = " ++ show (mapTermVar (const "x") r)) <$> Set.toList x
9696

9797
-- | Checks that the underlying theory is well-sorted.
9898
-- I.e. rule out "1" = one kind of errors.

src/Language/CQL/Term.hs

+5-2
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,11 @@ mapTerm v t r e f a g s x = case x of
134134
where
135135
mt = mapTerm v t r e f a g s
136136

137-
mapVar :: var -> Term () ty sym en fk att gen sk -> Term var ty sym en fk att gen sk
138-
mapVar v = mapTerm (const v) id id id id id id id
137+
mapTermVar
138+
:: (var -> var')
139+
-> Term var ty sym en fk att gen sk
140+
-> Term var' ty sym en fk att gen sk
141+
mapTermVar f = mapTerm f id id id id id id id
139142

140143
-- | The number of variable and symbol occurrences in a term.
141144
size :: Term var ty sym en fk att gen sk -> Integer

0 commit comments

Comments
 (0)