Permalink
Browse files

Changes

  • Loading branch information...
1 parent 90196a9 commit ff95081b8d1a79f749e3bd6890fba286ff4dca7c Chris Eidhof committed Dec 18, 2008
Showing with 21 additions and 5 deletions.
  1. +5 −2 DepTypes.hs
  2. +10 −2 Latex.hs
  3. +5 −0 Makefile
  4. +1 −1 Slides.hs
View
@@ -4,11 +4,14 @@ import Slides
import Frame hiding (ruby)
import qualified Frame
import Latex
+import Text.PrettyPrint.HughesPJ (render)
+
+main = putStrLn $ render $ renderLhs agda
agda = Presentation "Silver Bullet: Dependent Types" "Chris Eidhof" asections
asections = [ introduction
- ,Section "The Action" []
+ , Section "The Action" []
[ Section "Typing the shell" [] []
, Section "Relational databases" [] []
, Section "Other examples" []
@@ -26,7 +29,7 @@ asections = [ introduction
]
introduction = Section "Introduction"
- [ frame "" (titlePage <&> image "images/silver-bullet.jpg" 4)
+ [ frame "" (titlePage {- <&> image "images/silver-bullet.jpg" 4 -})
, frame "Curl in Ruby" rubyCode
]
[ Section "Curl" [] []
View
@@ -5,7 +5,9 @@ import Frame hiding (title, text)
import qualified Frame as F
import Text.PrettyPrint.HughesPJ
-lhs = vcat . map (lhsSec 0) . sections
+renderLhs :: Presentation -> Doc
+renderLhs presentation = c1 "documentclass" "beamer" $+$
+ (with "document" $ vcat $ map (lhsSec 0) $ sections presentation)
lhsSec :: Int -> Section -> Doc
lhsSec n sec = c ((concat $ replicate n "sub") ++ "section") <> braces (text $ name sec)
@@ -23,14 +25,20 @@ lhsFrame f = c "frame{" $+$ (
lhsFrameMarkup (TitlePage) = c "titlepage"
lhsFrameMarkup (Image i sz) = with "figure" $ c1 "includegraphics" i
lhsFrameMarkup (a :&: b ) = lhsFrameMarkup a $+$ lhsFrameMarkup b
-lhsFrameMarkup (Code _ c) = vcat $ [space] ++ (map (\x -> text $ ">" ++ x) (lines c)) ++ [space]
+lhsFrameMarkup (Code "haskell" c) = vcat $ [space] ++ ((\x -> text $ ">" ++ x) `map` lines c) ++ [space]
+lhsFrameMarkup (Code _ c) = with "verbatim" (text c)
lhsFrameMarkup (Text t) = text t
lhsFrameMarkup (Bullet bs) = with "itemize" $ vcat $ map item bs
where item i = c "item" <> space <> text i
-- command
+c :: String -> Doc
c x = text "\\" <> text x
+
+with :: String -> Doc -> Doc
with x body = c1 "begin" x $+$ body $+$ c1 "end" x
+
+c1 :: String -> String -> Doc
c1 x y = c x <> braces (text y)
class Outline t where
View
@@ -0,0 +1,5 @@
+presentation: DepTypes.tex
+ latexmk -pdf DepTypes.tex
+
+DepTypes.tex: *.hs
+ runhaskell DepTypes > DepTypes.tex
View
@@ -6,4 +6,4 @@ data Presentation = Presentation { title :: String
, author :: String
, sections :: [Section]
}
-data Section = Section { name :: String, frames :: [Frame], subsections :: [Section]}
+data Section = Section { name :: String, frames :: [Frame], subsections :: [Section]}

0 comments on commit ff95081

Please sign in to comment.