On 4 March 2011 22:10, Job Vranish <[email protected]> wrote:
> Make your own expression type and make it an instance of the Num typeclass.

This is also the approach I took in repr:

http://hackage.haskell.org/package/repr

For example:

$ cabal install repr
$ ghci
> import Text.Repr
> let r = 1.5 + 2 + (3 + (-4) * (5 - pi / sqrt 6)) :: Repr Double
> extract r
17.281195923884734
> show r
"fromRational (3 % 2) + 2 + (3 + negate 4 * (5 - pi / sqrt 6))"

Bas

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to