comparison tests/unurlify.ur @ 402:ebf27030ae3b

Recursive unurlify for Default datatypes
author Adam Chlipala <adamc@hcoop.net>
date Tue, 21 Oct 2008 15:11:42 -0400
parents ab3177746c78
children
comparison
equal deleted inserted replaced
401:cc71fb7e5e54 402:ebf27030ae3b
1 datatype list t = Nil | Cons of t * list t 1 datatype list t = Nil | Cons of t * list t
2 2
3 fun handler (ls : list bool) = return <xml/> 3 fun handler (ls : list bool) = return <xml/>
4 4
5 datatype wlist = WNil | Empty | WCons of bool * wlist
6
7 fun whandler' (ls : wlist) =
8 case ls of
9 WNil => <xml>Nil</xml>
10 | Empty => <xml>Empty</xml>
11 | WCons (x, ls') => <xml>{[x]} :: {whandler' ls'}</xml>
12
13 fun whandler ls = return (whandler' ls)
14
5 fun main () : transaction page = return <xml><body> 15 fun main () : transaction page = return <xml><body>
6 <a link={handler Nil}>!</a> 16 <a link={handler Nil}>!</a><br/>
17 <a link={whandler WNil}>Nil</a><br/>
18 <a link={whandler Empty}>Empty</a><br/>
19 <a link={whandler (WCons (True, WCons (False, Empty)))}>True :: False :: Empty</a><br/>
7 </body></xml> 20 </body></xml>