From 0dc33cafed11aa4574f740b244d96060008ec714 Mon Sep 17 00:00:00 2001 From: Akshay Date: Mon, 7 Dec 2020 12:13:52 +0530 Subject: shorten --- lib/Utils.hs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/Utils.hs') diff --git a/lib/Utils.hs b/lib/Utils.hs index 1eb42fc..4c9a581 100644 --- a/lib/Utils.hs +++ b/lib/Utils.hs @@ -4,6 +4,7 @@ module Utils ( binaryToInt , right , bet , (&+) + , howMany ) where import Data.Char (digitToInt) @@ -30,3 +31,6 @@ bet k (l, u) = k >= l && k <= u -- combine filter predicates (&+) :: (a -> Bool) -> (a -> Bool) -> (a -> Bool) (&+) = liftM2 (&&) + +howMany :: (a -> Bool) -> [a] -> Int +howMany predicate = length . filter ((== True) . predicate) -- cgit v1.2.3