diff options
author | Adam Chlipala <adamc@hcoop.net> | 2010-01-10 13:44:22 -0500 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2010-01-10 13:44:22 -0500 |
commit | 73b3f4158297d0161e1d18c24ff9a4604f07c32c (patch) | |
tree | 3519220c69228ad1cd9aba3c3e1096daf7eb1a58 /lib | |
parent | e5358b34831d7a333c5883873af65d0cbacf5524 (diff) |
Reduce concatenations of the empty record; unpoly non-recursive functions
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ur/string.ur | 5 | ||||
-rw-r--r-- | lib/ur/string.urs | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/ur/string.ur b/lib/ur/string.ur index 41ec666d..4025cf68 100644 --- a/lib/ur/string.ur +++ b/lib/ur/string.ur @@ -37,3 +37,8 @@ fun all f s = in al 0 end + +fun newlines [ctx] [[Body] ~ ctx] s : xml ([Body] ++ ctx) [] [] = + case split s #"\n" of + None => cdata s + | Some (s1, s2) => <xml>{[s1]}<br/>{newlines s2}</xml> diff --git a/lib/ur/string.urs b/lib/ur/string.urs index fda30ad9..5590b50c 100644 --- a/lib/ur/string.urs +++ b/lib/ur/string.urs @@ -20,3 +20,5 @@ val split : t -> char -> option (string * string) val msplit : {Haystack : t, Needle : t} -> option (string * char * string) val all : (char -> bool) -> string -> bool + +val newlines : ctx ::: {Unit} -> [[Body] ~ ctx] => string -> xml ([Body] ++ ctx) [] [] |