<div dir="ltr"><div class="gmail_default" style=""><div class="gmail_default"><font face="arial, helvetica, sans-serif">When I pretty print a certain deleration (with default width) I get this:</font></div><div class="gmail_default"><font size="1" face="monospace, monospace"><br></font></div><div class="gmail_default"><font size="1" face="monospace, monospace">          upeekRow _unv (_xconc@(ImageSize {})) = Node (upeekCons idPath Nothing) (concatMap (\f -> forestMap (liftPeek f) (map (\x' -> Node (upeekCons idPath (Just (u x' :: Univ)) :: UPeek Univ</font></div><div class="gmail_default"><font size="1" face="monospace, monospace">                                                                                                                                                                                              Dimension) []) (toListOf (toLens (f idPath) . ulens' (Proxy :: Proxy Univ)) _xconc :: [Dimension]))) [UPath_ImageSize_dim] ++ (concatMap (\f -> forestMap (liftPeek f) (map (\x' -> Node (upeekCons idPath (Just (u x' :: Univ)) :: UPeek Univ</font></div><div class="gmail_default"><font size="1" face="monospace, monospace">                                                                                                                                                                                                                                                                                                                                                                                                                                        Double) []) (toListOf (toLens (f idPath) . ulens' (Proxy :: Proxy Univ)) _xconc :: [Double]))) [UPath_ImageSize_size] ++ (concatMap (\f -> forestMap (liftPeek f) (map (\x' -> Node (upeekCons idPath (Just (u x' :: Univ)) :: UPeek Univ</font></div><div class="gmail_default"><font size="1" face="monospace, monospace">                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             Units) []) (toListOf (toLens (f idPath) . ulens' (Proxy :: Proxy Univ)) _xconc :: [Units]))) [UPath_ImageSize_units] ++ [])))</font></div><div><br></div><div>However, what I would like to see is something closer to this:</div><div><br></div><div><div><font face="monospace, monospace"> <font size="1">         upeekRow _unv (_xconc@(ImageSize {})) =</font></font></div><div><font face="monospace, monospace" size="1">              Node (upeekCons idPath Nothing)</font></div><div><font face="monospace, monospace" size="1">                   (concatMap (\f -> forestMap (liftPeek f) (map (\x' -> Node (upeekCons idPath (Just (u x' :: Univ)) :: UPeek Univ Dimension) [])</font></div><div><font face="monospace, monospace" size="1">                                                                 (toListOf (toLens (f idPath) . ulens' (Proxy :: Proxy Univ)) _xconc :: [Dimension])))</font></div><div><font face="monospace, monospace" size="1">                              [UPath_ImageSize_dim] ++</font></div><div><font face="monospace, monospace" size="1">                    (concatMap (\f -> forestMap (liftPeek f) (map (\x' -> Node (upeekCons idPath (Just (u x' :: Univ)) :: UPeek Univ Double) [])</font></div><div><font face="monospace, monospace" size="1">                                                                  (toListOf (toLens (f idPath) . ulens' (Proxy :: Proxy Univ)) _xconc :: [Double])))</font></div><div><font face="monospace, monospace" size="1">                               [UPath_ImageSize_size] ++</font></div><div><font face="monospace, monospace" size="1">                     (concatMap (\f -> forestMap (liftPeek f) (map (\x' -> Node (upeekCons idPath (Just (u x' :: Univ)) :: UPeek Univ Units) [])</font></div><div><font face="monospace, monospace" size="1">                                                                   (toListOf (toLens (f idPath) . ulens' (Proxy :: Proxy Univ)) _xconc :: [Units])))</font></div><div><font face="monospace, monospace" size="1">                                [UPath_ImageSize_units] ++ [])))</font></div></div><div><font face="monospace, monospace"><br></font></div><div><font face="arial, helvetica, sans-serif">So I guess what I'm seeing is that as it is traversing the syntax tree when it finds it is too far to the right it just inserts a line break - but since it is so far down the tree it only buys it a few spaces, whereas if it had backtracked a few levels up the tree the new position would be much further to the left.  Could anyone point me towards the code that implements this decision making?  I'm pretty sure it is in the display function Text.PrettyPrint.Annotated.HughesPJ, but the code there doesn't make much sense to me.  Any thoughts would be appreciated.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">David Fox</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div></div></div>