
New patches:

[Improve lambda/pi printing code
Samuel Bronson <naesten@gmail.com>**20080411230159
 Only only put as many lambda/pi abstractions on a line as will fit.
 Use sortKindLike to get the uppercase lambdas for type variables of
 kind other than *. (For instance, * -> *.)
 
 I had to make E.TypeCheck, E.Eval and E.Subst import E.Show with a {-#
 SOURCE #-} pragma before I could use sortKindLike. (I also had to
 write the .hs-boot file, of course).
] {
hunk ./E/Eval.hs 12
 import Doc.PPrint
 import E.E
 import E.FreeVars
-import E.Show
+import {-# SOURCE #-} E.Show
 import E.Subst
 
 
hunk ./E/Show.hs 14
 import Doc.Pretty
 import E.E
 import E.FreeVars()
+import E.TypeCheck
 import Name.Id
 import Name.Name
 import Name.Names
hunk ./E/Show.hs 143
 
 tBoolzh = ELit litCons { litName = tc_Boolzh, litType = eHash, litAliasFor = Just tIntzh }
 
+-- collects lambda and pi abstractions
+collectAbstractions e0 = go e0 [] where
+    go e1@(EPi tvr e)  xs | tvrIdent tvr == 0                = done e1 xs
+                          | not (sortKindLike (tvrType tvr)) = go e ((UC.pI,     tvr, True) :xs)
+                          | dump FD.EVerbose || tvrIdent tvr `member` (freeVars e::IdSet)
+                                                             = go e ((UC.forall, tvr, False):xs)
+                          | otherwise                        = done e1 xs
+    go e1@(ELam tvr e) xs | sortKindLike (tvrType tvr)       = go e ((UC.lAmbda, tvr, False):xs)
+                          | otherwise                        = go e ((UC.lambda, tvr, True) :xs)
+    go  e           xs = done e xs
+    done e xs = (reverse xs, e)
+                                                  
 showE :: E -> SEM (Unparse Doc)
 showE e = do
     let const_color = col "blue"
hunk ./E/Show.hs 177
         f (EAp a b) = liftM2 app (showE a) (showE b)
         f (EPi (TVr { tvrIdent = 0, tvrType =  e1}) e2) = liftM2 arr (showE e1) (showE e2)
         f (EPi (TVr { tvrIdent = n, tvrType =  e1}) e2) | not $ dump FD.EVerbose, not $ n `member` (freeVars e2 ::IdSet) = liftM2 arr (showE e1) (showE e2)
-        f (EPi tvr@(TVr {  tvrType =  z}) e) | z == eStar = allocTVr tvr $ do
-            tvr <- showTVr' tvr
-            liftM2 dot (return $ pop (retOp UC.forall) tvr) (showE e)
-        f (EPi t e) = allocTVr t $ do
-            tvr <- showTVr t
-            e <- showE e
-            return $ (pop (retOp UC.pI) tvr) `dot` e
-        f (ELam tvr@TVr {tvrType =  z} e) | z == eStar = allocTVr tvr $ do
-            tvr <- showTVr' tvr
-            liftM2 dot (return $ pop (retOp UC.lAmbda) tvr) (showE e)
-        f (ELam t e) = allocTVr t $ do
-            tvr <- showTVr t
-            e <- showE e
-            return $ (pop (retOp UC.lambda) tvr) `dot` e
+        f e0 | (as@(_:_), e) <- collectAbstractions e0 =
+            foldr (\(_, tvr, _) -> allocTVr tvr)
+                  (do tops <- mapM p as
+                      e <- showE e
+                      return (atom $ group $ (align $ skipToNest <> fillCat tops) <$> unparse e))
+                  as
+            where 
+              p :: (Doc, TVr, Bool) -> SEM Doc
+              p (c,t,detailed) = do tvr <- if detailed then showTVr t else showTVr' t
+                                    return (retOp c <> unparse tvr <> retOp (char '.'))
         f (EVar tvr) = if dump FD.EVerbose then showTVr tvr else showTVr' tvr
         f Unknown = return $ symbol (char  '?')
         f (ESort s) = return $ symbol (tshow s)
hunk ./E/Show.hs 262
     (SEM pe') = showE e
     Identity pe = runVarNameT pe'
 
+-- skip to the current nesting level, breaking the line if already past it
+skipToNest      = column (\k ->
+                  nesting (\i -> if k > i
+                                 then linebreak
+                                 else text (replicate (i-k) ' ')))
addfile ./E/Show.hs-boot
hunk ./E/Show.hs-boot 1
+-- -*- Haskell -*-
+
+module E.Show(ePretty,render,prettyE,ePrettyEx) where
+
+import E.E
+import Doc.DocLike
+import Doc.Pretty
+import Doc.PPrint
+
+render :: Doc -> String
+prettyE :: E -> String
+ePrettyEx :: E -> Doc 
+ePretty :: E -> Doc
+
+instance DocLike d => PPrint d TVr
+instance PPrint Doc E
+instance PPrint String E
+instance PPrint String (Lit E E)
hunk ./E/Subst.hs 48
 import E.E
 import E.FreeVars()
 import Name.Id
-import E.Show
+import Name.Names (tc_Arrow)
+import {-# SOURCE #-} E.Show
 import Support.FreeVars
 import GenUtil
 import Util.SetLike as S
hunk ./E/TypeCheck.hs 24
 import Doc.Pretty
 import E.E
 import E.Eval(strong)
-import E.Show
+import {-# SOURCE #-} E.Show
 import E.Subst
 import GenUtil
 import Name.Id
}

Context:

[Use $(HC) --interactive instead of ghci, in case a non-default version of GHC is in use
Samuel Bronson <naesten@gmail.com>**20080410193413] 
[fix conflicts in Name.Names
John Meacham <john@repetae.net>**20080326092848] 
[rearrange libraries some, move RULES to more logical places
John Meacham <john@repetae.net>**20080326092814] 
[allow 'non-decreasing indentation'
John Meacham <john@repetae.net>**20080326092755] 
[Improve (->) situation somewhat
Samuel Bronson <naesten@gmail.com>**20080318033431
 Control.Arrow still won't quite work... something about Control.Arrow.172_a not getting a kind inferred...
] 
[Remove duplicate case in kiType
Samuel Bronson <naesten@gmail.com>**20080317200547] 
[Allow irrefutable patterns in lambdas + regression test
Samuel Bronson <naesten@gmail.com>**20080330043358] 
[Oops... left out one of the most important parts of -dsquare-stats
Samuel Bronson <naesten@gmail.com>**20080320192134] 
[TAG eogmidkiv
John Meacham <john@repetae.net>**20080324121616] 
[add fibbonacci regression test
John Meacham <john@repetae.net>**20080324080332] 
[devolve devolved functions in grin
John Meacham <john@repetae.net>**20080324080252] 
[follow aliases to find basic types when converting to grin
John Meacham <john@repetae.net>**20080324070256] 
[add derived enum testing regression test
John Meacham <john@repetae.net>**20080324063054] 
[redo deriving of enumeration types
John Meacham <john@repetae.net>**20080324031110] 
[clean up warnings
John Meacham <john@repetae.net>**20080324014415] 
[add '--stale' option to force certain modules to be considered stale
John Meacham <john@repetae.net>**20080323235746] 
[make enums only 16 bits so they can be stored in sptr's directly
John Meacham <john@repetae.net>**20080323045845] 
[add basic support for the LANGUAGE pragma
John Meacham <john@repetae.net>**20080323031324] 
[add support for 30 bit Int's controlled with the -ffull-int flag. fix conversion functions for signed types
John Meacham <john@repetae.net>**20080323012213] 
[allow characters to be stored in the sptr_t directly, print them out nicely in the source code when possible
John Meacham <john@repetae.net>**20080322232116] 
[add support for storing small integer values directly in nodes.
John Meacham <john@repetae.net>**20080322225801] 
[make convertVal a local definition, start adding support for embedded primitives
John Meacham <john@repetae.net>**20080322214028] 
[add ToCmmTy class and some utility routines
John Meacham <john@repetae.net>**20080322214015] 
[add Data.Array.Unboxed and Data.Array.IO
John Meacham <john@repetae.net>**20080322194002] 
[fix m4 generated storable instances
John Meacham <john@repetae.net>**20080322004135] 
[clean up primitive operation peephole optimization code a bunch
John Meacham <john@repetae.net>**20080322000405] 
[add Cmm/ directory, clean up module names
John Meacham <john@repetae.net>**20080321210128] 
[code cleanups, add a 'BitsUnknown' class to types
John Meacham <john@repetae.net>**20080321202104] 
[TAG waxtoandyevi
John Meacham <john@repetae.net>**20080320232104] 
[add comments to conversion functions in C.Op, add B2B reinterpret cast coversion
John Meacham <john@repetae.net>**20080320182452] 
[add Unsafe.Coerce
John Meacham <john@repetae.net>**20080320153419] 
[add storable instances for float and double. expose Addr data constructor
John Meacham <john@repetae.net>**20080319211009] 
[add m4 files to those searched by gsource
John Meacham <john@repetae.net>**20080319210920] 
[get rid of old hardcoded tBox type
John Meacham <john@repetae.net>**20080319193358] 
[Add -dsquare-stats option for terminals with poor character coverage
Samuel Bronson <naesten@gmail.com>**20080320034832] 
[Layout wibble.
Lemmih <lemmih@gmail.com>**20080319154848] 
[Print '[ X of N ] name' for each module.
Lemmih <lemmih@gmail.com>**20080319154602] 
[Be less noisy when not in verbose mode.
Lemmih <lemmih@gmail.com>**20080319154404] 
[make showing of jhc core a bit more compact
John Meacham <john@repetae.net>**20080317152907] 
[fix option for BOEHM garbage collector
John Meacham <john@repetae.net>**20080314232909] 
[clean up C code generator just a bit
John Meacham <john@repetae.net>**20080313184924] 
[rearrange structure in generated c code to make them more compact and group GC followed pointers together
John Meacham <john@repetae.net>**20080313182657] 
[add alignment constraints to structures, clean up and annotate more of the rts
John Meacham <john@repetae.net>**20080313170334] 
[add code to track number of allocations of each size.
John Meacham <john@repetae.net>**20080313114637] 
[clean up memory allocation code in rts, do out of memory checking always.
John Meacham <john@repetae.net>**20080313103902] 
[move rts stuff to subdirectory
John Meacham <john@repetae.net>**20080313004150] 
[code cleanups
John Meacham <john@repetae.net>**20080313003743] 
[add some annotation to C expressions to allow the code generator to clean things up some, do a pass replacing all unused vars with v0, modify C.FromGrin to handle v0 properly, not trying to assign to it.
John Meacham <john@repetae.net>**20080312224356] 
[separate declarations of c varaiables from their uses, push variable declarations inwards in c code
John Meacham <john@repetae.net>**20080312134931] 
[remove some warningns in generate, sort local variable declarations, add more warnings checks on generated c code, don't assign to unused vars bound in case statements
John Meacham <john@repetae.net>**20080312131000] 
[Jhc.IOArray module implementing extremely basic IOArray functionality
Samuel Bronson <naesten@gmail.com>**20080316233339] 
[Fix parsing of @ patterns so that Data.HashTable parses
Samuel Bronson <naesten@gmail.com>**20080316232916] 
[Doesn't quite work
Samuel Bronson <naesten@gmail.com>**20080315202515] 
[clean out old IORef code now that we use Alloc and Index
John Meacham <john@repetae.net>**20080312233220] 
[fill out System.IO routines
John Meacham <john@repetae.net>**20080312045536] 
[when generating an 'if' statement, compare pointers directly when possible.
John Meacham <john@repetae.net>**20080312031931] 
[add code generation for FPwr and FAtan2
John Meacham <john@repetae.net>**20080312031859] 
[perform casting of return values of c calls to avoid spurious warnings from c compiler
John Meacham <john@repetae.net>**20080311181707] 
[Class aliases halfway done?
Samuel Bronson <naesten@gmail.com>**20080315015152] 
[Convenience command :recompile for GHCi usage; accompanying Makefile.am changes
Samuel Bronson <naesten@gmail.com>**20080312220054] 
[modify hashconster to know we don't need to allocate nodes that have no fields, modify code to always emit heap-less nodes when the node has no arguments
John Meacham <john@repetae.net>**20080311170446] 
[don't create constant entries in memory when they can be encoded in a sptr_t
John Meacham <john@repetae.net>**20080311010726] 
[don't store nodes that consist solely of a 'WHAT' field on the heap, encode it directly into the wptr_t.
John Meacham <john@repetae.net>**20080310170229] 
[add flag to C types to say whether the garbage collector might be interested in them. add macros for getting at the 'what' field.
John Meacham <john@repetae.net>**20080310124540] 
[add documentation of run time system to the manual
John Meacham <john@repetae.net>**20080310101340] 
[change function pointer representation so the GC can tell whether to follow pointers.
John Meacham <john@repetae.net>**20080308014755] 
[update datestamp
John Meacham <john@repetae.net>**20080309042215] 
[Misc. comments
Samuel Bronson <naesten@gmail.com>**20080308164934] 
[TAG frinredvos
John Meacham <john@repetae.net>**20080307160355] 
Patch bundle hash:
226fb80b95ded66ed468285b7b1b5a8894798e6a
