haskell-lectures/VL1/content/VL1_pairs.tex
Julian Ospald f36590c9f4
Restructure files, make the latex code more modular
Also added a few more section to make beamer and article more
compatible.
2015-04-20 17:38:58 +02:00

11 lines
397 B
TeX

Defining a pair is easy.
\begin{haskellcode}
p :: (Int, Char) -- this is the type
p = (2, 'y') -- this is how we construct the pair
-- pattern matching against pairs
sumPair :: (Int, Int) -> Int
sumPair (x, y) = x + y
\end{haskellcode}
\pause
Note: we use \code{(x, y)} notation for both the type and the definition! Those are still two different things. We can also have triples, quadruples etc.