]> hydra-www.ietfng.org Git - dyna2/commitdiff
Fix K3 backend selftest to deal with formatting
authorNathaniel Wesley Filardo <nwf@cs.jhu.edu>
Wed, 17 Oct 2012 20:43:34 +0000 (16:43 -0400)
committerNathaniel Wesley Filardo <nwf@cs.jhu.edu>
Wed, 17 Oct 2012 20:43:34 +0000 (16:43 -0400)
src/Dyna/BackendK3/Selftest.hs

index b842ba0e3ad06933c1012cf047fe4d14abba4e9f..86283ec68e45bdb422c2e5b7f9c82e99bd0d29f8 100644 (file)
@@ -27,7 +27,13 @@ displaySimple (SLine _   d) = showChar ' ' . displaySimple d
 displaySimple (SEffect _ d) =                displaySimple d
 
 render :: AsK3 e a -> String
-render = flip displaySimple [] . renderCompact . sh
+render = despace . flip displaySimple [] . renderCompact . sh
+ where
+  despace [] = []
+  despace [x] = [x]
+  despace (' ':xs@(' ':_)) = despace xs
+  despace (' ':xs) = ' ' : despace xs
+  despace (x  :xs) = x : despace xs
 
 ------------------------------------------------------------------------}}}
 -- Basic handling                                                       {{{