Context Navigation


Changeset 25


Ignore:
Timestamp:
Nov 23, 2007, 11:18:30 AM (18 years ago)
Author:
ats
Message:

Various small tweaks based on the OOo version and Neil's comments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • docs/trunk/200711-tock-seminars/200711-tock-slides.tex

    r24 r25
    2828\title{Tock}
    2929\subtitle{A Swift Kick in the Monads}
    30(追記) % FIXME: Ahem... (追記ここまで)
    31(追記) % "Our quest to use as many Haskell libraries as possible in one (追記ここまで)
    32(追記) % project" (追記ここまで)
    3033
    3134\author{Neil Brown and Adam Sampson}
    8285 columns=flexible,
    8386 basicstyle=\small,
    84 keywordstyle=\color{b(削除) (削除ここまで)lue}\bfseries,
    87 keywordstyle=\color{b(追記) eamer@blendedb (追記ここまで)lue}\bfseries,
    8588 identifierstyle=,
    8689 commentstyle=\color{ForestGreen}\itshape,
    146149 \item Relatively straightforward to add new frontends and backends
    147150\end{itemize}
    151(追記) %FIXME: Needs >-< diagram (追記ここまで)
    148152\end{frame}
    149153
    187191 \end{itemize}
    188192%FIXME: picture
    193(追記) %FIXME: code gen isn't really separate pass -- could rename to "output"? (追記ここまで)
    189194\end{itemize}
    190195\end{frame}
    200205 \item Emit final AST as generated code
    201206%FIXME: picture
    207(追記) %FIXME: this feels like a duplicate of the previous slide (追記ここまで)
    202208\end{itemize}
    203209\end{frame}
    283289data Meta = Meta SourcePos
    284290data Process = Seq Meta [Process]
    285(削除) (削除ここまで)| Alt Meta [AltGuard]
    286(削除) (削除ここまで)| ...
    291(追記) (追記ここまで)| Alt Meta [AltGuard]
    292(追記) (追記ここまで)| ...
    287293data AltGuard = AltGuard Meta Guard Process
    288(削除) (削除ここまで)| ...
    294(追記) (追記ここまで)| ...
    289295\end{lstlisting}
    290296\begin{itemize}
    309315\end{lstlisting}
    310316\begin{itemize}
    311 \item \lstinline|foo'| can be applied to any (削除) (削除ここまで)|Typeable| type
    317 \item \lstinline|foo'| can be applied to any (追記) \lstinline (追記ここまで)|Typeable| type
    312318 \item Provides introspection and dynamic typing in Haskell
    313319\end{itemize}
    320(追記) % FIXME: Justify choice of generics library (because it works and it (追記ここまで)
    321(追記) % comes with GHC) (追記ここまで)
    314322\end{frame}
    315323
    318326\begin{itemize}
    319327 \item This does not automatically recurse
    320 \item You get (削除) |gmapT| -- generic (削除ここまで)|map| -- which looks at the type and
    328 \item You get (追記) \lstinline|gmapT| -- generic \lstinline (追記ここまで)|map| -- which looks at the type and
    321329 maps across all the type constructor arguments
    322330 \item Library provides various higher-level functions built on this
    331339\frametitle{Scrap Your Boilerstate}
    332340\begin{itemize}
    333 \item (削除) (削除ここまで)|Data.Generics| also provides monadic and query versions of all
    341 \item (追記) \lstinline (追記ここまで)|Data.Generics| also provides monadic and query versions of all
    334342 its functions
    335343\end{itemize}
    350358\frametitle{Scrapping Our Boilerplate}
    351359\begin{itemize}
    352 \item (削除) (削除ここまで)|everywhere| applies a transformation recursively
    360 \item (追記) \lstinline (追記ここまで)|everywhere| applies a transformation recursively
    353361 \item We can use this to write transformation passes
    354362 \begin{itemize}
    368376\frametitle{Problems with generics}
    369377\begin{itemize}
    370 \item |everywhere| really does look \emph{everywhere}
    371 \begin{itemize}
    372 \item e.g. at all the |Char|s in all the |String|s\ldots
    378 \item \lstinline|everywhere| really does look \emph{everywhere}
    379 \begin{itemize}
    380 \item e.g. at all the \lstinline|Char|s in all the
    381 \lstinline|String|s\ldots
    373382 \end{itemize}
    374383 \item Very slow!
    381390\frametitle{Problems with generics}
    382391\begin{itemize}
    383 \item Sometimes (削除) (削除ここまで)|everywhere| is not the traversal we want
    392 \item Sometimes (追記) \lstinline (追記ここまで)|everywhere| is not the traversal we want
    384393 \begin{itemize}
    385394 \item e.g. we only want the outermost part of a recursive type
    386395 % FIXME: emph first Par
    387 \item (削除) (削除ここまで)|Par (Par a b) (Par c d)|
    396 \item (追記) \lstinline (追記ここまで)|Par (Par a b) (Par c d)|
    388397 \end{itemize}
    389398 \item No problem -- we can write different traversal functions for
    395404\frametitle{Problems with generics}
    396405\begin{itemize}
    397 \item (削除) (削除ここまで)|Data.Generics| has some limitations
    406 \item (追記) \lstinline (追記ここまで)|Data.Generics| has some limitations
    398407 \item In particular, higher-order types are awkward to work with
    399408 \begin{itemize}
    465474 \end{itemize}
    466475\end{itemize}
    476(追記) %FIXME: Split this up among the following slides (追記ここまで)
    467477\end{frame}
    468478
    478488 (Block (Pos 7) [ ])
    479489\end{lstlisting}
    490(追記) %FIXME: Explain what Pos is (in description above anyway) (追記ここまで)
    480491\end{frame}
    481492
    495506 ) = True
    496507 checkIfTest0 _ = False
    497(削除) (削除ここまで)
    498508\end{lstlisting}
    499509\end{frame}
    521531p0 = Pos 0
    522532\end{lstlisting}
    533(追記) %FIXME: More explanation (追記ここまで)
    523534\end{frame}
    524535
    537548 = Assign p0 (VarList p0 [lhv]) (ExprList p0 [JustVar rhv])
    538549\end{lstlisting}
    550(追記) %FIXME: Say "tmp42" or something instead of "t" here, to make it clear (追記ここまで)
    551(追記) %it's a nonce? (追記ここまで)
    539552\end{frame}
    540553
    560573 \item Use Haskell's pattern matching?
    561574 \begin{itemize}
    562 \item Can't (削除) avoid duplication in (削除ここまで) pattern
    575 \item Can't (追記) reuse repeated bits of (追記ここまで) pattern
    563576 \item Can't give a \emph{helpful} error when the pattern match
    564577 fails
    587600\frametitle{Generic pattern-matching}
    588601\begin{itemize}
    589 \item Built on (削除) (削除ここまで)|Data.Generics|
    602 \item Built on (追記) \lstinline (追記ここまで)|Data.Generics|
    590603\end{itemize}
    591604\begin{lstlisting}
    596609\end{lstlisting}
    597610\begin{itemize}
    598\item All (削除) (削除ここまで)|Named| items with the same name must match
    611\item All (追記) \lstinline (追記ここまで)|Named| items with the same name must match
    599612\end{itemize}
    600613\end{frame}
    625638 (mBlock DC ([ ] :: [Statement])))
    626639 (parse "if (a) { }")
    627
    640
    628641mExpr :: (Data a0, Data a1) => a0 -> a1 -> Pattern
    629642\end{lstlisting}
    643(追記) %FIXME: Show the helpful output from a failed match? (追記ここまで)
    644(追記) %FIXME: Point out mixing of pattern and normal data here (追記ここまで)
    630645\end{frame}
    631646
    645660 (mExprList DC [mJustVar rhv])
    646661\end{lstlisting}
    662(追記) %FIXME: Point out that singleAssign' can be reused between tests (追記ここまで)
    647663\end{frame}
    648664
    652668 \item Removed duplication, improved readability
    653669 \item More helpful errors when match fails
    654 \item We can match anything that's an instance of (削除) (削除ここまで)|Typeable|
    670 \item We can match anything that's an instance of (追記) \lstinline (追記ここまで)|Typeable|
    655671 \begin{itemize}
    656672 \item Functions are trickier
    657673 \end{itemize}
    658674 \item Patterns are type-checked at run-time (i.e. test-time)
    675(追記) \item Speed's not great (追記ここまで)
    676(追記) \begin{itemize} (追記ここまで)
    677(追記) \item Doesn't matter for tests (追記ここまで)
    678(追記) \item But if it were faster, we could use it in real (追記ここまで)
    679(追記) passes (追記ここまで)
    680(追記) \end{itemize} (追記ここまで)
    659681\end{itemize}
    660682\end{frame}
    752774
    753775%{{{ monads
    776(追記) %FIXME: kill this section (追記ここまで)
    754777\section{Monads}
    755778
    765788\frametitle{Some useful monads}
    766789\begin{itemize}
    767 \item (削除) (削除ここまで)|IO|: dealing with the real world
    768 \item (削除) (削除ここまで)|State|: persistent state which can be changed
    769 \item (削除) (削除ここまで)|Error|: any operation can throw an exception, short-circuiting the evaluation
    770 \item (削除) (削除ここまで)|Parser|: operations can consume tokens and backtrack upon failure
    790 \item (追記) \lstinline (追記ここまで)|IO|: dealing with the real world
    791 \item (追記) \lstinline (追記ここまで)|State|: persistent state which can be changed
    792 \item (追記) \lstinline (追記ここまで)|Error|: any operation can throw an exception, short-circuiting the evaluation
    793 \item (追記) \lstinline (追記ここまで)|Parser|: operations can consume tokens and backtrack upon failure
    771794\end{itemize}
    772795\end{frame}
    776799\begin{itemize}
    777800 \item Monads can be composed using monad transformers
    778 \item Our main monad composes the |Error|, |State| and |IO| monads
    801 \item Our main monad composes the \lstinline|Error|,
    802 \lstinline|State| and \lstinline|IO| monads
    779803 \begin{itemize}
    780804 \item Many other variations throughout Tock
    815839 \begin{itemize}
    816840 \item No lookahead needed
    817 \item (削除) (削除ここまで)|try| lets you decide when to commit to a particular branch (like Prolog cut)
    841 \item (追記) \lstinline (追記ここまで)|try| lets you decide when to commit to a particular branch (like Prolog cut)
    818842 \end{itemize}
    819843 \item Can pass state around for awkward languages
    886910isJustVar _ = False
    887911\end{lstlisting}
    912(追記) %FIXME: "The code snippet is short, but I worry that it is not very (追記ここまで)
    913(追記) %understandable" (追記ここまで)
    888914\end{frame}
    889915
    936962 \item Must support recursion
    937963 \begin{itemize}
    938 \item e.g. |genWhile| -> |genProcess| -> |cppGenCall|
    964 \item e.g. \lstinline|genWhile| ->
    965 \lstinline|genProcess| -> \lstinline|cppGenCall|
    939966 %Note: don't want the above -> arrows to be highlighted as
    940967 %if they were Haskell code!
    9841011 genStatement = (\_ _ -> tell ["$$$"]) }
    9851012\end{lstlisting}
    1013(追記) %FIXME: undefined saves needing to construct a value, and makes sure (追記ここまで)
    1014(追記) %it's not evaluated (追記ここまで)
    9861015\end{frame}
    9871016
    10161045 %Note: we can't avoid exceptions or virtual functions in C++,
    10171046 %because they are part of C++CSP itself!
    1047(追記) %FIXME: That's OK -- we don't need to analyse C++CSP itself, (追記ここまで)
    1048(追記) %just like we don't analyse CCSP... say "control how we (追記ここまで)
    1049(追記) %generate"? (追記ここまで)
    10181050 \end{itemize}
    10191051\end{itemize}
    11691201
    11701202\begin{frame}
    1171\frametitle{How we use Haskell: a fistful of dollars}
    1203\frametitle{How we use Haskell}
    1204\framesubtitle{A fistful of dollars}
    11721205\begin{itemize}
    11731206 \item Use the \lstinline|$| operator to avoid nested brackets
    11881221
    11891222\begin{frame}
    1190\frametitle{Haskell frustrations: why doesn't this work?}
    1223\frametitle{Haskell frustrations}
    1224\framesubtitle{Why doesn't this work?}
    11911225\begin{itemize}
    11921226 \item Debugging is hard
    11981232 \end{itemize}
    11991233 \item Unit tests do help to narrow down problems
    1200 \item We often resort to printf debugging (that's why |IO| is in |PassM|)
    1201 \end{itemize}
    1202\end{itemize}
    1203\end{frame}
    1204
    1205\begin{frame}
    1206\frametitle{Haskell frustrations: what is your problem?}
    1234 \item We often resort to printf debugging (that's why
    1235 \lstinline|IO| is in \lstinline|PassM|)
    1236 \end{itemize}
    1237\end{itemize}
    1238%FIXME: example of a nasty type error with solution?
    1239\end{frame}
    1240
    1241\begin{frame}
    1242\frametitle{Haskell frustrations}
    1243\framesubtitle{What's the problem?}
    12071244\begin{itemize}
    12081245 \item Type errors
    12151252 \begin{itemize}
    12161253 \item Would be nice to be able to ask GHCI about
    1217 definitions in (削除) (削除ここまで)|where| clauses\ldots
    1254 definitions in (追記) \lstinline (追記ここまで)|where| clauses\ldots
    12181255 \end{itemize}
    12191256 \item We often resort to trial and error
    12231260
    12241261\begin{frame}
    1225\frametitle{Haskell frustrations: going in circles}
    1262\frametitle{Haskell frustrations}
    1263\framesubtitle{Going in circles}
    12261264\begin{itemize}
    12271265 \item Haskell disallows mutually recursive modules
    12281266 \begin{itemize}
    1229 \item |A.foo| calls |B.bar|, |B.bar| calls |A.baz|
    1267 \item \lstinline|A.foo| calls \lstinline|B.bar|, which
    1268 calls \lstinline|A.baz|
    12301269 \end{itemize}
    12311270 \item But we want to do this quite often
    12381277
    12391278\begin{frame}
    1240\frametitle{Haskell frustrations: a pain in the monads}
    1279\frametitle{Haskell frustrations}
    1280\framesubtitle{A pain in the monads}
    12411281\begin{itemize}
    12421282 \item Monad transformers aren't available for all monads
    12451285 \item You can't have a parser or test that does IO (safely!)
    12461286 \end{itemize}
    1247 \item Monad transformer typeclass instances (e.g. (削除) (削除ここまで)|MonadState|) aren't
    1287 \item Monad transformer typeclass instances (e.g. (追記) \lstinline (追記ここまで)|MonadState|) aren't
    12481288 derived automatically
    12491289\end{itemize}
Note: See TracChangeset for help on using the changeset viewer.

AltStyle によって変換されたページ (->オリジナル) /