packages feed

ClassLaws 0.3.0.2 → 0.3.1.0

raw patch · 3 files changed

+36/−3 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Test.ClassLaws.TestingDatatypes: instance TestEqual Char
+ Text.Show.Laws: class Show s => ShowLaws s where showLaw = defaultShowLaw
+ Text.Show.Laws: data ShowLaw s
+ Text.Show.Laws: defaultShowLaw :: Show a => (Int, a, String, [Char]) -> Theorem [Char]
+ Text.Show.Laws: instance ShowLaws s => LawTest (ShowLaw s)
+ Text.Show.Laws: showLaw :: ShowLaws s => Law (ShowLaw s)

Files

ClassLaws.cabal view
@@ -10,7 +10,7 @@ -- PVP summary:      +-+------- breaking API changes --                   | | +----- non-breaking API additions --                   | | | +--- code changes with no API change-version:             0.3.0.2+version:             0.3.1.0  -- A short (one-line) description of the package. synopsis:            Stating and checking laws for type class methods@@ -32,7 +32,7 @@   do not satisfy the expected laws. More information can be found at   <http://wiki.portal.chalmers.se/cse/pmwiki.php/FP/ClassLaws>.  Built   with ghc-7.4.2 and ghc-7.6.1. (Fails to build with ghc-7.2.2 due to-  http://hackage.haskell.org/trac/ghc/ticket/5745. Could be worked+  <http://hackage.haskell.org/trac/ghc/ticket/5745>. Could be worked   around.)  -- The license under which the package is released.@@ -67,7 +67,8 @@     Test.ClassLaws.TestingDatatypes, Test.ClassLaws.TestingState,     Control.Monad.Laws, Control.Monad.Laws.Instances,      Control.Monad.State.Class.Laws, Control.Monad.State.Class.Laws.Instances, -    Data.Monoid.Laws, Data.Monoid.Laws.Instances+    Data.Monoid.Laws, Data.Monoid.Laws.Instances,+    Text.Show.Laws        -- The Control.Monad and Data.Monoid laws should perhaps be split off       -- Some modules may be made internal 
src/Test/ClassLaws/TestingDatatypes.hs view
@@ -28,6 +28,12 @@ instance (Eq a, Show a) => TestEqual [a] where   testEqual p _ = testEq (==) p +-- Char+type instance Param Char  =  ()++instance TestEqual Char where+  testEqual p _ = testEq (==) p+ -- Maybe type instance Param (Maybe a)  =  () 
+ src/Text/Show/Laws.hs view
@@ -0,0 +1,26 @@+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE TypeSynonymInstances #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE EmptyDataDecls #-}++module Text.Show.Laws where++import Test.ClassLaws+import Test.ClassLaws.TestingDatatypes++data ShowLaw s++class Show s => ShowLaws s where++  showLaw  ::  Law (ShowLaw s)++  showLaw  =   defaultShowLaw++defaultShowLaw (d,x,r,s)  =  showsPrec d x r ++ s  =.=  showsPrec d x (r ++ s)++type instance LawArgs (ShowLaw s)  =  (Int, s, String, String)+type instance LawBody (ShowLaw s)  =  String++instance (ShowLaws s) => LawTest (ShowLaw s) where+  lawtest _  =  testEqual . showLaw+