# HG changeset patch # User Robin Green # Date 1309206992 -3600 # Node ID 3061d1bf4b2d0f404a5279bae1f0ee81f0df2ce4 # Parent aa0c6382aa5749804bafdd2a866a676b76e06fc4 recToList diff -r aa0c6382aa57 -r 3061d1bf4b2d lib/ur/list.ur --- a/lib/ur/list.ur Tue Jun 28 11:55:57 2011 +0100 +++ b/lib/ur/list.ur Mon Jun 27 21:36:32 2011 +0100 @@ -353,3 +353,7 @@ case assoc x ls of None => (x, y) :: ls | Some _ => ls + +fun recToList [a ::: Type] [r ::: {Unit}] (fl : folder r) + = @foldUR [a] [fn _ => list a] (fn [nm ::_] [rest ::_] [[nm] ~ rest] x xs => + x :: xs) [] fl diff -r aa0c6382aa57 -r 3061d1bf4b2d lib/ur/list.urs --- a/lib/ur/list.urs Tue Jun 28 11:55:57 2011 +0100 +++ b/lib/ur/list.urs Mon Jun 27 21:36:32 2011 +0100 @@ -79,3 +79,7 @@ val assoc : a ::: Type -> b ::: Type -> eq a -> a -> t (a * b) -> option b val assocAdd : a ::: Type -> b ::: Type -> eq a -> a -> b -> t (a * b) -> t (a * b) + +(** Converting records to lists *) + +val recToList : a ::: Type -> r ::: {Unit} -> folder r -> $(mapU a r) -> t a