packages feed

adjunctions 3.1 → 3.2

raw patch · 7 files changed

+93/−22 lines, 7 filesdep ~representable-functorsPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: representable-functors

API changes (from Hackage documentation)

- Data.Functor.Contravariant.Adjunction: corepAdjunction :: Adjunction f g => (a -> f ()) -> g a
+ Data.Functor.Contravariant.Adjunction: contrarepAdjunction :: Adjunction f g => (a -> f ()) -> g a
- Data.Functor.Contravariant.Adjunction: class (Contravariant f, Corepresentable g) => Adjunction f g | f -> g, g -> f where unit = leftAdjunct id counit = rightAdjunct id leftAdjunct f = contramap f . unit rightAdjunct f = contramap f . counit
+ Data.Functor.Contravariant.Adjunction: class (Contravariant f, Representable g) => Adjunction f g | f -> g, g -> f where unit = leftAdjunct id counit = rightAdjunct id leftAdjunct f = contramap f . unit rightAdjunct f = contramap f . counit

Files

+ .ghci view
@@ -0,0 +1,1 @@+:set -isrc -idist/build/autogen -optP-include -optPdist/build/autogen/cabal_macros.h
+ .gitignore view
@@ -0,0 +1,13 @@+dist+docs+wiki+TAGS+tags+wip+.DS_Store+.*.swp+.*.swo+*.o+*.hi+*~+*#
+ .vim.custom view
@@ -0,0 +1,31 @@+" Add the following to your .vimrc to automatically load this on startup++" if filereadable(".vim.custom")+"     so .vim.custom+" endif++function StripTrailingWhitespace()+  let myline=line(".")+  let mycolumn = col(".")+  silent %s/  *$//+  call cursor(myline, mycolumn)+endfunction++" enable syntax highlighting+syntax on++" search for the tags file anywhere between here and /+set tags=TAGS;/++" highlight tabs and trailing spaces+set listchars=tab:‗‗,trail:‗+set list++" f2 runs hasktags+map <F2> :exec ":!hasktags -x -c --ignore src"<CR><CR>++" strip trailing whitespace before saving+" au BufWritePre *.hs,*.markdown silent! cal StripTrailingWhitespace()++" rebuild hasktags after saving+au BufWritePost *.hs silent! :exec ":!hasktags -x -c --ignore src"
+ CHANGELOG.markdown view
@@ -0,0 +1,3 @@+3.2+---+* Updated to `representable-functors` 3.1, which changed the API for contravariant representable functors.
+ README.markdown view
@@ -0,0 +1,15 @@+adjunctions+==========++[![Build Status](https://secure.travis-ci.org/ekmett/adjunctions.png?branch=master)](http://travis-ci.org/ekmett/adjunctions)++This package provides adjunctions for Haskell.++Contact Information+-------------------++Contributions and bug reports are welcome!++Please feel free to contact me through github or on the #haskell IRC channel on irc.freenode.net.++-Edward Kmett
adjunctions.cabal view
@@ -1,6 +1,6 @@ name:          adjunctions category:      Data Structures, Adjunctions-version:       3.1+version:       3.2 license:       BSD3 cabal-version: >= 1.6 license-file:  LICENSE@@ -13,7 +13,13 @@ synopsis:      Adjunctions description:   Adjunctions build-type:    Simple-extra-source-files: .travis.yml+extra-source-files:+  .ghci+  .gitignore+  .travis.yml+  .vim.custom+  CHANGELOG.markdown+  README.markdown  source-repository head   type: git@@ -43,7 +49,7 @@     void                   >= 0.5.5.1 && < 1,     keys                   >= 3       && < 4,     comonad-transformers   >= 3       && < 4,-    representable-functors >= 3.0.0.1 && < 4,+    representable-functors >= 3.1     && < 4,     free                   >= 3       && < 4    exposed-modules:
src/Data/Functor/Contravariant/Adjunction.hs view
@@ -1,48 +1,50 @@ {-# LANGUAGE Rank2Types, MultiParamTypeClasses, FunctionalDependencies, UndecidableInstances #-}-module Data.Functor.Contravariant.Adjunction +module Data.Functor.Contravariant.Adjunction   ( Adjunction(..)-  , corepAdjunction+  , contrarepAdjunction   , coindexAdjunction   ) where  import Control.Monad.Instances () import Data.Functor.Contravariant-import Data.Functor.Corepresentable+import Data.Functor.Contravariant.Representable --- | An adjunction from Hask^op to Hask--- --- > Op (f a) b ~ Hask a (g b)+-- | An adjunction from @Hask^op@ to @Hask@ ----- > rightAdjunct unit = id--- > leftAdjunct counit = id+-- @'Op' (f a) b ~ 'Hask' a (g b)@ ----- Any adjunction from Hask to Hask^op would indirectly--- permit unsafePerformIO, and therefore does not exist.+-- @+-- 'rightAdjunct' 'unit' = 'id'+-- 'leftAdjunct' 'counit' = 'id'+-- @+--+-- Any adjunction from @Hask@ to @Hask^op@ would indirectly+-- permit @unsafePerformIO@, and therefore does not exist. -class (Contravariant f, Corepresentable g) => Adjunction f g | f -> g, g -> f where+class (Contravariant f, Representable g) => Adjunction f g | f -> g, g -> f where   unit :: a -> g (f a) -- monad in Hask   counit :: a -> f (g a) -- comonad in Hask^op-  leftAdjunct  :: (b -> f a) -> a -> g b +  leftAdjunct  :: (b -> f a) -> a -> g b   rightAdjunct :: (a -> g b) -> b -> f a -  unit = leftAdjunct id +  unit = leftAdjunct id   counit = rightAdjunct id-  leftAdjunct f = contramap f . unit +  leftAdjunct f = contramap f . unit   rightAdjunct f = contramap f . counit --- | This adjunction gives rise to the Cont monad+-- | This 'Adjunction' gives rise to the @Cont@ 'Monad' instance Adjunction (Op r) (Op r) where   unit a = Op (\k -> getOp k a)   counit = unit --- | This gives rise to the Cont Bool monad+-- | This gives rise to the @Cont Bool@ 'Monad' instance Adjunction Predicate Predicate where   unit a = Predicate (\k -> getPredicate k a)   counit = unit --- | Represent a contravariant functor that has a left adjoint-corepAdjunction :: Adjunction f g => (a -> f ()) -> g a-corepAdjunction = flip leftAdjunct () +-- | Represent a 'Contravariant' functor that has a left adjoint+contrarepAdjunction :: Adjunction f g => (a -> f ()) -> g a+contrarepAdjunction = flip leftAdjunct ()  coindexAdjunction :: Adjunction f g => g a -> a -> f () coindexAdjunction = rightAdjunct . const