Wow. > That said, it is quite possible in Haskell to achieve genuine > class-based dispatch, with backtracking if necessary: > http://pobox.com/~oleg/ftp/Haskell/poly2.txt Thanks for digging this up. I'll have to reread it tomorrow. I wasn't able to find the definition of AllOf(But): quote type Nums = Int :*: Integer :*: AllOf Fractionals :*: HNil type Ords = Bool :*: Char :*: AllOf Nums :*: HNil type Eqs = AllOf (TypeCl OpenEqs) :*: AllOfBut Ords Fractionals :*: HNil
> However, it seems that your particular problem can be solved with > simpler means: > > instance (HList a) => HListAppendArbitrary a HNil a where > > hAppendArbitrary a _ = a > > instance (HList a, HList b, HList c) > > => HListAppendArbitrary a (HCons b d) c where > > hAppendArbitrary a b = hAppend a b -- or use HCons with recursion You are right. But it's more complicated in the sense that it needs two instance declarations compared to one (called much boilerplate in the article) ... > Incidentally, the code in your previous messages contained > -fallow-incoherent-instances. I'd like to caution against using this > extension. I agree. It was a stupid >>perhaps this will make it compile<< try and error approach. Thanks oleg! Marc _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe