On Wed, 1 Dec 2004, Dusan Kolar wrote:
> Hello, > > I'm trying to make work the following code (I'm using GHCi > with flags -fglasgow-exts -fallow-undecidable-instances): > > infixl 6 :+, :- > infixl 6 .+, .- > > data TMyExpr = TMyExpr :+ TMyExpr > | TMyExpr :- TMyExpr > | Val Int > | Id String What about introducing a single type parameter class which can convert both Int and TMyExpr to TMyExpr? (untested code follows) class MkExpr a where toExpr :: a -> TMyExpr (.+) :: (MkExpr a, MkExpr b) => a -> b -> TMyExpr (.+) x y = toExpr x :+ toExpr y _______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
