Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ghc-syb for openSUSE:Factory checked in at 2021-02-16 22:37:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-syb (Old) and /work/SRC/openSUSE:Factory/.ghc-syb.new.28504 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-syb" Tue Feb 16 22:37:38 2021 rev:23 rq:870464 version:0.7.2.1 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-syb/ghc-syb.changes 2020-12-22 11:46:43.453875410 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-syb.new.28504/ghc-syb.changes 2021-02-16 22:45:46.110367962 +0100 @@ -1,0 +2,9 @@ +Thu Jan 21 08:59:14 UTC 2021 - [email protected] + +- Update syb to version 0.7.2.1. + 2021-01-18 Sergey Vinokurov <[email protected]> + + * 0.7.2: Add compatibility with GHC 9, switch to tasty for tests, + fix tests on GHCJS + +------------------------------------------------------------------- Old: ---- syb-0.7.1.tar.gz New: ---- syb-0.7.2.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-syb.spec ++++++ --- /var/tmp/diff_new_pack.ybsHI3/_old 2021-02-16 22:45:46.962369083 +0100 +++ /var/tmp/diff_new_pack.ybsHI3/_new 2021-02-16 22:45:46.966369088 +0100 @@ -1,7 +1,7 @@ # # spec file for package ghc-syb # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %global pkg_name syb %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.7.1 +Version: 0.7.2.1 Release: 0 Summary: Scrap Your Boilerplate License: BSD-3-Clause @@ -29,9 +29,10 @@ BuildRequires: ghc-rpm-macros ExcludeArch: %{ix86} %if %{with tests} -BuildRequires: ghc-HUnit-devel BuildRequires: ghc-containers-devel BuildRequires: ghc-mtl-devel +BuildRequires: ghc-tasty-devel +BuildRequires: ghc-tasty-hunit-devel %endif %description ++++++ syb-0.7.1.tar.gz -> syb-0.7.2.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/ChangeLog new/syb-0.7.2.1/ChangeLog --- old/syb-0.7.1/ChangeLog 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/ChangeLog 2001-09-09 03:46:40.000000000 +0200 @@ -1,3 +1,8 @@ +2021-01-18 Sergey Vinokurov <[email protected]> + + * 0.7.2: Add compatibility with GHC 9, switch to tasty for tests, + fix tests on GHCJS + 2019-06-15 Sergey Vinokurov <[email protected]> * 0.7.1: Define recursive traversals in two parts, non-recursive diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/src/Data/Generics/Twins.hs new/syb-0.7.2.1/src/Data/Generics/Twins.hs --- old/syb-0.7.1/src/Data/Generics/Twins.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/src/Data/Generics/Twins.hs 2001-09-09 03:46:40.000000000 +0200 @@ -287,7 +287,7 @@ in case (repX, repY) of (AlgConstr nX, AlgConstr nY) -> - nX `compare` nY `mappend` mconcat (gzipWithQ gcompare' x y) + nX `compare` nY `mappend` mconcat (gzipWithQ (\a -> gcompare' a) x y) (IntConstr iX, IntConstr iY) -> iX `compare` iY (FloatConstr rX, FloatConstr rY) -> rX `compare` rY (CharConstr cX, CharConstr cY) -> cX `compare` cY diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/syb.cabal new/syb-0.7.2.1/syb.cabal --- old/syb-0.7.1/syb.cabal 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/syb.cabal 2001-09-09 03:46:40.000000000 +0200 @@ -1,5 +1,5 @@ name: syb -version: 0.7.1 +version: 0.7.2.1 license: BSD3 license-file: LICENSE author: Ralf Lammel, Simon Peyton Jones, Jose Pedro Magalhaes @@ -18,11 +18,10 @@ category: Generics stability: provisional build-type: Simple -cabal-version: >= 1.8 -tested-with: GHC >=7.0 && <=7.10.2, GHC==7.11.*, GHC==8.0, GHC==8.2, GHC==8.4.4, GHC==8.6.5 +cabal-version: >= 1.10 +tested-with: GHC==8.10.3, GHC==8.8.4, GHC==8.6.5, GHC==8.4.4, GHC==8.2.2, GHC==8.0.2, GHC==7.10.3, GHC==7.8.4, GHC==7.6.3, GHC==7.4.2, GHC==7.2.2, GHC==7.0.4 -extra-source-files: tests/*.hs, - README.md, +extra-source-files: README.md, ChangeLog source-repository head @@ -31,6 +30,7 @@ Library hs-source-dirs: src + default-language: Haskell98 build-depends: base >= 4.0 && < 5.0 exposed-modules: Data.Generics, Data.Generics.Basics, @@ -58,9 +58,47 @@ test-suite unit-tests type: exitcode-stdio-1.0 hs-source-dirs: tests + default-language: Haskell98 main-is: Main.hs build-depends: base , syb - , HUnit + , tasty + , tasty-hunit , containers , mtl + other-modules: Bits + Builders + CompanyDatatypes + Datatype + Encode + Ext + Ext1 + Ext2 + FoldTree + FreeNames + GEq + GMapQAssoc + GRead + GRead2 + GShow + GShow2 + GZip + GenUpTo + GetC + HList + HOPat + Labels + LocalQuantors + NestedDatatypes + Newtype + Paradise + Perm + Polymatch + Reify + Strings + Tree + Twin + Typecase1 + Typecase2 + Where + XML diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/Bits.hs new/syb-0.7.2.1/tests/Bits.hs --- old/syb-0.7.1/tests/Bits.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/Bits.hs 2001-09-09 03:46:40.000000000 +0200 @@ -3,7 +3,7 @@ module Bits (tests) where {- - + This test exercices some oldies of generic programming, namely encoding terms as bit streams and decoding these bit streams in turn to obtain terms again. (This sort of function might actually be useful @@ -34,7 +34,7 @@ -} -import Test.HUnit +import Test.Tasty.HUnit import Data.Generics import Data.Char @@ -70,7 +70,7 @@ varNat2bin x = ( ( if even x then Zero else One ) : varNat2bin (x `div` 2) - ) + ) -- Encode a natural as a bit stream of fixed length @@ -79,7 +79,7 @@ fixedNat2bin p x | p>0 = ( ( if even x then Zero else One ) : fixedNat2bin (p - 1) (x `div` 2) - ) + ) -- Decode a natural @@ -197,7 +197,7 @@ max :: Int max = maxConstrIndex myDataType - -- Convert a bit stream into a constructor + -- Convert a bit stream into a constructor bin2con :: Bin -> Constr bin2con bin = indexConstr myDataType ((bin2nat bin) + 1) @@ -217,8 +217,8 @@ , ( showBin (1::Int) , ( showBin "1" , ( showBin genCom - , ( geq genCom genCom' - )))))) ~=? output + , ( geq genCom genCom' + )))))) @=? output where genCom' = fromJust (fst (unReadB readBin (showBin genCom))) :: Company diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/Builders.hs new/syb-0.7.2.1/tests/Builders.hs --- old/syb-0.7.1/tests/Builders.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/Builders.hs 2001-09-09 03:46:40.000000000 +0200 @@ -2,9 +2,9 @@ module Builders (tests) where --- Testing Data.Generics.Builders functionality +-- Testing Data.Generics.Builders functionality -import Test.HUnit +import Test.Tasty.HUnit import Data.Data import Data.Generics.Builders @@ -13,8 +13,8 @@ -- Main function for testing tests = ( constrs :: [Maybe Int] , constrs :: [String] - , constrs :: [Either Int Float] + , constrs :: [Either Int Double] , constrs :: [((), Integer)] - ) ~=? output + ) @=? output -output = ([Nothing,Just 0],["","\NUL"],[Left 0,Right 0.0],[((),0)]) \ No newline at end of file +output = ([Nothing,Just 0],["","\NUL"],[Left 0,Right 0.0],[((),0)]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/CompanyDatatypes.hs new/syb-0.7.2.1/tests/CompanyDatatypes.hs --- old/syb-0.7.1/tests/CompanyDatatypes.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/CompanyDatatypes.hs 2001-09-09 03:46:40.000000000 +0200 @@ -11,7 +11,7 @@ data Unit = PU Employee | DU Dept deriving (Eq, Show, Typeable, Data) data Employee = E Person Salary deriving (Eq, Show, Typeable, Data) data Person = P Name Address deriving (Eq, Show, Typeable, Data) -data Salary = S Float deriving (Eq, Show, Typeable, Data) +data Salary = S Double deriving (Eq, Show, Typeable, Data) type Manager = Employee type Name = String type Address = String diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/Datatype.hs new/syb-0.7.2.1/tests/Datatype.hs --- old/syb-0.7.1/tests/Datatype.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/Datatype.hs 2001-09-09 03:46:40.000000000 +0200 @@ -4,7 +4,7 @@ -- These are simple tests to observe (data)type representations. module Datatype where -import Test.HUnit +import Test.Tasty.HUnit import Data.Tree import Data.Generics @@ -32,7 +32,7 @@ , ( tyconModule myString2 , ( tyconUQname myString2 )))))) - ~?= output + @?= output #if __GLASGOW_HASKELL__ >= 709 -- In GHC 7.10 module name is stripped from DataType @@ -44,7 +44,7 @@ #else tests = show ( myTypeRep, myDataType ) - ~?= output + @?= output #if __GLASGOW_HASKELL__ >= 701 output = "(MyDataType Int,DataType {tycon = \"Datatype.MyDataType\", datarep = AlgRep [MyDataType]})" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/Ext1.hs new/syb-0.7.2.1/tests/Ext1.hs --- old/syb-0.7.1/tests/Ext1.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/Ext1.hs 2001-09-09 03:46:40.000000000 +0200 @@ -9,9 +9,10 @@ -} -import Test.HUnit +import Test.Tasty.HUnit import Data.Generics +import GHC.Exts (unsafeCoerce#) #if MIN_VERSION_base(4,8,0) import GHC.Base hiding(foldr) #else @@ -36,7 +37,7 @@ extListQ' def ext d = if isList d then ext (unsafeCoerce d) - else def d + else def d -- Test extListQ' @@ -54,7 +55,7 @@ extListQ'' def ext d = if isList d then undefined -- hard to avoid an ambiguous type - else def d + else def d -- Test extListQ from Data.Generics.Aliases @@ -97,7 +98,7 @@ -- gmapQ for polymorphic lists gmapListQ :: forall a q. Data a => (forall a. Data a => a -> q) -> a -> [q] gmapListQ f x = - if not $ isList x + if not $ isList x then error "gmapListQ" else if isNil x then [] @@ -123,6 +124,6 @@ , ( t4 , ( t5 , ( t6 - )))))) ~=? output + )))))) @=? output output = (0,(2,(0,(4,(0,4))))) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/Ext2.hs new/syb-0.7.2.1/tests/Ext2.hs --- old/syb-0.7.1/tests/Ext2.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/Ext2.hs 2001-09-09 03:46:40.000000000 +0200 @@ -4,7 +4,7 @@ -- Tests for ext2 and friends -import Test.HUnit +import Test.Tasty.HUnit import Data.Generics @@ -57,7 +57,7 @@ -- Main function for testing -tests = (t1, t2, t3, t4) ~=? output +tests = (t1, t2, t3, t4) @=? output output = ((map flipPair s1, (flipPair p2, l2)) ,(Just (flipPair p1),Nothing) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/FoldTree.hs new/syb-0.7.2.1/tests/FoldTree.hs --- old/syb-0.7.1/tests/FoldTree.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/FoldTree.hs 2001-09-09 03:46:40.000000000 +0200 @@ -27,7 +27,7 @@ module FoldTree (tests) where -import Test.HUnit +import Test.Tasty.HUnit -- Enable "ScrapYourBoilerplate" import Data.Generics @@ -36,7 +36,7 @@ -- A parameterised datatype for binary trees with data at the leafs data Tree a w = Leaf a | Fork (Tree a w) (Tree a w) - | WithWeight (Tree a w) w + | WithWeight (Tree a w) w deriving (Typeable, Data) @@ -59,9 +59,9 @@ -- Additionally we test everythingBut, stopping when we see a WithWeight node tests = show ( listify (\(_::Int) -> True) mytree , everything (++) ([] `mkQ` fromLeaf) mytree - , everythingBut (++) + , everythingBut (++) (([],False) `mkQ` (\x -> (fromLeaf x, stop x))) mytree' - ) ~=? output + ) @=? output where fromLeaf :: Tree Int Int -> [Int] fromLeaf (Leaf x) = [x] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/FreeNames.hs new/syb-0.7.2.1/tests/FreeNames.hs --- old/syb-0.7.1/tests/FreeNames.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/FreeNames.hs 2001-09-09 03:46:40.000000000 +0200 @@ -20,7 +20,7 @@ -} -import Test.HUnit +import Test.Tasty.HUnit import Data.Generics import Data.List @@ -96,7 +96,7 @@ at the root. -} - + freeNames :: Data a => a -> [Name] freeNames x = ( (refsFun x) `union` @@ -113,6 +113,6 @@ -} -tests = freeNames sys1 ~=? output +tests = freeNames sys1 @=? output output = ["id","C"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/GEq.hs new/syb-0.7.2.1/tests/GEq.hs --- old/syb-0.7.1/tests/GEq.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/GEq.hs 2001-09-09 03:46:40.000000000 +0200 @@ -11,11 +11,11 @@ -} -import Test.HUnit +import Test.Tasty.HUnit import Data.Generics import CompanyDatatypes tests = ( geq genCom genCom , geq genCom genCom' - ) ~=? (True,False) + ) @=? (True,False) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/GMapQAssoc.hs new/syb-0.7.2.1/tests/GMapQAssoc.hs --- old/syb-0.7.1/tests/GMapQAssoc.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/GMapQAssoc.hs 2001-09-09 03:46:40.000000000 +0200 @@ -25,7 +25,7 @@ -} -import Test.HUnit +import Test.Tasty.HUnit import Data.Generics @@ -48,7 +48,7 @@ deriving (Typeable, Data) --- Select int if faced with a leaf +-- Select int if faced with a leaf leaf (Leaf i) = [i] leaf _ = [] @@ -63,6 +63,6 @@ -- tests = show ( gmapQ ([] `mkQ` leaf) term , gmapQ' ([] `mkQ` leaf) term - ) ~=? output + ) @=? output output = show ([[1],[2]],[[2],[1]]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/GRead.hs new/syb-0.7.2.1/tests/GRead.hs --- old/syb-0.7.1/tests/GRead.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/GRead.hs 2001-09-09 03:46:40.000000000 +0200 @@ -12,7 +12,7 @@ -} -import Test.HUnit +import Test.Tasty.HUnit import Data.Generics @@ -39,7 +39,7 @@ , [[(Int, String)]] , [[([Int], String)]] ) - ) ~=? output + ) @=? output output = show ([[(True,"")],[],[]],[[(1,"")],[(2,"...")]],[[([],"")],[([1],"")]]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/GShow.hs new/syb-0.7.2.1/tests/GShow.hs --- old/syb-0.7.1/tests/GShow.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/GShow.hs 2001-09-09 03:46:40.000000000 +0200 @@ -1,33 +1,33 @@ {-# OPTIONS -fglasgow-exts #-} - + module GShow (tests) where {- - + The generic show example from the 2nd boilerplate paper. (There were some typos in the ICFP 2004 paper.) Also check out Data.Generics.Text. - + -} -import Test.HUnit +import Test.Tasty.HUnit import Data.Generics hiding (gshow) import Prelude hiding (showString) - + gshow :: Data a => a -> String gshow = gshow_help `extQ` showString gshow_help :: Data a => a -> String -gshow_help t +gshow_help t = "(" ++ showConstr (toConstr t) ++ concat (intersperse " " (gmapQ gshow t)) ++ ")" showString :: String -> String -showString s = "\"" ++ concat (map escape s) ++ "\"" +showString s = "\"" ++ concat (map escape s) ++ "\"" where escape '\n' = "\\n" escape other_char = [other_char] @@ -37,7 +37,7 @@ = "[" ++ concat (intersperse "," (map gshow xs)) ++ "]" gshow' :: Data a => a -> String -gshow' = gshow_help `ext1Q` gshowList +gshow' = gshow_help `ext1Q` gshowList `extQ` showString intersperse :: a -> [a] -> [a] @@ -47,6 +47,6 @@ tests = ( gshow' "foo" , gshow' [True,False] - ) ~=? output + ) @=? output output = ("\"foo\"","[(True),(False)]") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/GShow2.hs new/syb-0.7.2.1/tests/GShow2.hs --- old/syb-0.7.1/tests/GShow2.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/GShow2.hs 2001-09-09 03:46:40.000000000 +0200 @@ -10,12 +10,12 @@ -} -import Test.HUnit +import Test.Tasty.HUnit import Data.Generics import CompanyDatatypes -tests = gshow genCom ~=? output +tests = gshow genCom @=? output {- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/GZip.hs new/syb-0.7.2.1/tests/GZip.hs --- old/syb-0.7.1/tests/GZip.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/GZip.hs 2001-09-09 03:46:40.000000000 +0200 @@ -11,13 +11,13 @@ -} -import Test.HUnit +import Test.Tasty.HUnit import Data.Generics import CompanyDatatypes -- The main function which prints the result of zipping -tests = gzip (\x y -> mkTT maxS x y) genCom1 genCom2 ~=? output +tests = gzip (\x y -> mkTT maxS x y) genCom1 genCom2 @=? output -- NB: the argument has to be eta-expanded to match -- the type of gzip's argument type, which is -- GenericQ (GenericM Maybe) @@ -40,7 +40,7 @@ (Just (x'::a),Just (y'::a)) -> cast (f x' y') _ -> Nothing -output = Just (C [D "Research" (E (P "Laemmel" "Amsterdam") (S 8000.0)) +output = Just (C [D "Research" (E (P "Laemmel" "Amsterdam") (S 8000.0)) [PU (E (P "Joost" "Amsterdam") (S 2000.0)) ,PU (E (P "Marlow" "Cambridge") (S 4000.0))] ,D "Strategy" (E (P "Blair" "London") (S 100000.0)) []]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/GenUpTo.hs new/syb-0.7.2.1/tests/GenUpTo.hs --- old/syb-0.7.1/tests/GenUpTo.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/GenUpTo.hs 2001-09-09 03:46:40.000000000 +0200 @@ -9,7 +9,7 @@ -} -import Test.HUnit +import Test.Tasty.HUnit import Data.Generics @@ -18,17 +18,17 @@ The following datatypes comprise the abstract syntax of a simple imperative language. Some provisions are such that the discussion -of test-set generation is simplified. In particular, we do not +of test-set generation is simplified. In particular, we do not consider anything but monomorphic *data*types --- no primitive types, no tuples, ... -} - -data Prog = Prog Dec Stat + +data Prog = Prog Dec Stat deriving (Show, Eq, Typeable, Data) data Dec = Nodec - | Ondec Id Type + | Ondec Id Type | Manydecs Dec Dec deriving (Show, Eq, Typeable, Data) @@ -43,7 +43,7 @@ | Seq Stat Stat deriving (Show, Eq, Typeable, Data) -data Exp = Zero +data Exp = Zero | Succ Exp deriving (Show, Eq, Typeable, Data) @@ -62,7 +62,7 @@ -- Find all terms headed by a specific Constr recurse :: Data a => Constr -> [a] - recurse con = gmapM (\_ -> genUpTo (d-1)) + recurse con = gmapM (\_ -> genUpTo (d-1)) (fromConstr con) -- We could also deal with primitive types easily. @@ -75,7 +75,7 @@ FloatRep -> [mkIntegralConstr ty 0] CharRep -> [mkCharConstr ty 'x'] where - ty = dataTypeOf (head result) + ty = dataTypeOf (head result) -- For silly tests @@ -89,6 +89,6 @@ , ( genUpTo 2 :: [Id] , ( genUpTo 2 :: [T0] , ( genUpTo 3 :: [Prog] - ))))) ~=? output + ))))) @=? output output = ([],([A,B],([A,B],([T0 T1a T2a T3a,T0 T1a T2a T3b,T0 T1a T2b T3a,T0 T1a T2b T3b,T0 T1b T2a T3a,T0 T1b T2a T3b,T0 T1b T2b T3a,T0 T1b T2b T3b],[Prog Nodec Noop,Prog Nodec (Assign A Zero),Prog Nodec (Assign B Zero),Prog Nodec (Seq Noop Noop),Prog (Ondec A Int) Noop,Prog (Ondec A Int) (Assign A Zero),Prog (Ondec A Int) (Assign B Zero),Prog (Ondec A Int) (Seq Noop Noop),Prog (Ondec A Bool) Noop,Prog (Ondec A Bool) (Assign A Zero),Prog (Ondec A Bool) (Assign B Zero),Prog (Ondec A Bool) (Seq Noop Noop),Prog (Ondec B Int) Noop,Prog (Ondec B Int) (Assign A Zero),Prog (Ondec B Int) (Assign B Zero),Prog (Ondec B Int) (Seq Noop Noop),Prog (Ondec B Bool) Noop,Prog (Ondec B Bool) (Assign A Zero),Prog (Ondec B Bool) (Assign B Zero),Prog (Ondec B Bool) (Seq Noop Noop),Prog (Manydecs Nodec Nodec) Noop,Prog (Manydecs Nodec Nodec) (Assign A Zero),Prog (Manydecs Nodec Nodec) (Assign B Zero),Prog (Manydecs Nodec Nodec) (Seq Noop Noop)])))) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/GetC.hs new/syb-0.7.2.1/tests/GetC.hs --- old/syb-0.7.1/tests/GetC.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/GetC.hs 2001-09-09 03:46:40.000000000 +0200 @@ -3,11 +3,11 @@ module GetC (tests) where -import Test.HUnit +import Test.Tasty.HUnit {- -Ralf Laemmel, 5 November 2004 +Ralf Laemmel, 5 November 2004 Joe Stoy suggested the idiom to test for the outermost constructor. @@ -28,14 +28,14 @@ -- Some silly data types data T1 = T1a Int String | T1b String Int deriving (Typeable, Data) data T2 = T2a Int Int | T2b String String deriving (Typeable, Data) -data T3 = T3! Int deriving (Typeable, Data) +data T3 = T3 !Int deriving (Typeable, Data) -- Test cases tests = show [ isC T1a (T1a 1 "foo") -- typechecks, returns True , isC T1a (T1b "foo" 1) -- typechecks, returns False , isC T3 (T3 42)] -- works for strict data too - ~=? output + @=? output -- err = show $ isC T2b (T1b "foo" 1) -- must not typecheck output = show [True,False,True] @@ -47,7 +47,7 @@ -- The class GetC computes maybe the constructor ... -- ... if the subterms of the datum at hand fit for f. -- Finally we compare the constructors. --- +-- isC :: (Data a, GetT f a, GetC f) => f -> a -> Bool isC f t = maybe False ((==) (toConstr t)) con @@ -59,18 +59,18 @@ -- -- We prepare for a list of kids using existential envelopes. -- We could also just operate on TypeReps for non-strict datatypes. --- +-- data ExTypeable = forall a. Typeable a => ExTypeable a unExTypeable (ExTypeable a) = cast a --- +-- -- Compute the result type of a function type. -- Beware: the TypeUnify constraint causes headache. -- We can't have GetT t t because the FD will be violated then. --- We can't omit the FD because unresolvable overlapping will hold then. --- +-- We can't omit the FD because unresolvable overlapping will hold then. +-- class GetT f t | f -> t -- FD is optional instance GetT g t => GetT (x -> g) t @@ -79,7 +79,7 @@ -- -- Obtain the constructor if term can be completed --- +-- class GetC f where @@ -104,7 +104,7 @@ -- Type unification; we could try this: -- class TypeUnify a b | a -> b, b -> a -- instance TypeUnify a a --- +-- -- However, if the instance is placed in the present module, -- then type improvement would inline this instance. Sigh!!! -- @@ -114,8 +114,8 @@ -- class TypeUnify a b | a -> b, b -> a -class TypeUnify' x a b | x a -> b, x b -> a -class TypeUnify'' x a b | x a -> b, x b -> a +class TypeUnify' x a b | x a -> b, x b -> a +class TypeUnify'' x a b | x a -> b, x b -> a instance TypeUnify' () a b => TypeUnify a b instance TypeUnify'' x a b => TypeUnify' x a b instance TypeUnify'' () a a diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/HList.hs new/syb-0.7.2.1/tests/HList.hs --- old/syb-0.7.1/tests/HList.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/HList.hs 2001-09-09 03:46:40.000000000 +0200 @@ -8,7 +8,7 @@ -} -import Test.HUnit +import Test.Tasty.HUnit import Data.Typeable @@ -16,7 +16,7 @@ -- Heterogeneously typed lists type HList = [DontKnow] -data DontKnow = forall a. Typeable a => DontKnow a +data DontKnow = forall a. Typeable a => DontKnow a -- The empty list initHList :: HList @@ -57,6 +57,6 @@ , ( show (nth1HList 1 mylist :: Maybe Bool) -- shows Nothing , ( show (nth1HList 2 mylist :: Maybe Bool) -- shows Just True , ( show (nth1HList 3 mylist :: Maybe String) -- shows Just "42" - )))) ~=? output + )))) @=? output -output = ("Just 1",("Nothing",("Just True","Just \"42\""))) \ No newline at end of file +output = ("Just 1",("Nothing",("Just True","Just \"42\""))) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/HOPat.hs new/syb-0.7.2.1/tests/HOPat.hs --- old/syb-0.7.1/tests/HOPat.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/HOPat.hs 2001-09-09 03:46:40.000000000 +0200 @@ -12,13 +12,13 @@ -} -import Test.HUnit +import Test.Tasty.HUnit import Data.Generics -- Sample datatypes -data T1 = T1a Int | T1b Float +data T1 = T1a Int | T1b Double deriving (Show, Eq, Typeable, Data) data T2 = T2a T1 T2 | T2b deriving (Show, Eq, Typeable, Data) @@ -31,7 +31,7 @@ -- Unwrap a term; Return its single component -unwrap :: (Data y, Data x) => y -> Maybe x +unwrap :: (Data y, Data x) => y -> Maybe x unwrap y = case gmapQ (Nothing `mkQ` Just) y of [Just x] -> Just x _ -> Nothing @@ -48,7 +48,7 @@ visitor c f = everywhere (mkT g) where g y = case elim c y of - Just x -> c (f x) + Just x -> c (f x) Nothing -> y @@ -58,10 +58,10 @@ , ( (elim T1a t1a) :: Maybe Int , ( (elim T1a t1b) :: Maybe Int , ( (visitor T1a ((+) 46) t2) :: T2 - ))))) ~=? output + ))))) @=? output where t1a = T1a 42 t1b = T1b 3.14 t2 = T2a t1a (T2a t1a T2b) -output = (Just 42,(Nothing,(Just 42,(Nothing,T2a (T1a 88) (T2a (T1a 88) T2b))))) \ No newline at end of file +output = (Just 42,(Nothing,(Just 42,(Nothing,T2a (T1a 88) (T2a (T1a 88) T2b))))) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/Labels.hs new/syb-0.7.2.1/tests/Labels.hs --- old/syb-0.7.1/tests/Labels.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/Labels.hs 2001-09-09 03:46:40.000000000 +0200 @@ -4,17 +4,17 @@ -- This module tests availability of field labels. -import Test.HUnit +import Test.Tasty.HUnit import Data.Generics -- A datatype without labels -data NoLabels = NoLabels Int Float +data NoLabels = NoLabels Int Double deriving (Typeable, Data) -- A datatype with labels data YesLabels = YesLabels { myint :: Int - , myfloat :: Float + , myfloat :: Double } deriving (Typeable, Data) @@ -25,6 +25,6 @@ -- Main function for testing tests = ( constrFields $ toConstr noLabels , constrFields $ toConstr yesLabels - ) ~=? output + ) @=? output output = ([],["myint","myfloat"]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/Main.hs new/syb-0.7.2.1/tests/Main.hs --- old/syb-0.7.1/tests/Main.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/Main.hs 2001-09-09 03:46:40.000000000 +0200 @@ -1,7 +1,8 @@ module Main where -import Test.HUnit +import Test.Tasty +import Test.Tasty.HUnit import System.Exit import qualified Bits @@ -41,42 +42,34 @@ import qualified NestedDatatypes -- no tests, should compile import qualified Polymatch -- no tests, should compile - -tests = - "All" ~: [ Datatype.tests - , FoldTree.tests - , GetC.tests - , GMapQAssoc.tests - , GRead.tests - , GShow.tests - , GShow2.tests - , HList.tests - , HOPat.tests - , Labels.tests - , Newtype.tests - , Perm.tests - , Twin.tests - , Typecase1.tests - , Typecase2.tests - , Where.tests - , XML.tests - , Tree.tests - , Strings.tests - , Reify.tests - , Paradise.tests - , GZip.tests - , GEq.tests - , GenUpTo.tests - , FreeNames.tests - , Ext1.tests - , Ext2.tests - , Bits.tests - , Builders.tests - ] - -main = do - putStrLn "Running tests for syb..." - counts <- runTestTT tests - if (failures counts > 0) - then exitFailure - else exitSuccess +main = defaultMain $ testGroup "All" + [ testCase "Datatype" Datatype.tests + , testCase "FoldTree" FoldTree.tests + , testCase "GetC" GetC.tests + , testCase "GMapQAssoc" GMapQAssoc.tests + , testCase "GRead" GRead.tests + , testCase "GShow" GShow.tests + , testCase "GShow2" GShow2.tests + , testCase "HList" HList.tests + , testCase "HOPat" HOPat.tests + , testCase "Labels" Labels.tests + , testCase "Newtype" Newtype.tests + , testCase "Perm" Perm.tests + , testCase "Twin" Twin.tests + , testCase "Typecase1" Typecase1.tests + , testCase "Typecase2" Typecase2.tests + , testCase "Where" Where.tests + , testCase "XML" XML.tests + , testCase "Tree" Tree.tests + , testCase "Strings" Strings.tests + , testCase "Reify" Reify.tests + , testCase "Paradise" Paradise.tests + , testCase "GZip" GZip.tests + , testCase "GEq" GEq.tests + , testCase "GenUpTo" GenUpTo.tests + , testCase "FreeNames" FreeNames.tests + , testCase "Ext1" Ext1.tests + , testCase "Ext2" Ext2.tests + , testCase "Bits" Bits.tests + , testCase "Builders" Builders.tests + ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/Newtype.hs new/syb-0.7.2.1/tests/Newtype.hs --- old/syb-0.7.1/tests/Newtype.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/Newtype.hs 2001-09-09 03:46:40.000000000 +0200 @@ -5,13 +5,13 @@ -- The type of a newtype should treat the newtype as opaque -import Test.HUnit +import Test.Tasty.HUnit import Data.Generics newtype T = MkT Int deriving( Typeable ) -tests = show (typeOf (undefined :: T)) ~?= output +tests = show (typeOf (undefined :: T)) @?= output #if __GLASGOW_HASKELL__ >= 701 output = "T" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/Paradise.hs new/syb-0.7.2.1/tests/Paradise.hs --- old/syb-0.7.1/tests/Paradise.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/Paradise.hs 2001-09-09 03:46:40.000000000 +0200 @@ -11,19 +11,19 @@ -} -import Test.HUnit +import Test.Tasty.HUnit import Data.Generics import CompanyDatatypes -- Increase salary by percentage -increase :: Float -> Company -> Company +increase :: Double -> Company -> Company increase k = everywhere (mkT (incS k)) -- "interesting" code for increase -incS :: Float -> Salary -> Salary +incS :: Double -> Salary -> Salary incS k (S s) = S (s * (1+k)) -tests = increase 0.1 genCom ~=? output +tests = increase 0.125 genCom @=? output -output = C [D "Research" (E (P "Laemmel" "Amsterdam") (S 8800.0)) [PU (E (P "Joost" "Amsterdam") (S 1100.0)),PU (E (P "Marlow" "Cambridge") (S 2200.0))],D "Strategy" (E (P "Blair" "London") (S 110000.0)) []] +output = C [D "Research" (E (P "Laemmel" "Amsterdam") (S 9000)) [PU (E (P "Joost" "Amsterdam") (S 1125)),PU (E (P "Marlow" "Cambridge") (S 2250))],D "Strategy" (E (P "Blair" "London") (S 112500)) []] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/Perm.hs new/syb-0.7.2.1/tests/Perm.hs --- old/syb-0.7.1/tests/Perm.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/Perm.hs 2001-09-09 03:46:40.000000000 +0200 @@ -9,7 +9,7 @@ -} -import Test.HUnit +import Test.Tasty.HUnit import Control.Applicative (Alternative(..), Applicative(..)) import Control.Monad @@ -134,6 +134,6 @@ , ( runReadT buildT ["T3","T1","T2"] :: Maybe T3 -- should parse fine , ( runReadT buildT ["T3","T2","T1"] :: Maybe T3 -- should parse fine , ( runReadT buildT ["T3","T2","T2"] :: Maybe T3 -- should fail - ))))) ~=? output + ))))) @=? output output = (Just T1,(Just T2,(Just (T3 T1 T2),(Just (T3 T1 T2),Nothing)))) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/Reify.hs new/syb-0.7.2.1/tests/Reify.hs --- old/syb-0.7.1/tests/Reify.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/Reify.hs 2001-09-09 03:46:40.000000000 +0200 @@ -10,7 +10,7 @@ -} -import Test.HUnit +import Test.Tasty.HUnit import Data.Maybe import Data.Generics @@ -354,7 +354,7 @@ -- For testing shallowTerm shallowTermBase :: GenericR Maybe shallowTermBase = Nothing - `extR` Just (1.23::Float) + `extR` Just (1.23::Double) `extR` Just ("foo"::String) @@ -406,7 +406,7 @@ , ( test8 , ( test9 , ( test10 - ))))))))))) ~=? output + ))))))))))) @=? output output = (True,(True,(False,(True,(True,(1,(2,(3,(P "foo" "foo", (E (P "foo" "foo") (S 1.23), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/Strings.hs new/syb-0.7.2.1/tests/Strings.hs --- old/syb-0.7.1/tests/Strings.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/Strings.hs 2001-09-09 03:46:40.000000000 +0200 @@ -11,11 +11,11 @@ -} -import Test.HUnit +import Test.Tasty.HUnit import Data.Generics import CompanyDatatypes tests = (case gread (gshow genCom) of [(x,_)] -> geq genCom x - _ -> False) ~=? True + _ -> False) @=? True diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/Tree.hs new/syb-0.7.2.1/tests/Tree.hs --- old/syb-0.7.1/tests/Tree.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/Tree.hs 2001-09-09 03:46:40.000000000 +0200 @@ -9,7 +9,7 @@ -} -import Test.HUnit +import Test.Tasty.HUnit import Control.Monad.Reader import Data.Generics @@ -44,7 +44,7 @@ con = readConstr (dataTypeOf ta) x -- recursion per kid with accumulation - perkid ts = const (tail ts, tree2data (head ts)) + perkid ts = const (tail ts, tree2data (head ts)) -- recurse into kids kids x = @@ -54,9 +54,9 @@ -- Main function for testing tests = ( genCom - , ( data2tree genCom - , ( (tree2data (data2tree genCom)) :: Maybe Company + , ( data2tree genCom + , ( (tree2data (data2tree genCom)) :: Maybe Company , ( Just genCom == tree2data (data2tree genCom) - )))) ~=? output + )))) @=? output output = (C [D "Research" (E (P "Laemmel" "Amsterdam") (S 8000.0)) [PU (E (P "Joost" "Amsterdam") (S 1000.0)),PU (E (P "Marlow" "Cambridge") (S 2000.0))],D "Strategy" (E (P "Blair" "London") (S 100000.0)) []],(Node {rootLabel = "C", subForest = [Node {rootLabel = "(:)", subForest = [Node {rootLabel = "D", subForest = [Node {rootLabel = "Research", subForest = []},Node {rootLabel = "E", subForest = [Node {rootLabel = "P", subForest = [Node {rootLabel = "Laemmel", subForest = []},Node {rootLabel = "Amsterdam", subForest = []}]},Node {rootLabel = "S", subForest = [Node {rootLabel = "8000.0", subForest = []}]}]},Node {rootLabel = "(:)", subForest = [Node {rootLabel = "PU", subForest = [Node {rootLabel = "E", subForest = [Node {rootLabel = "P", subForest = [Node {rootLabel = "Joost", subForest = []},Node {rootLabel = "Amsterdam", subForest = []}]},Node {rootLabel = "S", subForest = [Node {rootLabel = "1000.0", subForest = []}]}]}]},Node {rootLabel = "(:)", subForest = [Node {rootLabel = "PU", subForest = [Node {rootLabel = "E", subForest = [Node {rootLabel = "P", subForest = [Node {rootLabel = "Marlow", subForest = []},Node {rootLabel = "Cambridge", subForest = []}]},Node {rootLabel = "S", subForest = [Node {rootLabel = "2000.0", subForest = []}]}]}]},Node {rootLabel = "[]", subForest = []}]}]}]},Node {rootLabel = "(:)", subForest = [Node {rootLabel = "D", subForest = [Node {rootLabel = "Strategy", subForest = []},Node {rootLabel = "E", subForest = [Node {rootLabel = "P", subForest = [Node {rootLabel = "Blair", subForest = []},Node {rootLabel = "London", subForest = []}]},Node {rootLabel = "S", subForest = [Node {rootLabel = "100000.0", subForest = []}]}]},Node {rootLabel = "[]", subForest = []}]},Node {rootLabel = "[]", subForest = []}]}]}]},(Just (C [D "Research" (E (P "Laemmel" "Amsterdam") (S 8000.0)) [PU (E (P "Joost" "Amsterdam") (S 1000.0)),PU (E (P "Marlow" "Cambridge") (S 2000.0))],D "Strategy" (E (P "Blair" "London") (S 100000.0)) []]),True))) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/Twin.hs new/syb-0.7.2.1/tests/Twin.hs --- old/syb-0.7.1/tests/Twin.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/Twin.hs 2001-09-09 03:46:40.000000000 +0200 @@ -1,5 +1,5 @@ {-# OPTIONS -fglasgow-exts #-} - + module Twin (tests) where {- @@ -8,13 +8,13 @@ we favour some simplified development of twin traversal. So the full general, stepwise story is in Data.Generics.Twin, but the short version from the paper is turned into a test -case below. +case below. See the paper for an explanation. - + -} -import Test.HUnit +import Test.Tasty.HUnit import Data.Generics hiding (GQ,gzipWithQ,geq) @@ -23,13 +23,13 @@ && and (gzipWithQ geq' x y) geq :: Data a => a -> a -> Bool -geq = geq' +geq a = geq' a newtype GQ r = GQ (GenericQ r) gzipWithQ :: GenericQ (GenericQ r) -> GenericQ (GenericQ [r]) -gzipWithQ f t1 t2 +gzipWithQ f t1 t2 = gApplyQ (gmapQ (\x -> GQ (f x)) t1) t2 gApplyQ :: Data a => [GQ r] -> a -> [r] @@ -42,7 +42,7 @@ newtype R r x = R { unR :: r } gfoldlQ :: (r -> GenericQ r) - -> r + -> r -> GenericQ r gfoldlQ k z t = unR (gfoldl k' z' t) @@ -85,6 +85,6 @@ , geq [True,True] [True,False] , geq'' [True,True] [True,True] , geq'' [True,True] [True,False] - ) ~=? output + ) @=? output output = (True,False,True,False) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/Typecase1.hs new/syb-0.7.2.1/tests/Typecase1.hs --- old/syb-0.7.1/tests/Typecase1.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/Typecase1.hs 2001-09-09 03:46:40.000000000 +0200 @@ -10,7 +10,7 @@ -} -import Test.HUnit +import Test.Tasty.HUnit import Data.Typeable import Data.Maybe @@ -34,7 +34,7 @@ int a = "got an int, incremented: " ++ show (a + 1) -- do something with floats - float :: Float -> String + float :: Double -> String float a = "got a float, multiplied by .42: " ++ show (a * 0.42) -- do something with my typeables @@ -49,11 +49,11 @@ -- Test the type case -- tests = ( f (41::Int) - , f (88::Float) + , f (88::Double) , f (MyCons "42") - , f True) ~=? output + , f True) @=? output output = ( "got an int, incremented: 42" , "got a float, multiplied by .42: 36.96" , "got a term: MyCons \"42\"" - , "got something else: True") \ No newline at end of file + , "got something else: True") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/Typecase2.hs new/syb-0.7.2.1/tests/Typecase2.hs --- old/syb-0.7.1/tests/Typecase2.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/Typecase2.hs 2001-09-09 03:46:40.000000000 +0200 @@ -11,7 +11,7 @@ -} -import Test.HUnit +import Test.Tasty.HUnit import Data.Generics import Data.Maybe @@ -35,7 +35,7 @@ int a = "got an int, incremented: " ++ show (a + 1) -- do something with floats - float :: Float -> String + float :: Double -> String float a = "got a float, multiplied by .42: " ++ show (a * 0.42) -- do something with my data @@ -50,9 +50,9 @@ -- Test the type case -- tests = ( f (41::Int) - , f (88::Float) + , f (88::Double) , f (MyCons "42") - , f True) ~=? output + , f True) @=? output output = ( "got an int, incremented: 42" , "got a float, multiplied by .42: 36.96" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/Where.hs new/syb-0.7.2.1/tests/Where.hs --- old/syb-0.7.1/tests/Where.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/Where.hs 2001-09-09 03:46:40.000000000 +0200 @@ -48,11 +48,11 @@ Attempts to reach all nodes where all the sub-traversals are performed in monadic bind-sequence. Failure of the traversal for a given subterm - implies failure of the entire traversal. Hence, the argument of + implies failure of the entire traversal. Hence, the argument of "everywhereM" should be designed in a way that it tends to succeed except for the purpose of propagating a proper error in the sense of violating a pre-/post-condition. For example, "mkM stepfail" should - not be passed to "everywhereM" as it will fail for all but one term + not be passed to "everywhereM" as it will fail for all but one term pattern; see "recovered" for a way to massage "stepfail" accordingly. c) somewhere @@ -71,7 +71,7 @@ -} -import Test.HUnit +import Test.Tasty.HUnit import Data.Generics import Control.Monad @@ -120,6 +120,6 @@ ( result4, ( result5, ( result6, - ( result7 ))))))) ~=? output + ( result7 ))))))) @=? output output = "((,) (T1b (T2 (T1a (88)))) ((,) (T1b (T2 (T1a (37)))) ((,) (Nothing) ((,) (Nothing) ((,) (Just (T1b (T2 (T1a (37))))) ((,) (Just (T1b (T2 (T1a (88))))) (Nothing)))))))" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syb-0.7.1/tests/XML.hs new/syb-0.7.2.1/tests/XML.hs --- old/syb-0.7.1/tests/XML.hs 2019-06-15 09:52:41.000000000 +0200 +++ new/syb-0.7.2.1/tests/XML.hs 2001-09-09 03:46:40.000000000 +0200 @@ -11,7 +11,7 @@ -} -import Test.HUnit +import Test.Tasty.HUnit import Control.Applicative (Alternative(..), Applicative(..)) import Control.Monad @@ -44,14 +44,14 @@ data2content :: Data a => a -> [Content] data2content = element `ext1Q` list - `extQ` string + `extQ` string `extQ` float where -- Handle an element element x = [CElem (Elem (tyconUQname (dataTypeName (dataTypeOf x))) - [] -- no attributes + [] -- no attributes (concat (gmapQ data2content x)))] -- A special case for lists @@ -63,7 +63,7 @@ string x = [CString True x] -- A special case for floats - float :: Float -> [Content] + float :: Double -> [Content] float x = [CString True (show x)] @@ -72,7 +72,7 @@ content2data = result where - + -- Case-discriminating worker result = element `ext1R` list @@ -111,7 +111,7 @@ -- Retrieve all constructors of the requested type consOf = dataTypeConstrs - $ dataTypeOf + $ dataTypeOf $ myType -- Recurse into subterms @@ -127,7 +127,7 @@ _ -> mzero -- A special case for floats - float :: ReadX Float + float :: ReadX Double float = do c <- readX case c of (CString _ x) -> return (read x) @@ -147,13 +147,13 @@ -> Maybe ([Content], a) } -- Run a computation -runReadX x y = case unReadX x y of +runReadX x y = case unReadX x y of Just ([],y) -> Just y _ -> Nothing -- Read one content particle readX :: ReadX Content -readX = ReadX (\x -> if null x +readX = ReadX (\x -> if null x then Nothing else Just (tail x, head x) ) @@ -198,8 +198,8 @@ , ( zigzag person1 :: Maybe Person , ( zigzag genCom :: Maybe Company , ( zigzag genCom == Just genCom - ))))) ~=? output - where + ))))) @=? output + where -- Trealise back and forth zigzag :: Data a => a -> Maybe a zigzag = runReadX content2data . data2content
