Context Navigation


Changeset 180


Ignore:
Timestamp:
Jan 24, 2008, 12:52:28 PM (18 years ago)
Author:
neil.c.c.brown
Message:

Fixed the indentation of the code that was trailing off the right-hand edge of the screen

File:
1 edited

Legend:

Unmodified
Added
Removed
  • docs/trunk/hacking-guide/tock-intro.tex

    r179 r180
    106106
    107107\begin{lstlisting}
    108 doProcess :: A.Process -> PassM A.Process
    109 doProcess (A.Assign m vs@(_:_:_) (A.ExpressionList _ es))
    110 = do ts <- mapM typeOfVariable vs
    111 specs <- sequence [makeNonceVariable "assign_temp" m t A.VariableName A.Original | t <- ts]
    112 let temps = [A.Variable m n | A.Specification _ n _ <- specs]
    113 let first = [A.Assign m [v] (A.ExpressionList m [e]) | (v, e) <- zip temps es]
    114 let second = [A.Assign m [v] (A.ExpressionList m [A.ExprVariable m v']) | (v, v') <- zip vs temps]
    115 return $ A.Seq m $ foldl (\s spec -> A.Spec m spec s) (A.Several m (map (A.OnlyP m) (first ++ second))) specs
    116 doProcess p = doGeneric p
    108doProcess :: A.Process -> PassM A.Process
    109doProcess (A.Assign m vs@(_:_:_) (A.ExpressionList _ es))
    110 = do ts <- mapM typeOfVariable vs
    111 specs <- sequence
    112 [makeNonceVariable "assign_temp" m t A.VariableName A.Original | t <- ts]
    113 let temps = [A.Variable m n | A.Specification _ n _ <- specs]
    114 let first = [A.Assign m [v] (A.ExpressionList m [e]) | (v, e) <- zip temps es]
    115 let second = [A.Assign m [v] (A.ExpressionList m [A.ExprVariable m v'])
    116 | (v, v') <- zip vs temps]
    117 return $ A.Seq m $ foldl (\s spec -> A.Spec m spec s)
    118 (A.Several m (map (A.OnlyP m) (first ++ second))) specs
    119doProcess p = doGeneric p
    117120\end{lstlisting}
    118121
    155158
    156159\begin{lstlisting}
    157makeNonceVariable :: CSM m => String -> Meta -> A.Type -> A.NameType -> A.AbbrevMode -> m A.Specification
    160makeNonceVariable :: CSM m => String -> Meta -> A.Type ->
    161 A.NameType -> A.AbbrevMode -> m A.Specification
    158162\end{lstlisting}
    159163
    190194Note that you there is nor really an opposite of the return function (something of type \lstinline|m a -> a|).
    191195Values can never really be `freed' from the monad; everything around them just gets lifted inside.
    196(追記) (追記ここまで)
    197(追記) %TODO explain what the code actually does, too! (追記ここまで)
    192198
    193199\subsection{The PassM monad}
    216222 -> CompState -- ^ The state to use to run the pass.
    217223 -> IO (CompState, Either ErrorReport b) -- ^ The resultant state, and either an error or the successful outcome of the pass.
    218runPass actualPass startState = (liftM (\(x,y) -> (y,x))) (runStateT (runErrorT actualPass) startState)
    224runPass actualPass startState = (liftM (\(x,y) -> (y,x)))
    225 (runStateT (runErrorT actualPass) startState)
    219226\end{lstlisting}
    220227
Note: See TracChangeset for help on using the changeset viewer.

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