comonads-fd 3.0.3 → 4.0
raw patch · 13 files changed
+90/−354 lines, 13 filesdep −comonad-transformersdep −mtldep −semigroupsdep ~comonad
Dependencies removed: comonad-transformers, mtl, semigroups, transformers
Dependency ranges changed: comonad
Files
- .ghci +1/−0
- .gitignore +13/−0
- .vim.custom +31/−0
- CHANGELOG.markdown +17/−0
- README.markdown +17/−0
- comonads-fd.cabal +11/−30
- src/Control/Comonad/Env.hs +0/−42
- src/Control/Comonad/Env/Class.hs +0/−56
- src/Control/Comonad/Identity.hs +0/−23
- src/Control/Comonad/Store.hs +0/−33
- src/Control/Comonad/Store/Class.hs +0/−82
- src/Control/Comonad/Traced.hs +0/−33
- src/Control/Comonad/Traced/Class.hs +0/−55
+ .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,17 @@+4.0+---+* This package has been merged into `comonad` 4.0++3.0.3+-----+* Properly annotate the package with upper bounds on its dependencies++3.0.2+-----+* Marked modules appropriately `Trustworthy` as needed.++3.0.1+-----+* Removed upper bounds on dependencies on my other packages+* Added IRC build-bot notification+* Automatic tags file support
+ README.markdown view
@@ -0,0 +1,17 @@+comonads-fd+===========++[](http://travis-ci.org/ekmett/comonads-fd)++This package provides classes for accessing a standard set of comonad transformers for Haskell.++The actual comonads in question are provided by the [`comonad-transformers`](/ekmett/comonad-transformers) package.++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
comonads-fd.cabal view
@@ -1,6 +1,6 @@ name: comonads-fd category: Control, Comonads-version: 3.0.3+version: 4.0 license: BSD3 cabal-version: >= 1.6 license-file: LICENSE@@ -10,39 +10,20 @@ homepage: http://github.com/ekmett/comonads-fd/ bug-reports: http://github.com/ekmett/comonads-fd/issues copyright: Copyright (C) 2008-2013 Edward A. Kmett-synopsis: Comonad transformers using functional dependencies-description: Comonad transformers using functional dependencies+synopsis: This package has been merged into comonad 4.0+description: This package has been merged into comonad 4.0 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 location: git://github.com/ekmett/comonads-fd.git library- other-extensions:- MultiParamTypeClasses- FunctionalDependencies- FlexibleInstances- UndecidableInstances-- build-depends:- base >= 4 && < 5,- transformers >= 0.2 && < 0.4,- mtl >= 2.0 && < 2.2,- semigroups >= 0.8.3.1 && < 1,- comonad >= 3 && < 4,- comonad-transformers >= 3 && < 4-- exposed-modules:- Control.Comonad.Env- Control.Comonad.Env.Class- Control.Comonad.Identity- Control.Comonad.Store- Control.Comonad.Store.Class- Control.Comonad.Traced- Control.Comonad.Traced.Class-- ghc-options: -Wall- hs-source-dirs: src-+ build-depends: base >= 4 && < 5, comonad >= 4
− src/Control/Comonad/Env.hs
@@ -1,42 +0,0 @@-{-# LANGUAGE CPP #-}-#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE Trustworthy #-}-#endif--------------------------------------------------------------------------------- |--- Module : Control.Comonad.Env--- Copyright : (C) 2008-2011 Edward Kmett--- License : BSD-style (see the file LICENSE)------ Maintainer : Edward Kmett <ekmett@gmail.com>--- Stability : experimental--- Portability : non-portable (fundeps, MPTCs)------ The Env comonad (aka the Coreader, Environment, or Product comonad)------ A co-Kleisli arrow in the Env comonad is isomorphic to a Kleisli arrow--- in the reader monad.------ (a -> e -> m) ~ (a, e) -> m ~ Env e a -> m------------------------------------------------------------------------------module Control.Comonad.Env (- -- * ComonadEnv class- ComonadEnv(..)- , asks- , local- -- * The Env comonad- , Env- , env- , runEnv- -- * The EnvT comonad transformer- , EnvT(..)- , runEnvT- -- * Re-exported modules- , module Control.Comonad- , module Control.Comonad.Trans.Class- ) where--import Control.Comonad-import Control.Comonad.Env.Class (ComonadEnv(..), asks)-import Control.Comonad.Trans.Class-import Control.Comonad.Trans.Env (Env, env, runEnv, EnvT(..), runEnvT, local)
− src/Control/Comonad/Env/Class.hs
@@ -1,56 +0,0 @@-{-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE FunctionalDependencies #-}-{-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE UndecidableInstances #-}-{-# LANGUAGE CPP #-}-#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE Trustworthy #-}-#endif--------------------------------------------------------------------------------- |--- Module : Control.Comonad.Env.Class--- Copyright : (C) 2008-2012 Edward Kmett--- License : BSD-style (see the file LICENSE)------ Maintainer : Edward Kmett <ekmett@gmail.com>--- Stability : experimental--- Portability : non-portable (fundeps, MPTCs)------------------------------------------------------------------------------module Control.Comonad.Env.Class- ( ComonadEnv(..)- , asks- ) where--import Control.Comonad-import Control.Comonad.Trans.Class-import qualified Control.Comonad.Trans.Env as Env-import Control.Comonad.Trans.Store-import Control.Comonad.Trans.Traced-import Control.Comonad.Trans.Identity-import Data.Semigroup--class Comonad w => ComonadEnv e w | w -> e where- ask :: w a -> e--asks :: ComonadEnv e w => (e -> e') -> w a -> e'-asks f wa = f (ask wa)-{-# INLINE asks #-}--instance Comonad w => ComonadEnv e (Env.EnvT e w) where- ask = Env.ask--instance ComonadEnv e ((,)e) where- ask = fst--lowerAsk :: (ComonadEnv e w, ComonadTrans t) => t w a -> e-lowerAsk = ask . lower-{-# INLINE lowerAsk #-}--instance ComonadEnv e w => ComonadEnv e (StoreT t w) where- ask = lowerAsk--instance ComonadEnv e w => ComonadEnv e (IdentityT w) where- ask = lowerAsk--instance (ComonadEnv e w, Monoid m) => ComonadEnv e (TracedT m w) where- ask = lowerAsk
− src/Control/Comonad/Identity.hs
@@ -1,23 +0,0 @@-{-# LANGUAGE CPP #-}-#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE Trustworthy #-}-#endif--------------------------------------------------------------------------------- |--- Module : Control.Comonad.Identity--- Copyright : (C) 2008-2012 Edward Kmett--- License : BSD-style (see the file LICENSE)------ Maintainer : Edward Kmett <ekmett@gmail.com>--- Stability : experimental--- Portability : non-portable (fundeps, MPTCs)------------------------------------------------------------------------------module Control.Comonad.Identity (- module Control.Comonad- , module Data.Functor.Identity- , module Control.Comonad.Trans.Identity- ) where--import Control.Comonad-import Data.Functor.Identity-import Control.Comonad.Trans.Identity
− src/Control/Comonad/Store.hs
@@ -1,33 +0,0 @@-{-# LANGUAGE CPP #-}-#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE Trustworthy #-}-#endif--------------------------------------------------------------------------------- |--- Module : Control.Comonad.Store--- Copyright : (C) 2008-2011 Edward Kmett--- License : BSD-style (see the file LICENSE)------ Maintainer : Edward Kmett <ekmett@gmail.com>--- Stability : experimental--- Portability : non-portable (fundeps, MPTCs)------------------------------------------------------------------------------module Control.Comonad.Store (- -- * ComonadStore class- ComonadStore(..)- -- * The Store comonad- , Store- , store- , runStore- -- * The StoreT comonad transformer- , StoreT(..)- , runStoreT- -- * Re-exported modules- , module Control.Comonad- , module Control.Comonad.Trans.Class- ) where--import Control.Comonad-import Control.Comonad.Store.Class (ComonadStore(..))-import Control.Comonad.Trans.Class-import Control.Comonad.Trans.Store (Store, store, runStore, StoreT(..), runStoreT)
− src/Control/Comonad/Store/Class.hs
@@ -1,82 +0,0 @@-{-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE FunctionalDependencies #-}-{-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE UndecidableInstances #-}-{-# LANGUAGE CPP #-}-#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE Trustworthy #-}-#endif--------------------------------------------------------------------------------- |--- Module : Control.Comonad.Store.Class--- Copyright : (C) 2008-2012 Edward Kmett--- License : BSD-style (see the file LICENSE)------ Maintainer : Edward Kmett <ekmett@gmail.com>--- Stability : experimental--- Portability : non-portable (fundeps, MPTCs)------------------------------------------------------------------------------module Control.Comonad.Store.Class- ( ComonadStore(..)- , lowerPos- , lowerPeek- ) where--import Control.Comonad-import Control.Comonad.Trans.Class-import Control.Comonad.Trans.Env-import qualified Control.Comonad.Trans.Store as Store-import Control.Comonad.Trans.Traced-import Control.Comonad.Trans.Identity-import Data.Semigroup--class Comonad w => ComonadStore s w | w -> s where- pos :: w a -> s- peek :: s -> w a -> a-- peeks :: (s -> s) -> w a -> a- peeks f w = peek (f (pos w)) w-- seek :: s -> w a -> w a- seek s = peek s . duplicate-- seeks :: (s -> s) -> w a -> w a- seeks f = peeks f . duplicate-- experiment :: Functor f => (s -> f s) -> w a -> f a- experiment f w = fmap (`peek` w) (f (pos w))--instance Comonad w => ComonadStore s (Store.StoreT s w) where- pos = Store.pos- peek = Store.peek- peeks = Store.peeks- seek = Store.seek- seeks = Store.seeks- experiment = Store.experiment--lowerPos :: (ComonadTrans t, ComonadStore s w) => t w a -> s-lowerPos = pos . lower-{-# INLINE lowerPos #-}--lowerPeek :: (ComonadTrans t, ComonadStore s w) => s -> t w a -> a-lowerPeek s = peek s . lower-{-# INLINE lowerPeek #-}--lowerExperiment :: (ComonadTrans t, ComonadStore s w, Functor f) => (s -> f s) -> t w a -> f a-lowerExperiment f = experiment f . lower-{-# INLINE lowerExperiment #-}--instance ComonadStore s w => ComonadStore s (IdentityT w) where- pos = lowerPos- peek = lowerPeek- experiment = lowerExperiment--instance ComonadStore s w => ComonadStore s (EnvT e w) where- pos = lowerPos- peek = lowerPeek- experiment = lowerExperiment--instance (ComonadStore s w, Monoid m) => ComonadStore s (TracedT m w) where- pos = lowerPos- peek = lowerPeek- experiment = lowerExperiment
− src/Control/Comonad/Traced.hs
@@ -1,33 +0,0 @@-{-# LANGUAGE CPP #-}-#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE Trustworthy #-}-#endif--------------------------------------------------------------------------------- |--- Module : Control.Comonad.Traced--- Copyright : (C) 2008-2011 Edward Kmett--- License : BSD-style (see the file LICENSE)------ Maintainer : Edward Kmett <ekmett@gmail.com>--- Stability : experimental--- Portability : non-portable (fundeps, MPTCs)------------------------------------------------------------------------------module Control.Comonad.Traced (- -- * ComonadTraced class- ComonadTraced(..)- , traces- -- * The Traced comonad- , Traced- , traced- , runTraced- -- * The TracedT comonad transformer- , TracedT(..)- -- * Re-exported modules- , module Control.Comonad- , module Control.Comonad.Trans.Class- ) where--import Control.Comonad-import Control.Comonad.Traced.Class (ComonadTraced(..), traces)-import Control.Comonad.Trans.Class-import Control.Comonad.Trans.Traced (Traced, traced, runTraced, TracedT(..), runTracedT)
− src/Control/Comonad/Traced/Class.hs
@@ -1,55 +0,0 @@-{-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE FunctionalDependencies #-}-{-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE UndecidableInstances #-}-{-# LANGUAGE CPP #-}-#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE Trustworthy #-}-#endif--------------------------------------------------------------------------------- |--- Module : Control.Comonad.Traced.Class--- Copyright : (C) 2008-2012 Edward Kmett--- License : BSD-style (see the file LICENSE)------ Maintainer : Edward Kmett <ekmett@gmail.com>--- Stability : experimental--- Portability : non-portable (fundeps, MPTCs)------------------------------------------------------------------------------module Control.Comonad.Traced.Class- ( ComonadTraced(..)- , traces- ) where--import Control.Comonad-import Control.Comonad.Trans.Class-import Control.Comonad.Trans.Env-import Control.Comonad.Trans.Store-import qualified Control.Comonad.Trans.Traced as Traced-import Control.Comonad.Trans.Identity-import Data.Semigroup--class Comonad w => ComonadTraced m w | w -> m where- trace :: m -> w a -> a--traces :: ComonadTraced m w => (a -> m) -> w a -> a-traces f wa = trace (f (extract wa)) wa-{-# INLINE traces #-}--instance (Comonad w, Monoid m) => ComonadTraced m (Traced.TracedT m w) where- trace = Traced.trace--lowerTrace :: (ComonadTrans t, ComonadTraced m w) => m -> t w a -> a-lowerTrace m = trace m . lower-{-# INLINE lowerTrace #-}---- All of these require UndecidableInstances because they do not satisfy the coverage condition--instance ComonadTraced m w => ComonadTraced m (IdentityT w) where- trace = lowerTrace--instance ComonadTraced m w => ComonadTraced m (EnvT e w) where- trace = lowerTrace--instance ComonadTraced m w => ComonadTraced m (StoreT s w) where- trace = lowerTrace