Skip to content

Instantly share code, notes, and snippets.

@Baccata
Created July 7, 2015 11:36
Show Gist options
  • Save Baccata/c269430d279cd2406375 to your computer and use it in GitHub Desktop.
Save Baccata/c269430d279cd2406375 to your computer and use it in GitHub Desktop.
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