[Haskell-cafe] Convert a function to a string of operators?
Brandon Moore
brandon_m_moore at yahoo.com
Sat Mar 5 01:33:23 CET 2011
> From: Evgeny Grablyk <evgeny.grablyk at gmail.com>
>
> Hello!
>
> I was wondering if it was possible to "convert" a function (which may
> also call functions) to a plain list of operators on parameters.
> Example:
If your "operators" are only things in Num (or maybe some other
typeclasses), the suggestions you have gotten about making a
special Num instance are excellent.
If you are curious how things are actually compiled, you can
use the -ddump-simpl option. This is way more detail that
you probably want, showing things like how + is implemented
in terms of more primitive operations, or explicit passing
around of class method dictionaries.
I hoped the ghci debugger might be useful, but it seems to
evaluate expressions like (baw 1 10 100) to a final result
in one step, and can't show you an expression corresponding
to unevaluated values.
Brandon
More information about the Haskell-Cafe
mailing list