Skip to content

Commit 7e31026

Browse files
committed
Clean up leftovers from moving Carrier and TalgGen into Algebra. #148
1 parent 80a9a6b commit 7e31026

File tree

4 files changed

+5
-22
lines changed

4 files changed

+5
-22
lines changed

src/Language/CQL/Collage.hs

+1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ attsFrom sch en' = f $ Map.assocs $ catts sch
102102
where f [] = []
103103
f ((fk,(en1,t)):l) = if en1 == en' then (fk,t) : (f l) else f l
104104

105+
-- TODO Carrier is duplicated here from Instance.Algebra (Carrier) because it is used in assembleGens.
105106
type Carrier en fk gen = Term Void Void Void en fk Void gen Void
106107

107108
assembleGens

src/Language/CQL/Instance.hs

+1-19
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ import Data.Typeable hiding (typeOf)
5050
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 (+))
53-
import Language.CQL.Instance.Algebra (Algebra(..), aAtt, down1, evalSchTerm, evalSchTerm', nf, nf'', repr'')
53+
import Language.CQL.Instance.Algebra (Algebra(..), aAtt, Carrier, down1, evalSchTerm, evalSchTerm', nf, nf'', repr'', TalgGen(..))
5454
import qualified Language.CQL.Instance.Algebra as A (simplify)
5555
import Language.CQL.Instance.Presentation (Presentation(..))
5656
import qualified Language.CQL.Instance.Presentation as IP (toCollage, typecheck, Presentation(eqs))
@@ -198,13 +198,6 @@ saturatedInstance sch (Presentation gens sks eqs) = do
198198
---------------------------------------------------------------------------------------------------------------
199199
-- Initial algebras
200200

201-
-- | The carrier for the initial algebra of an instance; they are just terms.
202-
-- Made into a separate type so this could be changed; cql-java for example just uses natural numbers as the carrier.
203-
type Carrier en fk gen = Term Void Void Void en fk Void gen Void
204-
205-
-- | The generating labelled nulls for the type algebra of the associated instance.
206-
newtype TalgGen en fk att gen sk = MkTalgGen (Either sk (Carrier en fk gen, att))
207-
208201
-- | Computes an initial instance (minimal model of a presentation).
209202
-- Actually, computes the cannonical term model, where the underlying elements
210203
-- of the carriers are equivalence class of terms modulo provable equality
@@ -264,17 +257,6 @@ assembleSks col ens' = unionWith Set.union sks' $ fromListAccum gens'
264257
instance NFData InstanceEx where
265258
rnf (InstanceEx x) = rnf x
266259

267-
instance TyMap NFData '[en, fk, att, gen, sk] => NFData (TalgGen en fk att gen sk) where
268-
rnf (MkTalgGen x) = rnf x
269-
270-
instance TyMap Show '[en, fk, att, gen, sk] => Show (TalgGen en fk att gen sk) where
271-
show (MkTalgGen (Left x)) = show x
272-
show (MkTalgGen (Right x)) = show x
273-
274-
deriving instance TyMap Ord '[en, fk, att, gen, sk] => Ord (TalgGen en fk att gen sk)
275-
276-
deriving instance TyMap Eq '[fk, att, gen, sk] => Eq (TalgGen en fk att gen sk)
277-
278260
-- TODO move to Collage? Algebra?
279261
-- TODO move to Collage? Algebra?
280262
-- TODO move to Collage? Algebra?

src/Language/CQL/Term.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,8 @@ simplifyTheory th subst0 = case simplifyTheoryStep th of
325325
Nothing -> (th, subst0)
326326
Just (th', subst1) -> simplifyTheory th' $ subst0 ++ [subst1]
327327

328-
-- | Does a one step simplifcation of a theory, looking for equations @gen/sk = term@, yielding also a
329-
-- translation function from the old theory to the new, encoded as a list of (symbol, term) pairs.
328+
-- | Does a one step simplification of a theory, looking for equations @gen/sk = term@, yielding also a
329+
-- translation function from the old theory to the new, encoded as a list of (symbol, term) pairs.
330330
simplifyTheoryStep
331331
:: (MultiTyMap '[Ord] '[var, ty, sym, en, fk, att, gen, sk])
332332
=> Theory var ty sym en fk att gen sk

src/Language/CQL/Transform.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ import Data.Void
4949
import Language.CQL.Common
5050
import Language.CQL.Instance as I
5151
import qualified Language.CQL.Instance.Presentation as IP (Presentation(eqs, gens, sks), toCollage)
52-
import Language.CQL.Instance.Algebra (Algebra(..), nf, nf'')
52+
import Language.CQL.Instance.Algebra (Algebra(..), Carrier, nf, nf'', TalgGen(..))
5353
import Language.CQL.Mapping as M hiding (toMorphism)
5454
import Language.CQL.Morphism (Morphism(..), translate, translate')
5555
import Language.CQL.Morphism as Morphism (typeOf)

0 commit comments

Comments
 (0)