gdiff-th alternatives and similar packages
Based on the "Testing" category.
Alternatively, view gdiff-th alternatives based on common mentions on social networks and blogs.
-
hedgehog
Release with confidence, state-of-the-art property testing for Haskell. -
quickcheck-state-machine
Test monadic programs using state machine based models -
smallcheck
Test your Haskell code by exhaustively checking its properties -
curl-runnings
A declarative test framework for quickly and easily writing integration tests against JSON API's. -
ghc-prof-flamegraph
Generates data to be used with flamegraph.pl from .prof files. -
monad-mock
A Haskell package that provides a monad transformer for mocking mtl-style typeclasses -
test-framework
Framework for running and organising QuickCheck test properties and HUnit test cases -
fuzzcheck
A library for testing monadic code in the spirit of QuickCheck -
tasty-hedgehog
Tasty integration for the Hedgehog property testing library -
hspec-expectations-json
Hspec expectations on JSON Values -
should-not-typecheck
A HUnit/hspec assertion to verify that an expression does not typecheck -
quickcheck-arbitrary-adt
Typeclass for generating a list of each instance of a sum type's constructors -
hspec-golden-aeson
Use tests to monitor changes in Aeson serialization -
test-framework-th
Automagically (using Template Haskell) generates the Haskell-code you need when using HUnit -
tasty-rerun
Rerun previous test suite runs to run only failing tests -
markov-chain-usage-model
Computations for Markov chain usage models -
tasty-expected-failure
Mark test cases as expected-failure
Access the most powerful time series database as a service
Do you think we are missing an alternative of gdiff-th or a related project?
README
Generate GDiff GADTs and Associated Instances
gdiff-th is a library for generating the necessary apparatus for preforming typesafe diffs and patches with the gdiff library.
If you are unfamiliar with the gdiff library it can be found here http://hackage.haskell.org/package/gdiff
Usage
First install the library from here or from cabal.
With git
git clone https://github.com/jfischoff/gdiff-th
cd gdiff-th
cabal install
With cabal
cabal update
cabal install gdiff-th
Below is a simple example of how to use the library to view a colored diff.
module Example where
import Data.Generic.Diff
import Data.Generic.Diff.TH
import System.Console.Terminfo.Color
import Text.PrettyPrint.Free
import System.Console.Terminfo.PrettyPrint
data Exp = Exp :+: Exp
| Exp :*: Exp
| B Integer
deriving(Show, Eq, Typeable)
-- Make the GDiff apparatus
makeGDiff ''Exp
testA :: Exp
testA = foldl1 (:+:) . map B $ [0..20]
testB :: Exp
testB = foldl1 (:+:) . map B $ [0..8] ++ [42] ++ [10..20]
-- Make a type signature to help inference
diffExp :: Type ExpFamily Exp => Exp -> Exp -> EditScript ExpFamily Exp Exp
diffExp = diff
diffAandB = showCompressed $ diffExp testA testB
main = diffAandB
-- Utility functions to show colored diffs
showEdits :: forall (f :: * -> * -> *) txs tys.
EditScriptL f txs tys -> IO ()
showEdits = display . pprEdits
showCompressed :: Family f => EditScriptL f txs tys -> IO ()
showCompressed = display . pprEdits . compress
pprEdits :: EditScriptL f txs tys -> TermDoc
pprEdits x = case x of
Cpy c d -> (text $ string c) + pprEdits d
CpyTree d -> text " ... " + pprEdits d
Del c d -> (with (Foreground Red) . text $ "- " ++ string c) + pprEdits d
Ins c d -> (with (Foreground Green) . text $ "+ " ++ string c) + pprEdits d
End -> line
Running the main function above would result in the following output
:+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: ... B + 42 - 9 ... ... ... ... ... ... ... ... ... ... ...
Except with pretty colors :).