Guest User

Untitled

a guest
Oct 19th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. module Main where
  2.  
  3. (.?.) :: Bool -> (a, a) -> a
  4. (.?.) True = fst
  5. (.?.) False = snd
  6.  
  7. infixl 3 .?.
  8.  
  9. (>:<) :: a -> b -> (a, b)
  10. (>:<) = (,)
  11.  
  12. main :: IO ()
  13. main = do
  14. print $ 3 == 5 .?. "yes" >:< "no" -- "no"
  15. print $ 5 > 3 .?. "yes" >:< "no" -- "yes"
  16. print $ 3 - 3 == 0 .?. "yes" >:< "no" -- "yes"
  17. print $ null [] .?. "yes" >:< "no" -- "yes"
  18. print $ null [1] .?. "yes" >:< "no" -- "no"
Add Comment
Please, Sign In to add comment