Code Monkey home page Code Monkey logo

tree-diff's People

Contributors

bodigrim avatar danwdart avatar phadej avatar terrorjack avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

tree-diff's Issues

License

Hey,

Any particular reason why this package used to be BSD licensed, but was changed to GPL?

Extract ToExpr into a separate package

It would be tremendously useful to split out the ToExpr type class together with Expr data type into a separate package.

It would allow libraries to define ToExpr instances with minimal set of transitive dependencies. tree-diff isn't exactly a lightweight package when it comes to dependencies

In other words libraries then would be able to define ToExpr instances by only depending on tree-diff-class, while test suites would depend on the full ctree-diff package

Compatibility with primitive 0.8

In primitive 0.8.0.0, if base >= 4.17 then Data.Primitive.ByteArray is just a reexport of Data.Array.Byte.ByteArray. This causes the instances in Data.TreeDiff.Class to be redundant.

Avoid GPL2 license

Would it be possible to extract code that forces GPL2 license on the package into a separate package and release tree-diff under a more permissive license?

GPL2 license makes this package a bit less useful than it otherwise could be.

Interest in a mild api-breaking modification to `Cpy`?

The Data.TreeDiff.List.diffBy function allows you to specify a comparision (a -> a -> Bool) function, and throws away the other element if it succeeds, yielding a Cpy a; seemingly very sensible.

But, if your comparision is not ==, it may be convenient to also retain the other parameter, giving a Cpy like Cpy (a,a) or more generally perhaps a monoid like Cpy (f a), then it would be a First or a list or whatever you wish ...

Is there interest in a change like this? I assume not, but I just want to at least note that this has been a useful change for me, and if others would find it a worthwhile api-breaking change I'd happily make a PR for it.

Need better long string diff

The library does just what I was looking for, but it is to complicated to use it in existing project for app config type, because it contains dozens of types spread across submodules and 3rd packages. To much work to make 1 test failure more readable. I would like to use ediffEq for Showable types. ediffEq doesn't look inside strings and it is not obvious what is different when long strings are compared.

Tight dependency ranges

Your package looks cool and I wanted to use it in tests for xlsx library but dependency restrictions are quite high. Are they strictly required? Probably you use some features which are missing from lower versions, right?

`ediffGolden` fails with `ToExpr` instances that don't preserve `Eq`, such as `HashMap`

Problem

I have some tests using tasty-golden + ediffGolden with data structures containing HashMap values. These tests work locally, but fail on CI due to the CI server generating Expr values for the HashMap values with the items in a different order than was captured in the golden snapshot.

Analysis

ediffGolden assumes (?) that a == b implies toExpr a == toExpr b.

However, the ToExpr instance for HashMap (source) captures the raw ordering returned by HM.toList, which isn't reliable across platforms (or in the presence of collisions and insert reordering), so the above property doesn't hold.

(This also affects the ToExpr instance of HashSet.)

Workaround

I'm already using a Expr construction in the affected code, so for the time being, I'm just using this variation of toExpr for HashMap sorts the items:

toExpr_HM :: (ToExpr k, ToExpr v, Ord k, Ord v) => HM.HashMap k v -> Expr
toExpr_HM x = App "HM.fromList" [ toExpr $ sort $ HM.toList x ]

Test suite fails `--quickcheck-replay=579929`

Encountered during stackage nightly build.

tree-diff> test (suite: tree-diff-test, args: --quickcheck-replay=579929)
                       
tests
  trifecta-pretty roundtrip:       OK (5.60s)
    +++ OK, passed 100 tests.
  parsec-ansi-wl-pprint roundtrip: FAIL (0.91s)
    *** Failed! Falsified (after 33 tests and 16 shrinks):
    Rec "" (fromList [("\"\n\"",Rec "" (fromList []))])
    `` {" " = `` {}}
    Rec "" (fromList [("\" \"",Rec "" (fromList []))])
    Just `` {" " = -`` {}, " " = +`` {}}
    Use --quickcheck-replay=579929 to reproduce.
    Use -p '/parsec-ansi-wl-pprint roundtrip/' to rerun this test only.
  diffBy example1:                 OK
    +++ OK, passed 1 test.
  diffBy model:                    OK (0.04s)
    +++ OK, passed 100 tests.
  Golden
    exFoo:                         OK
    MyInt1:                        OK
    MyInt2:                        OK
    MyInt3:                        OK
    Positional:                    OK
    HashSet:                       OK
      Golden file did not exist; created

1 out of 10 tests failed (6.55s)

Doesn't compile on ghc 9.2 due to another Option instance

instance ToExpr a => ToExpr (Semi.Option a) where

produces:

src/Data/TreeDiff/Class.hs:382:30: error:
    Not in scope: type constructor or class ‘Semi.Option’
    Module ‘Data.Semigroup’ does not export ‘Option’.
    |
382 | instance ToExpr a => ToExpr (Semi.Option a) where
    |                              ^^^^^^^^^^^

src/Data/TreeDiff/Class.hs:383:13: error:
    Not in scope: data constructor ‘Semi.Option’
    Module ‘Data.Semigroup’ does not export ‘Option’.
    |
383 |     toExpr (Semi.Option x) = App "Option" [toExpr x]

fetchRepoTarball doens't respect +markoutput

% cabal build  --with-compiler=ghc-8.2.2 -vnormal+markoutput     
-----BEGIN CABAL OUTPUT-----
Build profile: -w ghc-8.2.2 -O1
In order, the following will be built (use -v for more details):
...
 - tree-diff-0.1 (lib) (first run)
-----END CABAL OUTPUT-----
Downloading  base-orphans-0.8.1
-----BEGIN CABAL OUTPUT-----
Starting     bytestring-builder-0.10.8.2.0 (lib)
-----END CABAL OUTPUT-----
-----BEGIN CABAL OUTPUT-----
Starting     colour-2.3.5 (lib)
-----END CABAL OUTPUT-----

The Downloading is cabal's output.

GHC 8.4.1 compatibility

Could you please relax the version constraint on base on Hackage to allow for building with GHC 8.4.1?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.