Mercurial > urweb
comparison 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 |
comparison
equal
deleted
inserted
replaced
289:0cc956a3216f | 290:df00701f2323 |
---|---|
1 fun s2i s = | 1 fun s2i s = |
2 case stringToInt s of | 2 case read _ s of |
3 None => 0 | 3 None => 0 |
4 | Some n => n | 4 | Some n => n |
5 | 5 |
6 fun s2f s = | 6 fun s2f s = |
7 case stringToFloat s of | 7 case read _ s of |
8 None => 0.0 | 8 None => 0.0 |
9 | Some n => n | 9 | Some n => n |
10 | 10 |
11 fun s2b s = | 11 fun s2b s = |
12 case stringToBool s of | 12 case read _ s of |
13 None => False | 13 None => False |
14 | Some b => b | 14 | Some b => b |
15 | 15 |
16 fun main () : transaction page = return <html><body> | 16 fun main () : transaction page = return <html><body> |
17 Error = {cdata (show _ (s2i "Error"))}<br/> | 17 Error = {cdata (show _ (s2i "Error"))}<br/> |