Point-free disjoint
authorNeil Smith <NeilNjae@users.noreply.github.com>
Sun, 4 Dec 2022 10:42:20 +0000 (10:42 +0000)
committerNeil Smith <NeilNjae@users.noreply.github.com>
Sun, 4 Dec 2022 10:42:20 +0000 (10:42 +0000)
advent04/Main.hs

index 456b157c6af47a8eda8d32d7b6bbace22c1b2540..a295abfe1bfb30d8249c1fd39c499a2e3ef7ab74 100644 (file)
@@ -40,13 +40,14 @@ hasContainment (assignment1, assignment2) =
 disjoint (assignment1, assignment2) = 
   (assignment1 `before` assignment2) || (assignment2 `before` assignment1)
 
-overlaps pair = not $ disjoint pair
+overlaps = not . disjoint
 
 contains, before :: Assignment -> Assignment -> Bool
 contains (Assignment lower1 upper1) (Assignment lower2 upper2) =
   (lower1 <= lower2) && (upper1 >= upper2)
 
-before (Assignment _lower1 upper1) (Assignment lower2 _upper2) = (upper1 < lower2) 
+before (Assignment _lower1 upper1) (Assignment lower2 _upper2) = 
+  (upper1 < lower2) 
 
 -- Parse the input file