packages feed

patch 0.0.3.1 → 0.0.3.2

raw patch · 8 files changed

+37/−24 lines, 8 filesdep ~basedep ~dependent-mapdep ~dependent-sumnew-uploader

Dependency ranges changed: base, dependent-map, dependent-sum, hlint, these, witherable

Files

ChangeLog.md view
@@ -1,5 +1,9 @@ # Revision history for patch +## 0.0.3.2++* Update version bounds+ ## 0.0.3.1  * Replace `fromJust` with something easier to debug.
README.md view
@@ -1,9 +1,11 @@-## Patch+# patch -Infrastructure for writing patches which act on other types.+[![Haskell](https://img.shields.io/badge/language-Haskell-orange.svg)](https://haskell.org) [![Hackage](https://img.shields.io/hackage/v/patch.svg)](https://hackage.haskell.org/package/patch) [![Hackage CI](https://matrix.hackage.haskell.org/api/v2/packages/patch/badge)](https://matrix.hackage.haskell.org/#/package/patch) [![Travis CI](https://api.travis-ci.org/reflex-frp/patch.svg?branch=develop)](https://travis-ci.org/reflex-frp/patch) [![BSD3 License](https://img.shields.io/badge/license-BSD3-blue.svg)](https://github.com/reflex-frp/patch/LICENSE) -A `Patch` type represents a kind of change made to a datastructure.+Data structures for describing changes to other data structures. +A `Patch` type represents a kind of change made to a data structure.+ ```haskell class Patch p where   type PatchTarget p :: *@@ -12,7 +14,7 @@   apply :: p -> PatchTarget p -> Maybe (PatchTarget p) ``` -### Patching Maps+## Patching Maps For example, `Data.Patch.Map` defines the `PatchMap` type which can be used to patch `Map`s. A `PatchMap` represents updates to a `Map` that can insert, remove, or replace items in the `Map`. In this example, the `Map` is the `PatchTarget` and the `PatchMap` is the `Patch`. Keep in mind that there are many other possible `Patch`es that can be applied to a `Map` (i.e., `Map` can be the `PatchTarget` for many different `Patch` instances).  `PatchMap` is defined as:
patch.cabal view
@@ -1,7 +1,9 @@ Name: patch-Version: 0.0.3.1-Synopsis: Infrastructure for writing patches which act on other types.+Version: 0.0.3.2+Synopsis: Data structures for describing changes to other data structures. Description:+  Data structures for describing changes to other data structures.+  .   In this library, a patch is something which can be applied, analogous to a   function, and which distinguishes returning the argument it was provided from   returning something else.@@ -12,7 +14,7 @@ Stability: Experimental Category: FRP Build-type: Simple-Cabal-version: >=1.9.2+Cabal-version: >=1.10 homepage: https://obsidian.systems bug-reports: https://github.com/reflex-frp/patch/issues extra-source-files:@@ -20,7 +22,7 @@   ChangeLog.md  tested-with:-  GHC  ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.1+  GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.1   GHCJS ==8.4  flag split-these@@ -30,15 +32,16 @@  library   hs-source-dirs: src+  default-language: Haskell2010   build-depends: base >= 4.9 && < 4.14                , constraints-extras >= 0.3 && < 0.4                , containers >= 0.6 && < 0.7-               , dependent-map >= 0.3 && < 0.4-               , dependent-sum >= 0.6 && < 0.7+               , dependent-map >= 0.3 && < 0.5+               , dependent-sum >= 0.6 && < 0.8                , lens >= 4.7 && < 5                , semigroupoids >= 4.0 && < 6                , transformers >= 0.5.6.0 && < 0.6-               , witherable >= 0.3 && < 0.3.2+               , witherable >= 0.3 && < 0.4    exposed-modules: Data.Functor.Misc                  , Data.Monoid.DecidablyEmpty@@ -54,7 +57,7 @@   ghc-options: -Wall -fwarn-redundant-constraints -fwarn-tabs    if flag(split-these)-    build-depends: these >= 1 && <1.1+    build-depends: these >= 1 && <1.2                  , semialign >=1 && <1.2                  , monoidal-containers >= 0.6 && < 0.7   else@@ -62,6 +65,7 @@                  , monoidal-containers == 0.4.0.0  test-suite hlint+  default-language: Haskell2010   type: exitcode-stdio-1.0   main-is: hlint.hs   hs-source-dirs: test@@ -69,7 +73,7 @@                , directory                , filepath                , filemanip-               , hlint < 2.1 || >= 2.2.2+               , hlint (< 2.1 || >= 2.2.2) && < 3   if impl(ghcjs)     buildable: False 
src/Data/Functor/Misc.hs view
@@ -6,7 +6,6 @@ {-# LANGUAGE GADTs #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-}@@ -48,7 +47,7 @@ import qualified Data.IntMap as IntMap import Data.Map (Map) import qualified Data.Map as Map-import Data.Some (Some(Some))+import Data.Some (Some, mkSome) import Data.These import Data.Type.Equality ((:~:)(Refl)) import Data.Typeable hiding (Refl)@@ -117,7 +116,7 @@ -- | Convert a 'DMap' to a regular 'Map' by forgetting the types associated with -- the keys, using a function to remove the wrapping 'Functor' weakenDMapWith :: (forall a. v a -> v') -> DMap k v -> Map (Some k) v'-weakenDMapWith f = Map.fromDistinctAscList . map (\(k :=> v) -> (Some k, f v)) . DMap.toAscList+weakenDMapWith f = Map.fromDistinctAscList . map (\(k :=> v) -> (mkSome k, f v)) . DMap.toAscList  -------------------------------------------------------------------------------- -- WrapArg
src/Data/Patch/DMap.hs view
@@ -14,7 +14,9 @@ import Data.Patch.IntMap import Data.Patch.Map -import Data.Dependent.Map (DMap, DSum (..), GCompare (..))+import Data.Dependent.Map (DMap)+import Data.Dependent.Sum (DSum (..))+import Data.GADT.Compare (GCompare (..)) import qualified Data.Dependent.Map as DMap import Data.Functor.Constant import Data.Functor.Misc
src/Data/Patch/DMapWithMove.hs view
@@ -20,12 +20,13 @@ import qualified Data.Patch.MapWithMove as MapWithMove  import Data.Constraint.Extras-import Data.Dependent.Map (DMap, DSum (..), GCompare (..))+import Data.Dependent.Map (DMap)+import Data.Dependent.Sum (DSum (..)) import qualified Data.Dependent.Map as DMap import Data.Functor.Constant import Data.Functor.Misc import Data.Functor.Product-import Data.GADT.Compare (GEq (..))+import Data.GADT.Compare (GEq (..), GCompare (..)) import Data.GADT.Show (GShow, gshow) import qualified Data.Map as Map import Data.Maybe@@ -33,7 +34,7 @@ #if !MIN_VERSION_base(4,11,0) import Data.Semigroup (Semigroup (..)) #endif-import Data.Some (Some(Some))+import Data.Some (Some, mkSome) import Data.These  -- | Like 'PatchMapWithMove', but for 'DMap'. Each key carries a 'NodeInfo' which describes how it will be changed by the patch and connects move sources and@@ -317,8 +318,8 @@           { MapWithMove._nodeInfo_from = case _nodeInfo_from ni of               From_Insert v -> MapWithMove.From_Insert $ f v               From_Delete -> MapWithMove.From_Delete-              From_Move k -> MapWithMove.From_Move $ Some k-          , MapWithMove._nodeInfo_to = Some <$> getComposeMaybe (_nodeInfo_to ni)+              From_Move k -> MapWithMove.From_Move $ mkSome k+          , MapWithMove._nodeInfo_to = mkSome <$> getComposeMaybe (_nodeInfo_to ni)           }  -- |"Weaken" a @'PatchDMapWithMove' (Const2 k a) v@ to a @'PatchMapWithMove' k v'@. Weaken is in scare quotes because the 'Const2' has already disabled any
src/Data/Patch/IntMap.hs view
@@ -59,7 +59,7 @@ -- | Map an effectful function @Int -> a -> f b@ over all @a@s in the given @'PatchIntMap' a@ -- (that is, all inserts/updates), producing a @f (PatchIntMap b)@. traverseIntMapPatchWithKey :: Applicative f => (Int -> a -> f b) -> PatchIntMap a -> f (PatchIntMap b)-traverseIntMapPatchWithKey f (PatchIntMap m) = PatchIntMap <$> IntMap.traverseWithKey (\k mv -> traverse (f k) mv) m+traverseIntMapPatchWithKey f (PatchIntMap m) = PatchIntMap <$> IntMap.traverseWithKey (traverse . f) m  -- | Extract all @a@s inserted/updated by the given @'PatchIntMap' a@. patchIntMapNewElements :: PatchIntMap a -> [a]
test/hlint.hs view
@@ -1,7 +1,7 @@ module Main where  import Control.Monad-import Language.Haskell.HLint3 (hlint)+import Language.Haskell.HLint (hlint) import System.Directory import System.Exit (exitFailure, exitSuccess) import System.FilePath@@ -23,6 +23,7 @@         , "--ignore=Reduce duplication"         , "--cpp-define=USE_TEMPLATE_HASKELL"         , "--ignore=Use tuple-section"+        , "--ignore=Unused LANGUAGE pragma" -- hlint3 falsely believes that TypeOperators is not needed         ]       recurseInto = and <$> sequence         [ fileType ==? Directory