[Haskell-cafe] Strange type behavior in GHCi 6.4.2

Mike Gunter m at ryangunter.com
Thu Dec 28 18:07:40 EST 2006

Chris Kuklewicz <haskell at list.mightyreason.com> writes:

> I played with such things, as seen on the old wiki:
> http://haskell.org/hawiki/ShortExamples_2fSymbolDifferentiation

Cool hack!

What is the use of a GADT buying in this example?  Replacing the GADT
with the seemingly equivalent non-GADT declaration (**) (and adding
Simplify b to the context of reflectVar) seems to yield the same


  data Simplify a => T a =
      -- Base
      Var SymName
    | Simplify a => Const a
      -- Num
    | Add [T a]
    | Mul [T a]
    | Sub (T a) (T a)
    | Neg (T a)
    | Abs (T a)
    | SigNum (T a)
      -- Fractional
    | Div (T a) (T a)
    | Recip (T a)
      -- Floating
    | Exp (T a)
    | Sqrt (T a)
    | Log (T a)
    | Pow (T a) (T a)
    | LogBase (T a) (T a)
    | Sin (T a)
    | Cos (T a)

More information about the Haskell-Cafe mailing list