!-,)     (c) Francesco Gazzetta 2017BSD3 (see the file LICENSE)francygazz@gmail.orgstableportableSafe=?@A  polyvariadicLift a _ into an Accumulator. This is a newtype because (<>) isn't always the ideal way of accumulating polyvariadic`An 'Accumulator c i' supports accumulation of elements of type i in it. This is different from  or , where - acts between two values with the same type. polyvariadicAccumulate a single value in a  polyvariadic+Strictly accumulate multiple values from a , from left to right polyvariadicAccumulate a value(c) Francesco Gazzetta 2017BSD3 (see the file LICENSE)francygazz@gmail.org experimentalportableSafe=?@A+  polyvariadicYApplication of function with an arbitrary number of arguments to the elements of a list.<Will raise an error if the list doesn't have enough elementsExamples8apply ((+) :: Int -> Int -> Int) ([1,2] :: [Int]) :: Int3  polyvariadic<Creation of functions with an arbitrary number of arguments./The arguments will be accumulated in the given <, which will then be passed as an argument to the function.ExamplesThree integers to a list. Note that you have to add type annotations for nearly everything to avoid ambiguities >>> polyvariadic mempty (id :: [Int] -> [Int]) (1::Int) (2::Int) (3::Int) :: [Int] The classic printfV function, which takes an arbitrary amount of arguments and inserts them in a string: {- LANGUAGE MultiParamTypeClasses -} {- LANGUAGE FlexibleInstances -} {- LANGUAGE FlexibleContexts f-} import Data.Function.Polyvariadic import Data.Accumulator magicChar = '%' notMagicChar = (/= magicChar) data PrintfAccum = PrintfAccum { done :: String, todo :: String } instance Show x => Accumulator PrintfAccum x where accumulate x (PrintfAccum done (_:todo)) = PrintfAccum (done ++ show x ++ takeWhile notMagicChar todo) (dropWhile notMagicChar todo) accumulate _ acc = acc printf' str = polyvariadic (PrintfAccum (takeWhile notMagicChar str) (dropWhile notMagicChar str)) done )printf' "aaa%bbb%ccc%ddd" "TEST" 123 True"aaa\"TEST\"bbb123cccTrueddd" polyvariadicTakes an accumulator acc , a function fP, and an arbitrary number of additional arguments which will be accumulated in acc, which is finally passed to f. polyvariadicLike   but with an arbitrary  instead if a list polyvariadicMThere are no more arguments to accumulate so the function is applied to the  polyvariadicAccumulates the next argument polyvariadic8The final type is reached and the application terminates polyvariadic?The final type is not reached yet and the application continues        +polyvariadic-0.3.0.4-BeZPOWjRBf35jOofoPWeqOData.AccumulatorData.Function.PolyvariadicAccumulatorSemigroupgetAccumulatorSemigroup Accumulator accumulate singletonaccumulateMany$fAccumulatorSeta$fAccumulator[]a$fSemigroupAccumulatorSemigroup5$fAccumulatorAccumulatorSemigroupAccumulatorSemigroupApplyapply' Polyvariadic polyvariadicapply%$fPolyvariadicaccumulatorresultresult$fPolyvariadiccb-> $fApplyabb $fApplyab->baseGHC.Base SemigroupMonoid<> Data.FoldableFoldable