Skip to content

Commit 0f77a33

Browse files
committed
Rename presToCol to IP.toCollage. #148
1 parent 3738b83 commit 0f77a33

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

src/Language/CQL/Instance.hs

+4-4
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ import Data.Void
5151
import Language.CQL.Collage (Collage(..), assembleGens, attsFrom, fksFrom, typeOf)
5252
import Language.CQL.Common (elem', fromListAccum, section, toMapSafely, Deps(..), Err, Kind(INSTANCE), MultiTyMap, TyMap, type (+))
5353
import Language.CQL.Instance.Algebra (Algebra(..), aAtt, down1, evalSchTerm, evalSchTerm', nf, nf'', repr'')
54-
import Language.CQL.Instance.Presentation (Presentation(..), presToCol)
55-
import qualified Language.CQL.Instance.Presentation as IP (typecheck, Presentation(eqs))
54+
import Language.CQL.Instance.Presentation (Presentation(..))
55+
import qualified Language.CQL.Instance.Presentation as IP (toCollage, typecheck, Presentation(eqs))
5656
import Language.CQL.Mapping as Mapping
5757
import Language.CQL.Options
5858
import Language.CQL.Prover
@@ -221,7 +221,7 @@ initialInstance p dp' sch = Instance sch p dp'' $ initialAlgebra
221221
dp'' (EQ (lhs, rhs)) = dp' $ EQ (upp lhs, upp rhs)
222222
initialAlgebra = simplifyAlg this
223223
this = Algebra sch en' nf''' nf'''2 id ty' nf'''' repr'''' teqs'
224-
col = presToCol sch p
224+
col = IP.toCollage sch p
225225
ens' = assembleGens col (close col dp')
226226
en' k = ens' ! k
227227

@@ -601,7 +601,7 @@ evalSigmaInst
601601
-> Instance var ty sym en fk att gen sk x y -> Options
602602
-> Err (Instance var ty sym en' fk' att' gen sk (Carrier en' fk' gen) (TalgGen en' fk' att' gen sk))
603603
evalSigmaInst f i o = do
604-
d <- createProver (presToCol s p) o
604+
d <- createProver (IP.toCollage s p) o
605605
return $ initialInstance p (\(EQ (l, r)) -> prove d Map.empty (EQ (l, r))) s
606606
where
607607
p = subs f $ pres i

src/Language/CQL/Instance/Presentation.hs

+5-6
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,17 @@ typecheck
7777
=> Schema var ty sym en fk att
7878
-> Presentation var ty sym en fk att gen sk
7979
-> Err ()
80-
typecheck sch p = typeOfCol $ presToCol sch p
80+
typecheck sch p = typeOfCol $ toCollage sch p
8181

8282
-- | Converts a presentation to a collage.
83-
presToCol
83+
toCollage
8484
:: (MultiTyMap '[Show, Ord, NFData] '[var, ty, sym, en, fk, att, gen, sk])
8585
=> Schema var ty sym en fk att
8686
-> Presentation var ty sym en fk att gen sk
8787
-> Collage (()+var) ty sym en fk att gen sk
88-
presToCol sch (Presentation gens' sks' eqs') =
89-
Collage (Set.union e1 e2) (ctys schcol)
90-
(cens schcol) (csyms schcol) (cfks schcol) (catts schcol) gens' sks'
88+
toCollage sch (Presentation gens' sks' eqs') =
89+
Collage (Set.union e1 e2) (ctys schcol) (cens schcol) (csyms schcol) (cfks schcol) (catts schcol) gens' sks'
9190
where
9291
schcol = schToCol sch
93-
e1 = Set.map (\( EQ (l,r)) -> (Map.empty, EQ (upp l, upp r))) eqs'
92+
e1 = Set.map (\( EQ (l,r)) -> (Map.empty, EQ (upp l, upp r))) $ eqs'
9493
e2 = Set.map (\(g, EQ (l,r)) -> (g, EQ (upp l, upp r))) $ ceqs schcol

src/Language/CQL/Transform.hs

+4-4
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ import Data.Typeable
4848
import Data.Void
4949
import Language.CQL.Common
5050
import Language.CQL.Instance as I
51-
import Language.CQL.Instance.Presentation as IP
51+
import qualified Language.CQL.Instance.Presentation as IP (Presentation(eqs, gens, sks), toCollage)
5252
import Language.CQL.Instance.Algebra (Algebra(..), nf, nf'')
5353
import Language.CQL.Mapping as M hiding (toMorphism)
5454
import Language.CQL.Morphism (Morphism(..), translate, translate')
@@ -106,7 +106,7 @@ validateTransform
106106
=> Transform var ty sym en fk att gen sk x y gen' sk' x' y'
107107
-> Err ()
108108
validateTransform m@(Transform src' dst' _ _) =
109-
mapM_ f (Set.toList $ eqs $ pres src')
109+
mapM_ f (Set.toList $ IP.eqs $ pres src')
110110
where
111111
f :: (EQ Void ty sym en fk att gen sk) -> Err () -- need type signature
112112
f (EQ (l, r)) = let
@@ -121,8 +121,8 @@ toMorphism
121121
=> Transform var ty sym en' fk' att' gen sk x1 y1 gen' sk' x2 y2
122122
-> Morphism var ty sym en' fk' att' gen sk en' fk' att' gen' sk'
123123
toMorphism (Transform src' dst' gens' sks') =
124-
Morphism (presToCol (I.schema src') (pres src'))
125-
(presToCol (I.schema src') (pres dst'))
124+
Morphism (IP.toCollage (I.schema src') (pres src'))
125+
(IP.toCollage (I.schema src') (pres dst'))
126126
ens0 fks0 atts0 gens' sks'
127127
where
128128
ens0 = Map.fromSet id (S.ens $ I.schema src')

0 commit comments

Comments
 (0)