Popularity
4.8
Declining
Activity
0.0
Stable
9
2
1

Monthly Downloads: 22
Programming language: Haskell
License: BSD 3-clause "New" or "Revised" License
Tags: Data    
Latest version: v0.3.0.4

polyvariadic alternatives and similar packages

Based on the "Data" category.
Alternatively, view polyvariadic alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of polyvariadic or a related project?

Add another 'Data' Package

README

polyvariadic

Creation and application of polyvariadic functions

Build Status Hackage

For example, the classic printf:

{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
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"