Skip to content

Commit fb31347

Browse files
committed
Add doc comments for the most important types. #105
1 parent 8e42d29 commit fb31347

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

src/Language/Instance.hs

+5-2
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ instance (Show var, Show ty, Show sym, Show en, Show fk, Show att, Show gen, Sho
275275
"generators\n\t" ++ showCtx' ens' ++ "\n" ++
276276
"equations\n\t" ++ intercalate "\n\t" (Set.map show eqs') ++ "}"
277277

278+
-- | Instance kinds can be thought of as the data that "fills" the 'Schema'.
278279
data Instance var ty sym en fk att gen sk x y
279280
= Instance
280281
{ schema :: Schema var ty sym en fk att
@@ -458,8 +459,10 @@ assembleSks col ens' = unionWith Set.union sks' $ fromListAccum gens'
458459

459460
type Carrier en fk gen = Term Void Void Void en fk Void gen Void
460461

461-
-- | T means type. This can be either a labeled null (`sk`) or... a proper value
462-
-- | This type allows us to define e.g. a custom Show instance.
462+
463+
-- | These are the generating labelled nulls for the type 'Algebra' of the associated 'Instance'.
464+
-- It can be either a labeled null ('Sk') or a proper value.
465+
-- This newtype allows us to define e.g. a custom 'Show' instance.
463466
newtype TalgGen en fk att gen sk = MkTalgGen (Either sk (Carrier en fk gen, att))
464467

465468
instance (Show en, Show fk, Show att, Show gen, Show sk) => Show (TalgGen en fk att gen sk) where

src/Language/Term.hs

+11-2
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,23 @@ simplify eqs = case find eqs of
9898
in Just $ (eqs3,(toRemove, replacer))
9999

100100

101-
102-
103101
data Term var ty sym en fk att gen sk
102+
-- | Variable.
104103
= Var var
104+
105+
-- | Type side function/constant symbol.
105106
| Sym sym [Term var ty sym en fk att gen sk]
107+
108+
-- | Foreign key.
106109
| Fk fk (Term var ty sym en fk att gen sk)
110+
111+
-- | Attribute.
107112
| Att att (Term var ty sym en fk att gen sk)
113+
114+
-- | Generator.
108115
| Gen gen
116+
117+
-- | Skolem term or labelled null; like a generator for a type rather than an entity.
109118
| Sk sk
110119

111120
data Head ty sym en fk att gen sk =

src/Language/Transform.hs

+1
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ transToMor (Transform src' dst' gens' sks') =
150150
fks0 = mapWithKey (\fk _ -> Fk fk (Var ())) (S.fks $ I.schema src')
151151
atts0 = mapWithKey (\fk _ -> Att fk (Var ())) (S.atts $ I.schema src')
152152

153+
-- | Map from one 'Instance' to another of the same 'Schema'.
153154
data Transform var ty sym en fk att gen sk x y gen' sk' x' y'
154155
= Transform
155156
{ srcT :: Instance var ty sym en fk att gen sk x y

src/Language/Typeside.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fromList' ((k,v):l) = do l' <- fromList' l
3434
else pure $ Map.insert k v l'
3535
fromList' [] = return Map.empty
3636

37-
37+
-- | A user-defined kind for customisation of data types.
3838
data Typeside var ty sym
3939
= Typeside
4040
{ tys :: Set ty

0 commit comments

Comments
 (0)