Permalink
Browse files

Update documents and add missing lhs files

  • Loading branch information...
1 parent 434ac9a commit e7074696f31372a08271bc9957ff3ec44e05f9c4 @norm2782 committed Jan 24, 2011
Showing with 103 additions and 30 deletions.
  1. +1 −1 docs/DGG.lyx
  2. +29 −29 docs/Presentation.lyx
  3. +15 −0 docs/data-tcvc.lhs
  4. +13 −0 docs/data-univ.lhs
  5. +19 −0 docs/emgm-compare.lhs
  6. +13 −0 docs/list-emgm.lhs
  7. +5 −0 docs/list-instance.lhs
  8. +4 −0 docs/list-sop.lhs
  9. +4 −0 docs/list.lhs
View
2 docs/DGG.lyx
@@ -62,7 +62,7 @@
\begin_body
\begin_layout Title
-DGG: Your One-Stop Shop for Generic Representations
+DGG: Datatype-generic Generator
\end_layout
\begin_layout Author
View
58 docs/Presentation.lyx
@@ -64,7 +64,7 @@
\begin_body
\begin_layout Title
-DGG: Your One-Stop Shop for Generic Representations
+DGG: Datatype-generic Generator
\end_layout
\begin_layout Author
@@ -93,11 +93,11 @@ LatexCommand tableofcontents
\end_layout
\begin_layout Section
-DGG: Your One-Stop Shop for Generic Representations
+DGG: Datatype-generic Generator
\end_layout
\begin_layout Subsection
-Introduction to Datatype-Generic Programming
+Datatype-generic Programming
\end_layout
\begin_layout BeginFrame
@@ -119,12 +119,12 @@ This introduction is incomplete and does not aim to provide you with a full
\end_layout
\begin_layout BeginFrame
-Datatype Generic Programming
+Datatype-generic Programming
\end_layout
\begin_layout Itemize
-Datatype generic programming allows functions to be defined once for a wide
- range of different data types
+Datatype-generic programming (DGP) allows functions to be defined once for
+ a wide range of different data types
\end_layout
\begin_layout Itemize
@@ -182,8 +182,8 @@ EMGM embedding-projection pair
\end_layout
\begin_layout Standard
-Converting from and to generic representations is done using an embedding-projec
-tion pair (EP).
+Converting from and to a generic view is done using an embedding-projection
+ pair (EP).
\end_layout
\begin_layout Standard
@@ -201,7 +201,7 @@ tion pair (EP).
\end_layout
\begin_layout BeginFrame
-Generic representations
+Observation
\end_layout
\begin_layout Itemize
@@ -527,17 +527,29 @@ Where
\end_layout
\begin_layout BeginFrame
-DGG DSL
+CLI tool
\end_layout
-\begin_layout Standard
-DGP library specific code is generated from these data types
+\begin_layout Itemize
+After writing the adapter, only the
+\family typewriter
+Main.hs
+\family default
+ file needs to be modified.
+\end_layout
+
+\begin_layout Itemize
+The following line is added to make the library selectable via the
+\family typewriter
+-a
+\family default
+ flag:
\end_layout
\begin_layout Standard
\begin_inset External
template LHS
- filename data-tcvc.lhs
+ filename adaptersEntry.lhs
\end_inset
@@ -549,29 +561,17 @@ DGP library specific code is generated from these data types
\end_layout
\begin_layout BeginFrame
-CLI tool
-\end_layout
-
-\begin_layout Itemize
-After writing the adapter, only the
-\family typewriter
-Main.hs
-\family default
- file needs to be modified.
+DGG DSL
\end_layout
-\begin_layout Itemize
-The following line is added to make the library selectable via the
-\family typewriter
--a
-\family default
- flag:
+\begin_layout Standard
+DGP library specific code is generated from these data types
\end_layout
\begin_layout Standard
\begin_inset External
template LHS
- filename adaptersEntry.lhs
+ filename data-tcvc.lhs
\end_inset
View
15 docs/data-tcvc.lhs
@@ -0,0 +1,15 @@
+%include polycode.fmt
+\begin{code}
+data TCInfo = TCInfo { tcName :: Name
+ , tcType :: TypeType
+ , tcVars :: [TCVar]
+ , tcDCs :: [DCInfo]
+ }
+
+data DCInfo = DCInfo { dcName :: Name
+ , dcIndex :: Int
+ , dcFixity :: ConFixity
+ , dcAssoc :: Associativity
+ , dcVars :: [DCVar]
+ }
+\end{code}
View
13 docs/data-univ.lhs
@@ -0,0 +1,13 @@
+%include polycode.fmt
+\begin{code}
+data UnivSupp = Regular
+ | HigherKinded
+ | Nested
+ | NestedHigherKinded
+ | OtherH98
+ | SubUniv
+ | HigherRankCon
+ | ExistentialTypes
+ | SuppGADTs
+ | MutRec
+\end{code}
View
19 docs/emgm-compare.lhs
@@ -0,0 +1,19 @@
+%include polycode.fmt
+\begin{code}
+newtype Compare a = Compare { selCompare :: a -> a -> Ordering }
+
+instance Generic Compare where
+ rconstant = Compare rconstantCompare
+ rsum ra rb = Compare (rsumCompare ra rb)
+ rprod ra rb = Compare (rprodCompare ra rb)
+ rcon cd ra = Compare (rconCompare cd ra)
+ rtype ep ra = Compare (rtypeCompare ep ra)
+
+rconstantCompare :: (Ord a) => a -> a -> Ordering
+rsumCompare :: Compare a -> Compare b -> a :+: b -> a :+: b -> Ordering
+rprodCompare :: Compare a -> Compare b -> a :*: b -> a :*: b -> Ordering
+rprodCompare ra rb (a1 :*: b1) (a2 :*: b2) =
+rconCompare :: ConDescr -> Compare a -> a -> a -> Ordering
+rtypeCompare :: EP a b -> Compare b -> a -> a -> Ordering
+compare :: (Rep Compare a) => a -> a -> Ordering
+\end{code}
View
13 docs/list-emgm.lhs
@@ -0,0 +1,13 @@
+%include polycode.fmt
+\begin{code}
+data List a = Nil | Cons a (List a)
+type ListRep a = Unit :+: a :*: List a
+
+listEP :: EP (List a) (ListRep a)
+listEP = EP from to
+ where
+ from Nil = L Unit
+ from (Cons x xs) = R (x :*: xs)
+ to (L Unit) = Nil
+ to (R (x :*: xs)) = Cons x xs
+\end{code}
View
5 docs/list-instance.lhs
@@ -0,0 +1,5 @@
+%include polycode.fmt
+\begin{code}
+list = Cons 1 (Cons 2 (Const 3 Nil))
+rep = R (1 :*: R (2 :*: R (3 :*: Unit)))
+\end{code}
View
4 docs/list-sop.lhs
@@ -0,0 +1,4 @@
+%include polycode.fmt
+\begin{code}
+type ListRep a = Unit :+: a :*: List a
+\end{code}
View
4 docs/list.lhs
@@ -0,0 +1,4 @@
+%include polycode.fmt
+\begin{code}
+data List a = Nil | Cons a (List a)
+\end{code}

0 comments on commit e707469

Please sign in to comment.