packages feed

lens-action 0.1.0.1 → 0.2.6

raw patch · 9 files changed

Files

.gitignore view
@@ -1,4 +1,5 @@ dist/+dist-newstyle/ .hsenv/ docs wiki@@ -15,3 +16,19 @@ .cabal-sandbox/ cabal.sandbox.config codex.tags+.stack-work/+cabal-dev+*.chi+*.chs.h+*.dyn_o+*.dyn_hi+.hpc+.hsenv+*.prof+*.aux+*.hp+*.eventlog+cabal.project.local+cabal.project.local~+.HTF/+.ghc.environment.*
CHANGELOG.markdown view
@@ -1,3 +1,50 @@+0.2.6 [2021.11.16]+------------------+* Drop support for pre-8.0 versions of GHC.++0.2.5 [2021.02.17]+------------------+* Allow building with `lens-5.*`.+* The build-type has been changed from `Custom` to `Simple`.+  To achieve this, the `doctests` test suite has been removed in favor of using+  [`cabal-docspec`](https://github.com/phadej/cabal-extras/tree/master/cabal-docspec)+  to run the doctests.++0.2.4 [2019.09.13]+------------------+* Remove the use of `cpp-options: -traditional`. This should be unnecessary+  on all versions of GHC that `lens` supports, as modern GHCs already use+  `-traditional` internally during preprocessing. More critically, the use+  of `cpp-options: -traditional` breaks profiling builds on GHC 8.8+  (see https://gitlab.haskell.org/ghc/ghc/issues/17185).++0.2.3 [2018.01.18]+------------------+* Add an `Apply` context to the `Monoid` instance for `Effect`, allowing+  `lens-action` to build against `lens-4.16`.++0.2.2+-----+* Add a library dependency for the `doctests` test suite++0.2.1+-----+* Revamp `Setup.hs` to use `cabal-doctest`. This makes it build+  with `Cabal-2.0`, and makes the `doctest`s work with `cabal new-build` and+  sandboxes.++0.2.0.2+---+* Migrate to new `phantom` definition in `contravariant`++0.2.0.1+---+* Add `Control.Lens.Action.Type` to exposed-modules list.++0.2+---+* `profunctors-5` and `lens-4.10` support+ 0.1.0.1 --- * Add `Control.Lens.Action.Type` to exposed-modules list.
+ README.markdown view
@@ -0,0 +1,15 @@+lens-action+===========++[![Hackage](https://img.shields.io/hackage/v/lens-action.svg)](https://hackage.haskell.org/package/lens-action) [![Build Status](https://github.com/ekmett/lens-action/workflows/Haskell-CI/badge.svg)](https://github.com/ekmett/lens-action/actions?query=workflow%3AHaskell-CI)++This package contains combinators and types for working with monadic getters and folds as split off from the original `lens` 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
Setup.lhs view
@@ -1,45 +1,7 @@ #!/usr/bin/runhaskell-\begin{code}-{-# OPTIONS_GHC -Wall #-}-module Main (main) where--import Data.List ( nub )-import Data.Version ( showVersion )-import Distribution.Package ( PackageName(PackageName), Package, PackageId, InstalledPackageId, packageVersion, packageName )-import Distribution.PackageDescription ( PackageDescription(), TestSuite(..) )-import Distribution.Simple ( defaultMainWithHooks, UserHooks(..), simpleUserHooks )-import Distribution.Simple.Utils ( rewriteFile, createDirectoryIfMissingVerbose, copyFiles )-import Distribution.Simple.BuildPaths ( autogenModulesDir )-import Distribution.Simple.Setup ( BuildFlags(buildVerbosity), Flag(..), fromFlag, HaddockFlags(haddockDistPref))-import Distribution.Simple.LocalBuildInfo ( withLibLBI, withTestLBI, LocalBuildInfo(), ComponentLocalBuildInfo(componentPackageDeps) )-import Distribution.Text ( display )-import Distribution.Verbosity ( Verbosity, normal )-import System.FilePath ( (</>) )--main :: IO ()-main = defaultMainWithHooks simpleUserHooks-  { buildHook = \pkg lbi hooks flags -> do-     generateBuildModule (fromFlag (buildVerbosity flags)) pkg lbi-     buildHook simpleUserHooks pkg lbi hooks flags-  }--generateBuildModule :: Verbosity -> PackageDescription -> LocalBuildInfo -> IO ()-generateBuildModule verbosity pkg lbi = do-  let dir = autogenModulesDir lbi-  createDirectoryIfMissingVerbose verbosity True dir-  withLibLBI pkg lbi $ \_ libcfg -> do-    withTestLBI pkg lbi $ \suite suitecfg -> do-      rewriteFile (dir </> "Build_" ++ testName suite ++ ".hs") $ unlines-        [ "module Build_" ++ testName suite ++ " where"-        , "deps :: [String]"-        , "deps = " ++ (show $ formatdeps (testDeps libcfg suitecfg))-        ]-  where-    formatdeps = map (formatone . snd)-    formatone p = case packageName p of-      PackageName n -> n ++ "-" ++ showVersion (packageVersion p)+> module Main (main) where -testDeps :: ComponentLocalBuildInfo -> ComponentLocalBuildInfo -> [(InstalledPackageId, PackageId)]-testDeps xs ys = nub $ componentPackageDeps xs ++ componentPackageDeps ys+> import Distribution.Simple -\end{code}+> main :: IO ()+> main = defaultMain
lens-action.cabal view
@@ -1,8 +1,8 @@ name:          lens-action category:      Data, Lenses, Generics-version:       0.1.0.1+version:       0.2.6 license:       BSD3-cabal-version: >= 1.8+cabal-version: >= 1.10 license-file:  LICENSE author:        Edward A. Kmett maintainer:    Edward A. Kmett <ekmett@gmail.com>@@ -10,9 +10,16 @@ homepage:      http://github.com/ekmett/lens-action/ bug-reports:   http://github.com/ekmett/lens-action/issues copyright:     Copyright (C) 2012-2014 Edward A. Kmett-build-type:    Custom+build-type:    Simple -- build-tools:   cpphs-tested-with:   GHC == 7.8.3+tested-with:   GHC == 8.0.2+             , GHC == 8.2.2+             , GHC == 8.4.4+             , GHC == 8.6.5+             , GHC == 8.8.4+             , GHC == 8.10.7+             , GHC == 9.0.1+             , GHC == 9.2.1 synopsis:      Monadic Getters and Folds description:   This package contains combinators and types for working with@@ -23,27 +30,22 @@   .ghci   .gitignore   CHANGELOG.markdown+  README.markdown  source-repository head   type: git   location: git://github.com/ekmett/lens-action.git --- You can disable the doctests test suite with -f-test-doctests-flag test-doctests-  default: True-  manual: True- library   build-depends:-    lens                      >= 4.7      && < 5,-    base                      >= 4.5      && < 5,-    comonad                   >= 4        && < 5,-    contravariant             >= 0.3      && < 2,-    profunctors               >= 4        && < 5,+    lens                      >= 4.7      && < 6,+    base                      >= 4.9      && < 5,+    comonad                   >= 4        && < 6,+    contravariant             >= 1.2.1    && < 2,+    profunctors               >= 5        && < 6,     mtl                       >= 2.0.1    && < 2.3,-    semigroups                >= 0.8.4    && < 1,-    semigroupoids             >= 4        && < 5,-    transformers              >= 0.2      && < 0.5+    semigroupoids             >= 4        && < 6,+    transformers              >= 0.2      && < 0.6    exposed-modules:     Control.Lens.Action@@ -51,26 +53,6 @@     Control.Lens.Action.Reified     Control.Lens.Action.Type -  cpp-options: -traditional--  ghc-options: -Wall -fwarn-tabs -O2 -fdicts-cheap -funbox-strict-fields -fmax-simplifier-iterations=10+  ghc-options: -Wall -Wtabs -O2 -fdicts-cheap -funbox-strict-fields -fmax-simplifier-iterations=10   hs-source-dirs: src---- Verify the results of the examples-test-suite doctests-  type:           exitcode-stdio-1.0-  main-is:        doctests.hs-  ghc-options:    -Wall -threaded-  hs-source-dirs: tests--  if !flag(test-doctests)-    buildable: False-  else-    build-depends:-      base,-      doctest        >= 0.9.1,-      filepath,-      directory--  if impl(ghc<7.6.1)-    ghc-options: -Werror+  default-language: Haskell2010
src/Control/Lens/Action.hs view
@@ -55,6 +55,7 @@ import Control.Monad.Trans.Class import Data.Profunctor import Data.Profunctor.Rep+import Data.Profunctor.Sieve import Data.Profunctor.Unsafe  import Control.Lens.Action.Internal@@ -135,7 +136,7 @@ act :: Monad m => (s -> m a) -> IndexPreservingAction m s a act sma pafb = cotabulate $ \ws -> effective $ do    a <- sma (extract ws)-   ineffective (corep pafb (a <$ ws))+   ineffective (cosieve pafb (a <$ ws)) {-# INLINE act #-}  -- | A self-running 'Action', analogous to 'Control.Monad.join'.
src/Control/Lens/Action/Internal.hs view
@@ -97,11 +97,13 @@   Effect ma <> Effect mb = Effect (liftF2 (<>) ma mb)   {-# INLINE (<>) #-} -instance (Monad m, Monoid r) => Monoid (Effect m r a) where+instance (Apply m, Monad m, Monoid r) => Monoid (Effect m r a) where   mempty = Effect (return mempty)   {-# INLINE mempty #-}+#if !(MIN_VERSION_base(4,11,0))   Effect ma `mappend` Effect mb = Effect (liftM2 mappend ma mb)   {-# INLINE mappend #-}+#endif  instance (Apply m, Semigroup r) => Apply (Effect m r) where   Effect ma <.> Effect mb = Effect (liftF2 (<>) ma mb)
src/Control/Lens/Action/Reified.hs view
@@ -23,10 +23,13 @@ import Control.Lens hiding ((<.>)) import Control.Monad import Control.Monad.Reader.Class+import Data.Functor.Contravariant import Data.Functor.Bind import Data.Functor.Plus import Data.Profunctor+#if !(MIN_VERSION_base(4,11,0)) import Data.Semigroup+#endif  import Control.Lens.Action @@ -48,10 +51,10 @@  instance Strong (ReifiedMonadicFold m) where   first' l = MonadicFold $ \f (s,c) ->-    coerce $ runMonadicFold l (dimap (flip (,) c) coerce f) s+    phantom $ runMonadicFold l (dimap (flip (,) c) phantom f) s   {-# INLINE first' #-}   second' l = MonadicFold $ \f (c,s) ->-    coerce $ runMonadicFold l (dimap ((,) c) coerce f) s+    phantom $ runMonadicFold l (dimap ((,) c) phantom f) s   {-# INLINE second' #-}  instance Choice (ReifiedMonadicFold m) where@@ -107,19 +110,21 @@   {-# INLINE (<|>) #-}  instance Bind (ReifiedMonadicFold m s) where-  ma >>- f = ((ma >>^ f) &&& returnA) >>> app +  ma >>- f = ((ma >>^ f) &&& returnA) >>> app   {-# INLINE (>>-) #-}  instance Monad (ReifiedMonadicFold m s) where+#if !(MIN_VERSION_base(4,11,0))   return a = MonadicFold $ folding $ \_ -> [a]   {-# INLINE return #-}-  ma >>= f = ((ma >>^ f) &&& returnA) >>> app +#endif+  ma >>= f = ((ma >>^ f) &&& returnA) >>> app   {-# INLINE (>>=) #-}  instance MonadReader s (ReifiedMonadicFold m s) where   ask = returnA   {-# INLINE ask #-}-  local f ma = f ^>> ma +  local f ma = f ^>> ma   {-# INLINE local #-}  instance MonadPlus (ReifiedMonadicFold m s) where@@ -135,8 +140,10 @@ instance Monoid (ReifiedMonadicFold m s a) where   mempty = MonadicFold ignored   {-# INLINE mempty #-}+#if !(MIN_VERSION_base(4,11,0))   mappend = (<|>)   {-# INLINE mappend #-}+#endif  instance Alt (ReifiedMonadicFold m s) where   (<!>) = (<|>)
− tests/doctests.hsc
@@ -1,73 +0,0 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE ForeignFunctionInterface #-}--------------------------------------------------------------------------------- |--- Module      :  Main (doctests)--- Copyright   :  (C) 2012-14 Edward Kmett--- License     :  BSD-style (see the file LICENSE)--- Maintainer  :  Edward Kmett <ekmett@gmail.com>--- Stability   :  provisional--- Portability :  portable------ This module provides doctests for a project based on the actual versions--- of the packages it was built with. It requires a corresponding Setup.lhs--- to be added to the project-------------------------------------------------------------------------------module Main where--import Build_doctests (deps)-import Control.Applicative-import Control.Monad-import Data.List-import System.Directory-import System.FilePath-import Test.DocTest--##if defined(mingw32_HOST_OS)-##if defined(i386_HOST_ARCH)-##define USE_CP-import Control.Applicative-import Control.Exception-import Foreign.C.Types-foreign import stdcall "windows.h SetConsoleCP" c_SetConsoleCP :: CUInt -> IO Bool-foreign import stdcall "windows.h GetConsoleCP" c_GetConsoleCP :: IO CUInt-##elif defined(x86_64_HOST_ARCH)-##define USE_CP-import Control.Applicative-import Control.Exception-import Foreign.C.Types-foreign import ccall "windows.h SetConsoleCP" c_SetConsoleCP :: CUInt -> IO Bool-foreign import ccall "windows.h GetConsoleCP" c_GetConsoleCP :: IO CUInt-##endif-##endif---- | Run in a modified codepage where we can print UTF-8 values on Windows.-withUnicode :: IO a -> IO a-##ifdef USE_CP-withUnicode m = do-  cp <- c_GetConsoleCP-  (c_SetConsoleCP 65001 >> m) `finally` c_SetConsoleCP cp-##else-withUnicode m = m-##endif--main :: IO ()-main = withUnicode $ getSources >>= \sources -> doctest $-    "-isrc"-  : "-idist/build/autogen"-  : "-optP-include"-  : "-optPdist/build/autogen/cabal_macros.h"-  : "-hide-all-packages"-  : map ("-package="++) deps ++ sources--getSources :: IO [FilePath]-getSources = filter (isSuffixOf ".hs") <$> go "src"-  where-    go dir = do-      (dirs, files) <- getFilesAndDirectories dir-      (files ++) . concat <$> mapM go dirs--getFilesAndDirectories :: FilePath -> IO ([FilePath], [FilePath])-getFilesAndDirectories dir = do-  c <- map (dir </>) . filter (`notElem` ["..", "."]) <$> getDirectoryContents dir-  (,) <$> filterM doesDirectoryExist c <*> filterM doesFileExist c