dimanche 24 novembre 2019

Compiler aborts tests

So, once again i have tried to specify variables in functions, but it didn`t help.

functions:

> prop_unzip_check :: forall a b. Ord a => [(a,b)] -> Bool
> prop_unzip_check xs = length (unzip (xs::[(a,b)])) >= 0

and

> prop_merge_check :: forall a. Ord a => [a] -> [a] -> Bool
> prop_merge_check xs ys = length (merge (xs::[a]) (ys::[a])) == length (sort ((xs::[a]) ++ (ys::[a])))

And after compiling i receive this confusing error:

Test property "prop_merge_check" ... aborted. Reason: Ambiguous type variable a0' arising from a use ofquickCheckBool' prevents the constraint (Arbitrary a0)' from being solved. Probable fix: use a type annotation to specify whata0' should be. These potential instances exist: instance Arbitrary QCGen -- Defined in Test.QuickCheck.Arbitrary' instance Arbitrary (a b c) => Arbitrary (WrappedArrow a b c) -- Defined inTest.QuickCheck.Arbitrary' instance Arbitrary (m a) => Arbitrary (WrappedMonad m a) -- Defined in Test.QuickCheck.Arbitrary' ...plus 80 others (use -fprint-potential-instances to see them all) Ambiguous type variablea0' arising from a use of prop_merge_check' prevents the constraint(Ord a0)' from being solved. Probable fix: use a type annotation to specify what a0' should be. These potential instances exist: instance Ord (Encoding' a) -- Defined inData.Aeson.Encoding.Internal' instance Ord DotNetTime -- Defined in Data.Aeson.Types.Internal' instance Ord JSONPathElement -- Defined inData.Aeson.Types.Internal' ...plus 310 others (use -fprint-potential-instances to see them all)

Aucun commentaire:

Enregistrer un commentaire