Created
July 7, 2015 11:36
-
-
Save Baccata/c269430d279cd2406375 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
main = putStrLn (show (fforall (\x -> (x >= -1000)) (setInt))) | |
type Set a = a -> Bool | |
setInt :: Set Int | |
setInt = \x -> True | |
--filtering the range with the set function and checking if all elements from the set satisfy the predicate | |
fforall :: Restrict a => (a -> Bool) -> Set a -> Bool | |
fforall pred set = all pred (filter set range) | |
-- Typeclass used to restrict the forall search to a given list of items | |
class Restrict a where | |
range :: [a] | |
instance Restrict Int where | |
range = [-1000 .. 1000] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment