Please postpone reviewing this series. Santi just told me about a Haskell
library for producing Python code, so I'd like to check first if we could
use it and how.


On Wed, Dec 11, 2013 at 2:20 PM, Petr Pudlak <[email protected]> wrote:

> Currently PyValue returns a String and composes complex results by
> concatenating
> strings. This can have O(n^2) complexity in some cases.
>
> By using the same trick as ShowS does - returning ShowS instead of String
> and
> composing functions instead of ++, we get O(n) complexity.
>
> Also in order to get an instance for String without having
> overlaping/inconsistent instances, we use the same trick as ShowS does with
> showList. This way, we don't need any "dangerous" type extensions.
>
> While at it, reorganize the modules. Move PyInstances.hs to PyValue.hs and
> put
> the type class declaration there as well. This makes it easier to use
> PyValue as
> well as it gets rid of orphan instances warning.
>
> Petr Pudlak (4):
>   Move PyValue into PyValueInstances.hs, import it in THH.hs
>   Rename PyValueInstances.hs to PyValue.hs
>   Use ShowS instead of String in PyValue
>   Add showValueList to PyValue for proper String instances
>
>  Makefile.am                          |   2 +-
>  src/Ganeti/ConstantUtils.hs          |  15 ++---
>  src/Ganeti/Hs2Py/GenConstants.hs     |   2 +-
>  src/Ganeti/Hs2Py/GenOpCodes.hs       |   2 +-
>  src/Ganeti/Hs2Py/ListConstants.hs.in |   2 +-
>  src/Ganeti/OpCodes.hs                |  21 +++----
>  src/Ganeti/PyValue.hs                | 112
> +++++++++++++++++++++++++++++++++++
>  src/Ganeti/PyValueInstances.hs       |  81 -------------------------
>  src/Ganeti/Rpc.hs                    |   2 +-
>  src/Ganeti/THH.hs                    |  17 +-----
>  src/Ganeti/Types.hs                  |   4 +-
>  11 files changed, 138 insertions(+), 122 deletions(-)
>  create mode 100644 src/Ganeti/PyValue.hs
>  delete mode 100644 src/Ganeti/PyValueInstances.hs
>
> --
> 1.8.5.1
>
>

Reply via email to