Skip to content

Commit

Permalink
Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Eidhof committed Dec 18, 2008
1 parent 90196a9 commit ff95081
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
7 changes: 5 additions & 2 deletions DepTypes.hs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ import Slides
import Frame hiding (ruby) import Frame hiding (ruby)
import qualified Frame import qualified Frame
import Latex import Latex
import Text.PrettyPrint.HughesPJ (render)

main = putStrLn $ render $ renderLhs agda


agda = Presentation "Silver Bullet: Dependent Types" "Chris Eidhof" asections agda = Presentation "Silver Bullet: Dependent Types" "Chris Eidhof" asections


asections = [ introduction asections = [ introduction
,Section "The Action" [] , Section "The Action" []
[ Section "Typing the shell" [] [] [ Section "Typing the shell" [] []
, Section "Relational databases" [] [] , Section "Relational databases" [] []
, Section "Other examples" [] , Section "Other examples" []
Expand All @@ -26,7 +29,7 @@ asections = [ introduction
] ]


introduction = Section "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 , frame "Curl in Ruby" rubyCode
] ]
[ Section "Curl" [] [] [ Section "Curl" [] []
Expand Down
12 changes: 10 additions & 2 deletions Latex.hs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import Frame hiding (title, text)
import qualified Frame as F import qualified Frame as F
import Text.PrettyPrint.HughesPJ 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 :: Int -> Section -> Doc
lhsSec n sec = c ((concat $ replicate n "sub") ++ "section") <> braces (text $ name sec) lhsSec n sec = c ((concat $ replicate n "sub") ++ "section") <> braces (text $ name sec)
Expand All @@ -23,14 +25,20 @@ lhsFrame f = c "frame{" $+$ (
lhsFrameMarkup (TitlePage) = c "titlepage" lhsFrameMarkup (TitlePage) = c "titlepage"
lhsFrameMarkup (Image i sz) = with "figure" $ c1 "includegraphics" i lhsFrameMarkup (Image i sz) = with "figure" $ c1 "includegraphics" i
lhsFrameMarkup (a :&: b ) = lhsFrameMarkup a $+$ lhsFrameMarkup b 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 (Text t) = text t
lhsFrameMarkup (Bullet bs) = with "itemize" $ vcat $ map item bs lhsFrameMarkup (Bullet bs) = with "itemize" $ vcat $ map item bs
where item i = c "item" <> space <> text i where item i = c "item" <> space <> text i


-- command -- command
c :: String -> Doc
c x = text "\\" <> text x c x = text "\\" <> text x

with :: String -> Doc -> Doc
with x body = c1 "begin" x $+$ body $+$ c1 "end" x with x body = c1 "begin" x $+$ body $+$ c1 "end" x

c1 :: String -> String -> Doc
c1 x y = c x <> braces (text y) c1 x y = c x <> braces (text y)


class Outline t where class Outline t where
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,5 @@
presentation: DepTypes.tex
latexmk -pdf DepTypes.tex

DepTypes.tex: *.hs
runhaskell DepTypes > DepTypes.tex
2 changes: 1 addition & 1 deletion Slides.hs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ data Presentation = Presentation { title :: String
, author :: String , author :: String
, sections :: [Section] , 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.