Advertisement
Guest User

KedvencModulunkKedvencViccesViktorunknak

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