Either.hs 772 B

1234567891011121314151617181920212223242526272829
  1. module Internal.Utils.Either ( tests ) where
  2. import Agda.Utils.Either
  3. import Internal.Helpers
  4. ------------------------------------------------------------------------------
  5. prop_allRight :: Eq b => [Either t b] -> Bool
  6. prop_allRight xs =
  7. allRight xs ==
  8. if all isRight xs then
  9. Just $ map (\ (Right x) -> x) xs
  10. else
  11. Nothing
  12. ------------------------------------------------------------------------
  13. -- * All tests
  14. ------------------------------------------------------------------------
  15. -- (ASR 2018-01-06) Since the property has a type signature we cannot
  16. -- use 'allProperties' for collecting it.
  17. tests :: TestTree
  18. tests = testGroup "Internal.Utils.Either"
  19. [ testProperty "prop_allRight" (prop_allRight :: [Either Integer Bool] -> Bool)
  20. ]