packages feed

rank2classes 0.2 → 0.2.1.1

raw patch · 3 files changed

+31/−15 lines, 3 filesdep ~template-haskell

Dependency ranges changed: template-haskell

Files

README.md view
@@ -29,8 +29,9 @@   * [Rank2.Traversable](http://hackage.haskell.org/packages/archive/doc/html/Rank2.html#t:Traversable)   * [Rank2.Distributive](http://hackage.haskell.org/packages/archive/doc/html/Rank2.html#t:Distributive) -The methods of these type classes all have rank-2 types. The class instances are data types of kind `(* -> *) -> *`, one-example of which would be a database record with different field types but all wrapped by the same type constructor:+The methods of these type classes all have rank-2 types. The class instances are data types of kind `(k -> *) -> *`,+one example of which would be a database record with different field types but all wrapped by the same type+constructor:  ~~~ {.haskell} data Person f = Person{@@ -60,11 +61,12 @@  ~~~ {.haskell} instance Show1 f => Show (Person f) where-   showsPrec prec person rest = "Person{" ++ separator ++ "name=" ++ showsPrec1 prec' (name person)-                                     ("," ++ separator ++ "age=" ++ showsPrec1 prec' (age person)-                                     ("," ++ separator ++ "mother=" ++ showsPrec1 prec' (mother person)-                                     ("," ++ separator ++ "father=" ++ showsPrec1 prec' (father person)-                                     ("}" ++ rest))))+   showsPrec prec person rest =+       "Person{" ++ separator ++ "name=" ++ showsPrec1 prec' (name person)+            ("," ++ separator ++ "age=" ++ showsPrec1 prec' (age person)+            ("," ++ separator ++ "mother=" ++ showsPrec1 prec' (mother person)+            ("," ++ separator ++ "father=" ++ showsPrec1 prec' (father person)+            ("}" ++ rest))))         where prec' = succ prec               separator = "\n" ++ replicate prec' ' ' ~~~@@ -146,9 +148,18 @@  ~~~ {.haskell} -- |--- >>> let Right alice = completeVerified $ verify [] Person{name= Const "Alice", age= Const "44", mother= Const "", father= Const ""}--- >>> let Right bob = completeVerified $ verify [] Person{name= Const "Bob", age= Const "45", mother= Const "", father= Const ""}--- >>> let Right charlie = completeVerified $ verify [alice, bob] Person{name= Const "Charlie", age= Const "19", mother= Const "Alice", father= Const "Bob"}+-- >>> :{+--let Right alice = completeVerified $+--                  verify [] Person{name= Const "Alice", age= Const "44",+--                                   mother= Const "", father= Const ""}+--    Right bob = completeVerified $+--                verify [] Person{name= Const "Bob", age= Const "45",+--                                 mother= Const "", father= Const ""}+--    Right charlie = completeVerified $+--                    verify [alice, bob] Person{name= Const "Charlie", age= Const "19",+--                                               mother= Const "Alice", father= Const "Bob"}+-- :}+--  -- >>> charlie -- Person{ --  name=Identity "Charlie",@@ -163,10 +174,15 @@ --             age=(Identity 45), --             mother=(Identity Nothing), --             father=(Identity Nothing)})}--- >>> let dave = verify [alice, bob, charlie] Person{name= Const "Eve", age= Const "young", mother= Const "Lise", father= Const "Mike"}+-- >>> :{+--let dave = verify [alice, bob, charlie]+--           Person{name= Const "Dave", age= Const "young",+--                  mother= Const "Lise", father= Const "Mike"}+-- :}+-- -- >>> dave -- Person{---  name=Right "Eve",+--  name=Right "Dave", --  age=Left "young is not an integer", --  mother=Left "Nobody by name of Lise", --  father=Left "Nobody by name of Mike"}
rank2classes.cabal view
@@ -1,5 +1,5 @@ name:                rank2classes-version:             0.2+version:             0.2.1.1 synopsis:            a mirror image of some standard type classes, with methods of rank 2 types description:   A mirror image of the standard constructor type class hierarchy rooted in 'Functor', except with methods of rank 2@@ -29,7 +29,7 @@   -- other-modules:   ghc-options:         -Wall   build-depends:       base >=4.7 && <5,-                       template-haskell >= 2.11 && < 2.12,+                       template-haskell >= 2.11 && < 2.13,                        transformers >= 0.5 && < 0.6   -- hs-source-dirs:         default-language:    Haskell2010
src/Rank2.hs view
@@ -13,7 +13,7 @@ -- * Rank 2 data types    Compose(..), Empty(..), Only(..), Identity(..), Product(..), Arrow(..), -- * Method synonyms and helper functions-   ap, fmap, liftA3, liftA4, liftA5,+   ap, fmap, liftA4, liftA5,    fmapTraverse, liftA2Traverse1, liftA2Traverse2, liftA2TraverseBoth,    cotraverse, cotraverseTraversable) where