annotate tests/fromString.ur @ 290:df00701f2323

'read' type class
author Adam Chlipala <adamc@hcoop.net>
date Sun, 07 Sep 2008 11:53:30 -0400
parents 0cc956a3216f
children 550100a44cca
rev   line source
adamc@289 1 fun s2i s =
adamc@290 2 case read _ s of
adamc@288 3 None => 0
adamc@288 4 | Some n => n
adamc@288 5
adamc@289 6 fun s2f s =
adamc@290 7 case read _ s of
adamc@289 8 None => 0.0
adamc@289 9 | Some n => n
adamc@289 10
adamc@289 11 fun s2b s =
adamc@290 12 case read _ s of
adamc@289 13 None => False
adamc@289 14 | Some b => b
adamc@289 15
adamc@288 16 fun main () : transaction page = return <html><body>
adamc@289 17 Error = {cdata (show _ (s2i "Error"))}<br/>
adamc@289 18 3 = {cdata (show _ (s2i "+3"))}<br/>
adamc@289 19 <br/>
adamc@289 20 Error = {cdata (show _ (s2f "Error"))}<br/>
adamc@289 21 98.76 = {cdata (show _ (s2f "98.76"))}<br/>
adamc@289 22 <br/>
adamc@289 23 Error = {cdata (show _ (s2b "Error"))}<br/>
adamc@289 24 False = {cdata (show _ (s2b "false"))}<br/>
adamc@289 25 True = {cdata (show _ (s2b "trUE"))}<br/>
adamc@288 26 </body></html>