changeset 1718:dd12d6d9e9a7

Add another rule to simplify record concatenations for pretty-printing
author Adam Chlipala <adam@chlipala.net>
date Sat, 21 Apr 2012 14:06:03 -0400
parents 16ee7ff7f119
children 0bafdfae2ac7
files src/elab_ops.sml tests/simplify.ur
diffstat 2 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/elab_ops.sml	Sat Apr 21 13:57:10 2012 -0400
+++ b/src/elab_ops.sml	Sat Apr 21 14:06:03 2012 -0400
@@ -1,4 +1,4 @@
-(* Copyright (c) 2008, Adam Chlipala
+(* Copyright (c) 2008, 2012, Adam Chlipala
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -482,6 +482,7 @@
               | ((CRecord (_, []), _), _) => c2
               | ((CConcat (c11, c12), loc), _) => reduceCon env (CConcat (c11, (CConcat (c12, c2), loc)), loc)
               | (_, (CRecord (_, []), _)) => c1
+              | ((CRecord (k, xcs1), loc), (CConcat ((CRecord (_, xcs2), _), c2'), _)) => (CConcat ((CRecord (k, xcs1 @ xcs2), loc), c2'), loc)
               | _ => (CConcat (c1, c2), loc)
         end
       | CMap _ => cAll
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/simplify.ur	Sat Apr 21 14:06:03 2012 -0400
@@ -0,0 +1,1 @@
+fun main [r] (r : $([A = int] ++ ([B = float] ++ r))) : $([A = float] ++ ([B = int] ++ r)) = r