polyvariadic 0.3.0.1 → 0.3.0.2
raw patch · 3 files changed
+43/−1 lines, 3 files
Files
- ChangeLog.md +4/−0
- README.md +37/−0
- polyvariadic.cabal +2/−1
ChangeLog.md view
@@ -1,5 +1,9 @@ # Revision history for polyvariadic +## 0.3.0.2 -- 2017-12-19++* Added readme to extra-source-files so it shows up on hackage+ ## 0.3.0.0 -- 2017-04-19 * First public version.
+ README.md view
@@ -0,0 +1,37 @@+# polyvariadic++**Creation and application of polyvariadic functions**++[](https://travis-ci.org/fgaz/polyvariadic)+[](https://hackage.haskell.org/package/polyvariadic)++For example, the classic printf:++```haskell+{-# 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+```++```haskell+>>> printf' "aaa%bbb%ccc%ddd" "TEST" 123 True+"aaa\"TEST\"bbb123cccTrueddd"+```+
polyvariadic.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: polyvariadic-version: 0.3.0.1+version: 0.3.0.2 synopsis: Creation and application of polyvariadic functions description: Creation and application of polyvariadic functions, see the docs for usage and examples homepage: https://github.com/fgaz/polyvariadic@@ -14,6 +14,7 @@ category: Data build-type: Simple extra-source-files: ChangeLog.md+ , README.md cabal-version: >=1.10 source-repository head