packages feed

TypeCompose 0.8.0 → 0.8.3

raw patch · 8 files changed

+19/−159 lines, 8 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ Control.Compose: (~>*) :: Functor f => (a' -> a) -> (b -> b') -> (f a -> f b) -> (f a' -> f b')
- Control.Compose: (~>) :: (a' -> a) -> (b -> b') -> ((a -> b) -> (a' -> b'))
+ Control.Compose: (~>) :: Category --> => (a' --> a) -> (b --> b') -> ((a --> b) -> (a' --> b'))

Files

− CHANGES
@@ -1,74 +0,0 @@-% TypeCompose changes--== Version 0.5.1 ==--* Tweaked to work with ghc before and after 6.9--== Version 0.5 ==--* Backed out DistribM.  Now that I've read "Composing Monads", I know-  there's more to it.  At least four different ways, all with conflicting-  Monad instances.--== Version 0.4 ==--* pairEdit, pairEditM in Data.Pair-* build-type simple-* doc tweek DistribM & joinMM-* DistribM export & comment tweak-* DistribM and (m :. n) Monad-* Functor/Functor & Applicative/Applicative tweak-* inId2.  Functor & Applicative instances for Id-* removed r->m dep in RefMonad-* doc tweak--== Version 0.3 ==--* Simplified Applicative instance for g :. f-* Renamed type constructors "O" and "App" to "(:.)" and "(:$)".  Also-  include old names for compatibility.-* Replaced the 6.6-compatible OPTIONS pragmas with LANGUAGE-* Pair & Copair for Const-* Changed functional dependency for RefMonad--## Version 0.2 ##--+  More comments-+  Added [Data.Partial](src/Data/Partial.hs): partial values.-+  [Data.Bijection](src/Data/Bijection.hs): bijective arrows.  Used in-   [Control.Compose] for composing representation transformations.-+  Using `LANGUAGE` instead of `OPTIONS` pragmas-+  [Data.Pair](src/Data/Pair.hs) & [Data.Fun](src/Data/Fun.hs).  Classes of-   pair-like and function-like types.-+  [Data.RefMonad](src/Data/RefMonad.hs)-+  Renamed StaticArrow/Static to OO/OO-+  Now in{O,Flip,Prod,Arrw,Const}{,2,3} (i.e., `inO2` etc)-+  `Sink` type alias and `Monoid` instance.-+  `Monoid_f` and `O` instance.-+  `Arrw` type class with `Functor` & `Cofunctor` instances.-+  [Data.Title](src/Data/Title.hs): a titling class for type constructors.-   Doesn't really belong here.-+  Eliminated dependency on "mtl" package by removing a standard-   applicative instance for `ReaderT`.-+  [Data.CxMonoid](src/Data/CxMonoid.hs): context-dependent monoid-+  Type constructors `:*:`, `::*::`, & `:~>:`-+  `FunA` and `FunAble`, for convenient `Arrow` definitions.  See also `FunD` &-   `FunDble` in [DeepArrow].--## Version 0.1 ##--+  Renamed "Compose/Comp/unComp" to "O/O/unO".-+  Renamed "onComp" to "inO"-+  Renamed "mapSrc" to "mapCur", and renamed type parameter "src" to "cur",-   to avoid confusion with "Source" in Phooey's use of DataDriven.-+  Swapped argument order to dd in DataDriven.-+  Renamed "Updater" to "Action"-+  Changed the Monoid (IO a) instance in Control.Instances to use "liftA2-   mappend" instead of "(*>)".-+  Added unFlip, inFlip, inFlip2---[TypeCompose]:     http://haskell.org/haskellwiki/TypeCompose-[DeepArrow]:       http://haskell.org/haskellwiki/DeepArrow--[Control.Compose]: src/Control.Compose.hs
− Makefile
@@ -1,1 +0,0 @@-include ../cho-home-cabal-make.inc
− README
@@ -1,17 +0,0 @@-% TypeCompose--TypeCompose provides some classes & instances for forms of type-composition, as well as some modules that haven't found another home.  The-[wiki page] contains a description and links to documentation.--Please share any comments & suggestions on the [talk page] there.--You can configure, build, and install all in the usual way with Cabal-commands.--    runhaskell Setup.lhs configure-    runhaskell Setup.lhs build-    runhaskell Setup.lhs install--[wiki page]: http://haskell.org/haskellwiki/TypeCompose-[talk page]: http://haskell.org/haskellwiki/Talk:TypeCompose
− TODO
TypeCompose.cabal view
@@ -1,5 +1,5 @@ Name:                TypeCompose-Version:             0.8.0+Version:             0.8.3 Synopsis: 	     Type composition classes & instances Category:            Composition, Control Description:@@ -13,7 +13,7 @@ Maintainer:          conal@conal.net Homepage:            http://haskell.org/haskellwiki/TypeCompose Package-Url:	     http://code.haskell.org/~conal/code/TypeCompose-Copyright:           (c) 2007-2010 by Conal Elliott+Copyright:           (c) 2007-2011 by Conal Elliott License:             BSD3 Stability:           provisional build-type:	     Simple
src/Control/Compose.hs view
@@ -6,7 +6,7 @@ -- For ghc 6.6 compatibility -- {-# OPTIONS -fglasgow-exts -fallow-undecidable-instances #-} -{-# OPTIONS_GHC -fno-warn-orphans #-}+{-# OPTIONS_GHC -Wall -fno-warn-orphans #-}  ---------------------------------------------------------------------- -- |@@ -29,7 +29,7 @@   -- * Value transformers     Unop, Binop   -- * Specialized semantic editor combinators-  , result, argument, (~>)+  , result, argument, (~>), (~>*)   -- * Contravariant functors   , Cofunctor(..), bicomap   -- * Unary\/unary composition@@ -117,19 +117,21 @@ result :: (b -> b') -> ((a -> b) -> (a -> b')) result = (.) -infixr 1 ~>--- | Add pre- and post processing-(~>) :: (a' -> a) -> (b -> b') -> ((a -> b) -> (a' -> b'))--- (f ~> h) g = h . g . f-f ~> h = result h . argument f+infixr 1 ~>, ~>* --- More generally,--- --- (~>) :: Category (-->) => (a' --> a) -> (b --> b') -> ((a --> b) -> (a' --> b'))+-- | Add pre- and post processing+(~>) :: Category (-->) =>+        (a' --> a) -> (b --> b') -> ((a --> b) -> (a' --> b'))+(f ~> h) g = h . g . f+-- f ~> h = result h . argument f  -- If I add argument back to DeepArrow, we can get a different generalization: --  -- (~>) :: DeepArrow (-->) => (a' --> a) -> (b --> b') -> ((a -> b) --> (a' -> b'))++-- | Like '(~>)' but specialized to functors+(~>*) :: Functor f => (a' -> a) -> (b -> b') -> (f a -> f b) -> (f a' -> f b')+f ~>* g = fmap f ~> fmap g   {----------------------------------------------------------
src/Data/Bijection.hs view
@@ -79,6 +79,11 @@        -> (a ~> c) :<->: (b ~> d) Bi ab ba ---> Bi cd dc = Bi (\ ac -> ba>>>ac>>>cd) (\ bd -> ab>>>bd>>>dc) +-- TODO: Rewrite (--->) via (~>).  Currently would cause a module cycle+-- +-- Bi ab ba ---> Bi cd dc = Bi (ac ~> cd) (ab ~> dc)++ -- | Apply a function in an alternative (monomorphic) representation. inBi :: Arrow (~>) => Bijection (~>) a b -> (a ~> a) -> (b ~> b) inBi (Bi to from) aa = from >>> aa >>> to
− wikipage.tw
@@ -1,55 +0,0 @@-[[Category:Composition]]-[[Category:Applicative]]-[[Category:Libraries]]-[[Category:Packages]]-[[Category:Type-level programming]]--== Abstract ==--'''TypeCompose''' provides some classes & instances for forms of type composition, as well as some modules that haven't found another home.--Besides this wiki page, here are more ways to find out about TypeCompose:-* Visit the [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/TypeCompose Hackage page] for library documentation and to download & install.-* Or install with <tt>cabal install TypeCompose</tt>.-* Get the code repository: <tt>darcs get http://darcs.haskell.org/packages/TypeCompose</tt>.-<!--* See the [[TypeCompose/Versions| version history]].-->--== Type composition ==--The <hask>Control.Compose</hask> module includes-* Various type compositions (unary/unary, binary/unary, etc).  Most are from [http://www.soi.city.ac.uk/~ross/papers/Applicative.html Applicative Programming with Effects].  In particular, <hask>g `O` f</hask> composes functors in to functors and applicative functors (AFs) into AFs.  (In contrast, monads do not in general compose.)  Composition makes AF-based programming simple and elegant, partly because we don't need an AF counterpart to monad transformers.-* Cofunctors (contravariant functors).  Great for "consumer" types, just as functors suit "producer" (container) types.  There are several composition options.-* Type argument flip.  Handy for cofunctors: use <hask>Flip (->) o</hask>, for <hask>(-> o)</hask>.-* Constructor in pairs: <hask>(f a, g a)</hask>.-* Constructor in arrows/functions: <hask>f a ~> g a</hask>.--== Other features ==--=== Composable bijections ===--Given all the type constructors and compositions of them, I found myself writing some pretty awkward code to wrap & unwrap through multiple layers.  Composable bijections help a lot.--The <hask>Data.Bijection</hask> module is inspired by [http://citeseer.ist.psu.edu/alimarine05there.html There and Back Again: Arrows for Invertible Programming], though done here in a less general setting.--=== Pair- & function-like types ===--The <hask>Data.Zip</hask> and <hask>Data.Lambda</hask> patterns emerged while working on [[DeepArrow]] and [[Eros]].  <hask>Data.Zip</hask> generalizes <hask>zip</hask> and <hask>unzip</hask>  from <hask>[]</hask> to other functors.  It also provides variants of type <hask>f a -> f (a,b)</hask> and <hask>f a -> f (a,b)</hask>.  <hask>Data.Lambda</hask> is similar with classes for lambda-like constructions.--For example uses of <hask>Pair</hask> and <hask>Lambda</hask>, see [[TV]] and [[Eros]].--=== References ===--Monads with references.  Direct rip-off from [http://citeseer.ist.psu.edu/473734.html Global Variables in Haskell].--=== Titling ===--For giving titles to things.  I know it sounds kind of random.  More useful than I first thought.  Used in [[Phooey]], [[TV]], and [[Eros]].--=== Partial values ===--A monoid of partial values.  See the [http://conal.net/blog/posts/a-type-for-partial-values/ teaser] and [http://conal.net/blog/posts/implementing-a-type-for-partial-values/ solution] blog-posts.--=== Context-dependent monoids ===--Bit of an oddball also.  <hask>Data.CxMonoid</hask> defines a sort of meta-monoid, that can be supplied dynamically with choices of <hask>mempty</hask> and <hask>mappend</hask>.  Used in [[Phooey]] (starting with version 1.3) so that layout could be a monoid but still vary in style.