@@ -322,13 +322,14 @@ on user input:
322322main : IO ()
323323main = do putStr "Enter a number: "
324324 x <- getLine
325− print (interp [] fact (prim__strToInt x))
325+ print (interp [] fact (cast x))
326326
327327\end{SaveVerbatim}
328328\useverb{factmain}
329329
330330\noindent
331−Here, \texttt{prim\_\_strToInt} is a primitive function which converts a string to
331+Here, \texttt{cast} is an overloaded function which converts a value from one
332+type to another if possible. Here, it conversts a string to
332333an integer, giving 0 if the input is invalid. An example run of this program
333334at the \Idris{} interactive environment is shown in Figure \ref{factrun}.
334335
@@ -350,3 +351,24 @@ Enter a number: 6
350351\end{SaveVerbatim}
351352\codefig{factrun}{Running the well-typed interpreter}
352353
354+\subsubsection*{Aside: \texttt{cast}}
355+
356+The prelude defines a type class \texttt{Cast} which allows conversion between
357+types:
358+
359+\begin{SaveVerbatim}{castclass}
360+
361+class Cast a b where
362+ cast : a -> b
363+
364+\end{SaveVerbatim}
365+\useverb{castclass}
366+
367+\noindent
368+It is a \emph{multi-parameter} type class, defining the source type and object
369+type of the cast. It must be possible for the type checker \remph{both}
370+parameters at the point where the cast is applied.
371+There are casts defined between all of the primitive types, as far as
372+they make sense.
373+
374+