coverage 0.1.0.1 → 0.1.0.2
raw patch · 6 files changed
+16/−16 lines, 6 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Coverage: NotRedundant :: a -> Redundant a
+ Coverage: NotRedundant :: Redundant a
- Coverage: Redundant :: Redundant a
+ Coverage: Redundant :: a -> Redundant a
- Coverage.Internal: NotRedundant :: a -> Redundant a
+ Coverage.Internal: NotRedundant :: Redundant a
- Coverage.Internal: Redundant :: Redundant a
+ Coverage.Internal: Redundant :: a -> Redundant a
Files
- coverage.cabal +1/−1
- examples/Nat.hs +1/−1
- examples/Tree.hs +1/−1
- src/Coverage.hs +3/−3
- src/Coverage/Internal.hs +8/−8
- tests/CoverageUnitSpec.hs +2/−2
coverage.cabal view
@@ -1,5 +1,5 @@ name: coverage-version: 0.1.0.1+version: 0.1.0.2 synopsis: Exhaustivity Checking Library homepage: https://github.com/nicodelpiano/coverage bug-reports: https://github.com/nicodelpiano/coverage/issues
examples/Nat.hs view
@@ -56,5 +56,5 @@ fromBinder = map binderToNat - fromRedundant (NotRedundant bs) = bs+ fromRedundant (Redundant bs) = bs fromRedundant _ = []
examples/Tree.hs view
@@ -66,5 +66,5 @@ fromBinder = map binderToTree - fromRedundant (NotRedundant bs) = bs+ fromRedundant (Redundant bs) = bs fromRedundant _ = []
src/Coverage.hs view
@@ -35,7 +35,7 @@ check :: (Eq lit) => Environment -> [Alternative lit] -> Check lit check env cas = applyRedundant (fmap nub) . applyUncovered nub . foldl' step initial $ cas where- initial = makeCheck [initialize $ length . fst . head $ cas] $ NotRedundant []+ initial = makeCheck [initialize $ length . fst . head $ cas] $ Redundant [] step :: (Eq lit) => Check lit -> Alternative lit -> Check lit step ch ca =@@ -46,5 +46,5 @@ where mr :: Redundant [Binders lit] -> Maybe Bool mr DontKnow = Nothing- mr Redundant = Just False- mr (NotRedundant _) = Just True+ mr NotRedundant = Just False+ mr (Redundant _) = Just True
src/Coverage/Internal.hs view
@@ -65,22 +65,22 @@ type Alternative lit = (Binders lit, Maybe Guard) -- | Data-type for redundant cases representation.-data Redundant a = DontKnow | Redundant | NotRedundant a+data Redundant a = DontKnow | NotRedundant | Redundant a deriving (Show, Eq) -- | Functor instance for Redundant (TODO: proofs). instance Functor Redundant where- fmap _ DontKnow = DontKnow- fmap _ Redundant = Redundant- fmap f (NotRedundant r) = NotRedundant $ f r+ fmap _ DontKnow = DontKnow+ fmap _ NotRedundant = NotRedundant+ fmap f (Redundant r) = Redundant $ f r -- | Applicative instance for Redundant. instance Applicative Redundant where- pure = NotRedundant+ pure = Redundant - DontKnow <*> _ = DontKnow- Redundant <*> _ = Redundant- (NotRedundant f) <*> m = fmap f m+ DontKnow <*> _ = DontKnow+ NotRedundant <*> _ = NotRedundant+ (Redundant f) <*> m = fmap f m -- | Check wraps both uncovered and redundant cases. data Check lit = Check
tests/CoverageUnitSpec.hs view
@@ -59,7 +59,7 @@ tagged_def6 :: [Alternative ()] tagged_def6 = [([wildcard, wildcard, wildcard], Nothing), ([z, z, z], Nothing)] -fromRedundant (NotRedundant bs) = bs+fromRedundant (Redundant bs) = bs fromRedundant _ = [] lit_def1 :: [Alternative String]@@ -122,7 +122,7 @@ (getUncovered $ check env record_def1) `shouldBe` [] it "product_def2 is not exhaustive" $ do- (getUncovered $ check env record_def1) `shouldBe` []+ (getUncovered $ check env record_def2) `shouldBe` [[Record [("bar", s wildcard), ("foo", s wildcard)]], [Record [("bar", wildcard), ("foo", s $ s wildcard)]]] main :: IO () main = hspec spec