universum 0.4.2 → 0.4.3
raw patch · 3 files changed
+34/−26 lines, 3 files
Files
- CHANGES.md +5/−0
- src/VarArg.hs +26/−23
- universum.cabal +3/−3
CHANGES.md view
@@ -1,3 +1,8 @@+0.4.3+=====++* Assign associativity and priority to (...), export typeclass itself.+ 0.4.2 =====
src/VarArg.hs view
@@ -1,35 +1,38 @@-{-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE FunctionalDependencies #-}-{-# LANGUAGE IncoherentInstances #-}-{-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE NoMonomorphismRestriction #-}-{-# LANGUAGE TypeFamilies #-}-{-# LANGUAGE UndecidableInstances #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE FunctionalDependencies #-}+{-# LANGUAGE IncoherentInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE UndecidableInstances #-} +-- | Provides operator of variable-arguments function composition.+ module VarArg- ( (...)+ ( SuperComposition(..) ) where --- | Allows to apply function to result of another function with multiple--- arguments------ >>> (show ... (+)) 1 2--- "3"--- >>> show ... 5--- "5"--- (null ... zip5) [1] [2] [3] [] [5]--- True------ Inspired by <http://stackoverflow.com/questions/9656797/variadic-compose-function>-class Composition a b c | a b -> c where+class SuperComposition a b c | a b -> c where+ -- | Allows to apply function to result of another function with multiple+ -- arguments.+ --+ -- >>> (show ... (+)) 1 2+ -- "3"+ -- >>> show ... 5+ -- "5"+ -- >>> (null ... zip5) [1] [2] [3] [] [5]+ -- True+ --+ -- Inspired by <http://stackoverflow.com/questions/9656797/variadic-compose-function>. (...) :: a -> b -> c +infixl 8 ...+ instance (a ~ c, r ~ b) =>- Composition (a -> b) c r where+ SuperComposition (a -> b) c r where f ... g = f g {-# INLINE (...) #-} -instance (Composition (a -> b) d r1, r ~ (c -> r1)) =>- Composition (a -> b) (c -> d) r where+instance (SuperComposition (a -> b) d r1, r ~ (c -> r1)) =>+ SuperComposition (a -> b) (c -> d) r where (f ... g) c = f ... g c {-# INLINE (...) #-}
universum.cabal view
@@ -1,12 +1,12 @@ name: universum-version: 0.4.2+version: 0.4.3 synopsis: Custom prelude used in Serokell description: Custom prelude used in Serokell homepage: https://github.com/serokell/universum license: MIT license-file: LICENSE-author: Stephen Diehl-maintainer: hi@serokell.io+author: Stephen Diehl, @serokell+maintainer: Serokell <hi@serokell.io> copyright: 2016-2016 Stephen Diehl, 2016-2017 Serokell category: Prelude build-type: Simple