Thu, 23 Aug 2001 15:02:28 +0400, S.D.Mechveliani <mechvel@math.botik.ru> pisze:
I wrote in the BAL paper that meaningful standard algebraic categories (classes) may, in principle, help the compiler to optimize programs using the properties related to the category names (associativity, commutativity ...).
How the compiler could take advantage of them? -- __("< Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/ \__/ ^^ SYGNATURA ZASTÊPCZA QRCZAK
Thu, 23 Aug 2001 15:02:28 +0400, S.D.Mechveliani <mechvel@math.botik.ru> pisze:
I wrote in the BAL paper that meaningful standard algebraic categories (classes) may, in principle, help the compiler to optimize programs using the properties related to the category names (associativity, commutativity ...).
Marcin Kowalczyk pisze:
How the compiler could take advantage of them?
Rewriting (x++y)++z to x++(y++z) so one, for example, doesn't need all the kludge in the Pretty printer? --Laszlo ============================================================================ Laszlo Nemeth Tel: +82-42-869-8788 ROPAS, Dept. of CS, KAIST Fax: +82-42-869-8780 373-1 Kusong-dong Yusong-gu E-mail: laszlo@ropas.kaist.ac.kr Daejeon 305-701, Korea URL: http://ropas.kaist.ac.kr/~laszlo ============================================================================
Rewriting (x++y)++z to x++(y++z) so one, for example, doesn't need all the kludge in the Pretty printer?
Note that the "kludge" in the pretty-printer is primarily to handle cases where the ++'s do not occur next to each other in the static text. For example, I might glue together a tree of strings using code like this: data Tree a = Node a [Tree a] glue :: Tree String -> String glue (Node x ts) = x ++ concatMap glue ts The uses of ++ and concatMap look just fine - at each node I'm appending strings in the efficient right-associative manner. But my code still takes quadratic time (worst case) because the ++ gets repeated at each level in the tree. I think this is the real problem being fixed in Pretty, ShowS, etc. -- Alastair Reid reid@cs.utah.edu http://www.cs.utah.edu/~reid/
participants (3)
-
Alastair David Reid -
Laszlo Nemeth -
Marcin 'Qrczak' Kowalczyk