Skip to content

Commit 09fe276

Browse files
committed
Merge remote-tracking branch 'origin/develop' into patch-map-inner-patch-desugar
2 parents 9705224 + 064a0e8 commit 09fe276

File tree

9 files changed

+38
-25
lines changed

9 files changed

+38
-25
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Before opening an issue, please check whether your issue has already been report
1616
* Describe the issue you're encountering or the suggestion you're making
1717
* Include any relevant steps to reproduce or code samples you can. It's always easier for us to debug if we have something that demonstrates the error.
1818
* Let us know what version of patch you were using. If you're using a github checkout, provide the git hash.
19-
* Describe how you're building patch (i.e., via patch-platform, cabal install, stack, obelisk, etc.). If you're using patch-platform or obelisk, provide the git hash of your checkout.
19+
* Describe how you're building patch (i.e., via reflex-platform, cabal install, stack, obelisk, etc.). If you're using reflex-platform or obelisk, provide the git hash of your checkout.
2020

2121
## Submitting Changes
2222

ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
Care is taken to make this as little of a breaking change as possible.
77
In particular, `PatchMapWithMove` is a newtype of `PatchMapWithPatchingMove` as is the `NodeInfo` of `PatchMapWithPatchingMove`'s `NodeInfo`.
88

9+
## 0.0.3.2
10+
11+
* Update version bounds
12+
913
## 0.0.3.1
1014

1115
* Replace `fromJust` with something easier to debug.

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
## Patch
1+
# patch
22

3-
Infrastructure for writing patches which act on other types.
3+
[![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)
44

5-
A `Patch` type represents a kind of change made to a datastructure.
5+
Data structures for describing changes to other data structures.
6+
7+
A `Patch` type represents a kind of change made to a data structure.
68

79
```haskell
810
class Patch p where
@@ -12,7 +14,7 @@ class Patch p where
1214
apply :: p -> PatchTarget p -> Maybe (PatchTarget p)
1315
```
1416

15-
### Patching Maps
17+
## Patching Maps
1618
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).
1719

1820
`PatchMap` is defined as:

patch.cabal

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
Name: patch
2-
Version: 0.0.3.1
3-
Synopsis: Infrastructure for writing patches which act on other types.
2+
Version: 0.0.3.2
3+
Synopsis: Data structures for describing changes to other data structures.
44
Description:
5+
Data structures for describing changes to other data structures.
6+
.
57
In this library, a patch is something which can be applied, analogous to a
68
function, and which distinguishes returning the argument it was provided from
79
returning something else.
@@ -12,15 +14,15 @@ Maintainer: [email protected]
1214
Stability: Experimental
1315
Category: FRP
1416
Build-type: Simple
15-
Cabal-version: >=1.9.2
17+
Cabal-version: >=1.10
1618
homepage: https://obsidian.systems
1719
bug-reports: https://github.com/reflex-frp/patch/issues
1820
extra-source-files:
1921
README.md
2022
ChangeLog.md
2123

2224
tested-with:
23-
GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.1
25+
GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.1
2426
GHCJS ==8.4
2527

2628
flag split-these
@@ -30,15 +32,16 @@ flag split-these
3032

3133
library
3234
hs-source-dirs: src
35+
default-language: Haskell2010
3336
build-depends: base >= 4.9 && < 4.14
3437
, constraints-extras >= 0.3 && < 0.4
3538
, containers >= 0.6 && < 0.7
36-
, dependent-map >= 0.3 && < 0.4
37-
, dependent-sum >= 0.6 && < 0.7
39+
, dependent-map >= 0.3 && < 0.5
40+
, dependent-sum >= 0.6 && < 0.8
3841
, lens >= 4.7 && < 5
3942
, semigroupoids >= 4.0 && < 6
4043
, transformers >= 0.5.6.0 && < 0.6
41-
, witherable >= 0.3 && < 0.3.2
44+
, witherable >= 0.3 && < 0.4
4245

4346
exposed-modules: Data.Functor.Misc
4447
, Data.Monoid.DecidablyEmpty
@@ -54,22 +57,23 @@ library
5457
ghc-options: -Wall -fwarn-redundant-constraints -fwarn-tabs
5558

5659
if flag(split-these)
57-
build-depends: these >= 1 && <1.1
60+
build-depends: these >= 1 && <1.2
5861
, semialign >=1 && <1.2
5962
, monoidal-containers >= 0.6 && < 0.7
6063
else
6164
build-depends: these >= 0.4 && <0.9
6265
, monoidal-containers == 0.4.0.0
6366

6467
test-suite hlint
68+
default-language: Haskell2010
6569
type: exitcode-stdio-1.0
6670
main-is: hlint.hs
6771
hs-source-dirs: test
6872
build-depends: base
6973
, directory
7074
, filepath
7175
, filemanip
72-
, hlint < 2.1 || >= 2.2.2
76+
, hlint (< 2.1 || >= 2.2.2) && < 3
7377
if impl(ghcjs)
7478
buildable: False
7579

src/Data/Functor/Misc.hs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
{-# LANGUAGE GADTs #-}
77
{-# LANGUAGE LambdaCase #-}
88
{-# LANGUAGE MultiParamTypeClasses #-}
9-
{-# LANGUAGE PatternSynonyms #-}
109
{-# LANGUAGE PolyKinds #-}
1110
{-# LANGUAGE RankNTypes #-}
1211
{-# LANGUAGE ScopedTypeVariables #-}
@@ -48,7 +47,7 @@ import Data.IntMap (IntMap)
4847
import qualified Data.IntMap as IntMap
4948
import Data.Map (Map)
5049
import qualified Data.Map as Map
51-
import Data.Some (Some(Some))
50+
import Data.Some (Some, mkSome)
5251
import Data.These
5352
import Data.Type.Equality ((:~:)(Refl))
5453
import Data.Typeable hiding (Refl)
@@ -117,7 +116,7 @@ intMapWithFunctorToDMap = DMap.fromDistinctAscList . map (\(k, v) -> Const2 k :=
117116
-- | Convert a 'DMap' to a regular 'Map' by forgetting the types associated with
118117
-- the keys, using a function to remove the wrapping 'Functor'
119118
weakenDMapWith :: (forall a. v a -> v') -> DMap k v -> Map (Some k) v'
120-
weakenDMapWith f = Map.fromDistinctAscList . map (\(k :=> v) -> (Some k, f v)) . DMap.toAscList
119+
weakenDMapWith f = Map.fromDistinctAscList . map (\(k :=> v) -> (mkSome k, f v)) . DMap.toAscList
121120

122121
--------------------------------------------------------------------------------
123122
-- WrapArg

src/Data/Patch/DMap.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ import Data.Patch.Class
1414
import Data.Patch.IntMap
1515
import Data.Patch.Map
1616

17-
import Data.Dependent.Map (DMap, DSum (..), GCompare (..))
17+
import Data.Dependent.Map (DMap)
18+
import Data.Dependent.Sum (DSum (..))
19+
import Data.GADT.Compare (GCompare (..))
1820
import qualified Data.Dependent.Map as DMap
1921
import Data.Functor.Constant
2022
import Data.Functor.Misc

src/Data/Patch/DMapWithMove.hs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,21 @@ import Data.Patch.MapWithMove (PatchMapWithMove (..))
2020
import qualified Data.Patch.MapWithMove as MapWithMove
2121

2222
import Data.Constraint.Extras
23-
import Data.Dependent.Map (DMap, DSum (..), GCompare (..))
23+
import Data.Dependent.Map (DMap)
24+
import Data.Dependent.Sum (DSum (..))
2425
import qualified Data.Dependent.Map as DMap
2526
import Data.Functor.Constant
2627
import Data.Functor.Misc
2728
import Data.Functor.Product
28-
import Data.GADT.Compare (GEq (..))
29+
import Data.GADT.Compare (GEq (..), GCompare (..))
2930
import Data.GADT.Show (GShow, gshow)
3031
import qualified Data.Map as Map
3132
import Data.Maybe
3233
import Data.Monoid.DecidablyEmpty
3334
#if !MIN_VERSION_base(4,11,0)
3435
import Data.Semigroup (Semigroup (..))
3536
#endif
36-
import Data.Some (Some(Some))
37+
import Data.Some (Some, mkSome)
3738
import Data.These
3839

3940
-- | 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 @@ weakenPatchDMapWithMoveWith f (PatchDMapWithMove p) = PatchMapWithMove $ weakenD
317318
{ MapWithMove._nodeInfo_from = case _nodeInfo_from ni of
318319
From_Insert v -> MapWithMove.From_Insert $ f v
319320
From_Delete -> MapWithMove.From_Delete
320-
From_Move k -> MapWithMove.From_Move $ Some k
321-
, MapWithMove._nodeInfo_to = Some <$> getComposeMaybe (_nodeInfo_to ni)
321+
From_Move k -> MapWithMove.From_Move $ mkSome k
322+
, MapWithMove._nodeInfo_to = mkSome <$> getComposeMaybe (_nodeInfo_to ni)
322323
}
323324

324325
-- |"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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ mapIntMapPatchWithKey f (PatchIntMap m) = PatchIntMap $ IntMap.mapWithKey (\ k m
5959
-- | Map an effectful function @Int -> a -> f b@ over all @a@s in the given @'PatchIntMap' a@
6060
-- (that is, all inserts/updates), producing a @f (PatchIntMap b)@.
6161
traverseIntMapPatchWithKey :: Applicative f => (Int -> a -> f b) -> PatchIntMap a -> f (PatchIntMap b)
62-
traverseIntMapPatchWithKey f (PatchIntMap m) = PatchIntMap <$> IntMap.traverseWithKey (\k mv -> traverse (f k) mv) m
62+
traverseIntMapPatchWithKey f (PatchIntMap m) = PatchIntMap <$> IntMap.traverseWithKey (traverse . f) m
6363

6464
-- | Extract all @a@s inserted/updated by the given @'PatchIntMap' a@.
6565
patchIntMapNewElements :: PatchIntMap a -> [a]

test/hlint.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Main where
22

33
import Control.Monad
4-
import Language.Haskell.HLint3 (hlint)
4+
import Language.Haskell.HLint (hlint)
55
import System.Directory
66
import System.Exit (exitFailure, exitSuccess)
77
import System.FilePath
@@ -23,6 +23,7 @@ main = do
2323
, "--ignore=Reduce duplication"
2424
, "--cpp-define=USE_TEMPLATE_HASKELL"
2525
, "--ignore=Use tuple-section"
26+
, "--ignore=Unused LANGUAGE pragma" -- hlint3 falsely believes that TypeOperators is not needed
2627
]
2728
recurseInto = and <$> sequence
2829
[ fileType ==? Directory

0 commit comments

Comments
 (0)