30 lines
594 B
Haskell
30 lines
594 B
Haskell
module Main where
|
|
|
|
import Data.Char
|
|
import Data.List
|
|
import Test.QuickCheck
|
|
|
|
capitalizeWord :: String -> String
|
|
capitalizeWord [] = []
|
|
capitalizeWord (x:xs) = toUpper x : xs
|
|
|
|
twice :: (a -> a) -> (a -> a)
|
|
twice y = y . y
|
|
|
|
fourTimes :: (a -> a) -> (a -> a)
|
|
fourTimes = twice . twice
|
|
|
|
f :: String -> Bool
|
|
f x =
|
|
(capitalizeWord x == twice capitalizeWord x)
|
|
&& (capitalizeWord x == fourTimes capitalizeWord x)
|
|
|
|
f' :: Ord a => [a] -> Bool
|
|
f' x =
|
|
(sort x == twice sort x)
|
|
&& (sort x == fourTimes sort x)
|
|
|
|
main :: IO ()
|
|
main = do
|
|
quickCheck f
|
|
quickCheck (f' :: String -> Bool) |