Skip to content

fixedparser optimisation (rewrite rules) is a bit fiddly #11

@chessai

Description

@chessai

look at the following gist: https://gist.github.com/chessai/39dfce8b2a56a05f3c48bd49ac52d066

it contains pairs of .hs files and their core output as a result of \module -> ghc module -O2 -ddump-simpl -dsuppress-all -fforce-recomp

each .hs file contains a parser for the 'Foo' datatype, defined as

data Foo = Foo Word64 Word64 Word64 Word64

in foo.hs, we use full applicative style. the core output is completely optimal.

in fooM.hs, we use monadic style. the core output is optimal for the first two parses, but the second two fail to optimise.

in fooA.hs, we use monadic style, but with -XApplicativeDo enabled. the core output is optimal for the latter three parses, but the first fails to optimise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions