[Ur] An Ur/Web implementation of TodoMVC

Adam Chlipala adamc at csail.mit.edu
Thu Jun 19 17:18:31 EDT 2014


Here we're running into the dreaded syntax tar pit, where everything is 
subjective. ;)

I don't like the name duplication from your second version, which is 
indeed supported by Standard ML, the biggest inspiration for Ur/Web syntax.

I also like having fewer orthogonal constructs in the language. Since 
explicit [case] is necessary in some places, I like the idea of making 
it the only way to do pattern matching.

It's possible I could be convinced to tweak the syntax in one of the 
ways you're suggesting, but I'm inclined against it, for the reasons 
I've given.  More verbose code can be more readable code!

On 06/17/2014 11:13 PM, Timothy Beyer wrote:
> At Tue, 17 Jun 2014 19:38:58 -0700,
> Timothy Beyer wrote:
>> I'd rather write something like the following (assuming that arguments are
>> treated as a tuple of values):
>>
>> fun mapX [a] (f : (unit -> list a) -> a -> xbody) (ls : list a) : xbody =
>>      let
>>          fun mapX' (ls, acc) =
>>            ([], _) => <xml/>
>>          | (x :: ls, _) => <xml>{f (fn () => List.revAppend acc ls) x}{mapX' (ls, (x :: acc))}</xml>
>>      in
>>          mapX' (ls, [])
>>      end
>>
> Alternatively, is something like the code below possible?
>
> fun mapX [a] (f : (unit -> list a) -> a -> xbody) (ls : list a) : xbody =
>      let
>          fun mapX' ls acc =
>            | mapX' [] _ = <xml/>
>            | mapX' (x :: ls) _ = <xml>{f (fn () => List.revAppend acc ls) x}{mapX' ls (x :: acc)}</xml>
>      in
>          mapX' ls []
>      end



More information about the Ur mailing list