Skip to content

fix #9 missing SubTypes instance #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions qc-tests/Tests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import Test.SmartCheck.Types

--------------------------------------------------------------------------------

deriving instance Generic a => Generic (Tree a)
instance (SubTypes a, Generic a) => SubTypes (Tree a)
deriving instance Generic (Tree a)
instance (SubTypes a) => SubTypes (Tree a)

instance Q.Arbitrary a => Q.Arbitrary (Tree a) where
arbitrary = Q.sized mkT
Expand Down
28 changes: 24 additions & 4 deletions src/Test/SmartCheck/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,30 @@ instance (Show a, Q.Arbitrary a, SubTypes a, Typeable a) => GST (K1 i a) where
-- http://hackage.haskell.org/packages/archive/QuickCheck/2.4.2/doc/html/Test-QuickCheck-Arbitrary.html

instance SubTypes Bool where baseType _ = True
instance SubTypes Char where baseType _ = True
instance SubTypes Double where baseType _ = True
instance SubTypes Float where baseType _ = True
instance SubTypes Int where baseType _ = True
instance SubTypes Char where
subTypes _ = []
baseType _ = True
replaceChild = replaceChild'
toConstr = toConstr'
showForest = showForest'
instance SubTypes Double where
subTypes _ = []
baseType _ = True
replaceChild = replaceChild'
toConstr = toConstr'
showForest = showForest'
instance SubTypes Float where
subTypes _ = []
baseType _ = True
replaceChild = replaceChild'
toConstr = toConstr'
showForest = showForest'
instance SubTypes Int where
subTypes _ = []
baseType _ = True
replaceChild = replaceChild'
toConstr = toConstr'
showForest = showForest'
instance SubTypes Integer where
subTypes _ = []
baseType _ = True
Expand Down