Tritlo / PropR

Genetic program repair using GHC
MIT License
30 stars 2 forks source link

[Bugfix] Handle ambiguous types #81

Closed Tritlo closed 3 years ago

Tritlo commented 3 years ago

Sometimes the type annotations are not enough:

prop_anyBlockBlah :: Int -> Bool
prop_anyBlockBlah r
  | r < 0 = True
  | r == 9 = True
  | otherwise = not (isOkayBlock [Nothing | _ <- [0 .. r]])

here the type of the list isn't actually constrained by the property at all! It's constrained by isOkayBlock... but the type of that might vary as we fix! So we introduce -XPartialTypeSignatures and give our wrapped properties a type:

prop'_anyBlockBlah :: _ -> Int -> Bool
prop'_anyBlockBlah isOkayBlock r
  | r < 0 = True
  | r == 9 = True
  | otherwise = not (isOkayBlock [Nothing | _ <- [0 .. r]])

which, in conjucnction with the property being applied to expr__isOkayBlock is enough to determine the type!

Tritlo commented 3 years ago

Uff, CI just does not want to run :(