Update where type inference example in tutorial
commitd79a445d1980e38a734187df2c6bc899f6e8c430
authorEdwin Brady <ecb10@st-andrews.ac.uk>
dateThu 16 May 2013, 12:07 (13 years ago)
parentaf78968
tutorial/examples/wheres.idrnew file+14
@@ -0,0 +1,14 @@
1+module wheres
2+
3+even : Nat -> Bool
4+even O = True
5+even (S k) = odd k where
6+ odd O = False
7+ odd (S k) = even k
8+
9+test : List Nat
10+test = [c (S 1), c O, d (S O)]
11+ where c x = 42 + x
12+ d y = c (y + 1 + z y)
13+ where z w = y + w
14+
tutorial/typesfuns.tex+5−5
@@ -257,11 +257,11 @@ even (S k) = odd k where
257257 odd O = False
258258 odd (S k) = even k
259259
260−test : Num a => List a
261−test = [c 1, c 2, d 3]
262− where c x = 42 + x
263− d y = c (y + 1 + z y)
264− where z w = y + w
260+test : List Nat
261+test = [c (S 1), c O, d (S O)]
262+ where c x = 42 + x
263+ d y = c (y + 1 + z y)
264+ where z w = y + w
265265
266266\end{SaveVerbatim}
267267\useverb{whereinfer}