{-# OPTIONS -fglasgow-exts #-} module VarArg where class BuildList a r | r-> a where build' :: [a] -> a -> r instance BuildList a [a] where build' l x = reverse$ x:l instance BuildList a r => BuildList a (a->r) where build' l x y = build'(x:l) y build x = build' [] x