News for hackers. Stuff that matters.
Re:PHP in a Tweet by knome on Tuesday October 08, 2013 @10:21PM (#6519090)
Surprisingly, not really.

    {-# OPTIONS -fglasgow-exts #-}
    
    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
    
    varargs x = build' [] x
    
    main = print $ ( sum $ varargs 1 2 3 4 5 6 100)


    $ ./Test
    121

    
http://okmij.org/ftp/Haskell/vararg-fn.lhs
Re:PHP in a Tweet by tel on Wednesday October 09, 2013 @09:17AM (#6521024)
I love that example, but it does depend upon some pretty arcane features in Haskell's type inference engine.