Performance: Faster to define a function writing out all
arguments?
Don Stewart
dons at galois.com
Thu May 8 17:40:26 EDT 2008
alexander.fuchs:
> Hi there,
>
> I am trying to write my first serious Haskell program, but have
> problems understanding 'strange' performance results. It seems to be
> a ghc specific question, so I am asking here.
>
> In a happy parser I have this code 1):
>
> %monad { Parsed } { thenP } { returnP }
>
> type Parsed = State Env.Env
>
> returnP :: a -> Parsed a
> returnP a = return a
>
> thenP :: Parsed a -> (a -> Parsed b) -> Parsed b
> thenP x k = x >>= k
>
>
> An alternative was this 2) (yes, redundant in happy):
>
> returnP :: a -> Parsed a
> returnP = return
>
> thenP :: Parsed a -> (a -> Parsed b) -> Parsed b
> thenP = (>>=)
>
Could you submit a minimal, complete grammar file, so
we can look at the generated code?
-- Don
More information about the Glasgow-haskell-users
mailing list