[Haskell-cafe] How to "Show" an Operation?

Daniel Fischer daniel.is.fischer at web.de
Fri Jun 4 12:02:15 EDT 2010


On Friday 04 June 2010 17:37:16, Martin Drautzburg wrote:
> Dear all,
>
> If I have a problem where I have to select from a set of operations, how
> would I print the result?
>
> Example: If I can chose from (x+y), (x*y), (x^2+y)...
> and I feed them all into my problem solver
> and it finds that "(x*y) is right", how can I print that string?

You'd have to pass the description string to the problem solver too.
If it was previously

solver :: Num a => Whatever -> [a -> a -> a] -> Result

it would become for example

solver :: Num a => Whatever -> [(a -> a -> a, String)] -> Result


More information about the Haskell-Cafe mailing list