Advertisement
Guest User

KedvencModulunkKedvencViccesViktorunknak

a guest
Dec 5th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. module KedvencModulunkKedvencViccesViktorunknak where
  2.  
  3. import Data.List
  4. import Data.Char
  5.  
  6. data Time = T Int Int
  7. deriving (Eq)
  8.  
  9. t :: Int -> Int -> Bool
  10. t h m
  11. | (h < 24) && (h >= 0) && (m < 60) && (m >= 0) = True
  12. | otherwise = error "Az idő formáatuma nem megfelelő"
  13.  
  14.  
  15. instance Show Time where
  16.  
  17. show (T a b) = a ":" b
  18.  
  19.  
  20. isEarlier :: (T Int, Int) (T Int, Int) -> Bool
  21. isEarlier (T h1 m1) (T h2 m2)
  22. | (h1 < h2) = True
  23. | (h1 == h2) && (m1 < m2) = True
  24. | otherwise = False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement