fork download
  1.  
  2.  
  3.  
  4. obtenerMinutos :: (String, Int, Int, Int) -> Int
  5. obtenerMinutos (w, x, y, z) = (y*60)+z
  6.  
  7. diff :: (String, Int, Int, Int) -> (String, Int, Int, Int) -> Int
  8. diff x y | (obtenerMinutos x) > (obtenerMinutos y) = (obtenerMinutos x) - (obtenerMinutos y)
  9. | otherwise = (obtenerMinutos y) - (obtenerMinutos x)
  10.  
  11.  
  12. obtenerDiaTrabajado :: (String, Int,Int,Int) -> Int
  13. obtenerDiaTrabajado (w, x, y, z) = x
  14.  
  15. obtenerNombre :: (String, Int,Int,Int) -> String
  16. obtenerNombre (w, x, y, z) = w
  17.  
  18. obtListaDiasTrabajados :: [(String, Int, Int, Int)] -> String -> [Int]
  19. obtListaDiasTrabajados [] _ = []
  20. obtListaDiasTrabajados (x:xs) y | obtenerNombre x == y = (obtenerDiaTrabajado x):obtListaDiasTrabajados xs y
  21. | otherwise = obtListaDiasTrabajados xs y
  22.  
  23. intermedio :: Int -> Int ->[Int]
  24. intermedio x y | x < (y-1) = (x+1) : intermedio (x+1) y
  25. | otherwise = []
  26.  
  27.  
  28. listaDesde :: Int -> [Int]
  29. listaDesde 0 = []
  30. listaDesde x = x:listaDesde(x-1)
  31.  
  32.  
  33. ultimo :: [Int] -> Int
  34. ultimo [x] = x
  35. ultimo (x:xs) = ultimo xs
  36.  
  37. noElUltimo :: [Int] -> [Int]
  38. noElUltimo [x] = []
  39. noElUltimo (x:xs) = x:noElUltimo xs
  40.  
  41. invertir :: [Int] -> [Int]
  42. invertir [] = []
  43. invertir x = (ultimo x):(invertir(noElUltimo x))
  44.  
  45. hastaTreinta:: Int -> [Int]
  46. hastaTreinta x | x <= 30 = x:hastaTreinta (x+1)
  47. | otherwise = []
  48.  
  49.  
  50. ausencias:: [(String, Int, Int, Int)] -> String -> [Int]
  51. ausencias x y = listaAusencias (obtListaDiasTrabajados x y)
  52.  
  53. listaAusencias:: [Int] -> [Int]
  54. listaAusencias [] = []
  55. --listaAusencias [x]:[] = hastaTreinta x
  56. --listaAusencias x = intermedios (0:x)
  57.  
  58. jornal:: Integer -> Integer
  59. jornal x | (x<8) && (odd x) = 15
  60. | (x>=8) && (even x) = 15
  61. | otherwise = 13
  62.  
  63. presentismo:: [Int] -> Int
  64. presentismo x | (length x)<3 = 150
  65. | otherwise = 0
  66.  
  67. puntualidad :: [(String, Int, Int, Int)] -> String -> Int
  68. puntualidad x y | (llegoTarde (obtHHMM x y) (obtHMIngreso horarioIngreso y)) == True = 0
  69. | otherwise = 100
  70.  
  71. llegoTarde::[Int] -> Int -> Bool
  72. llegoTarde [] _ = True
  73. llegoTarde (x:xs) y | abs(x-y) > 20 = False
  74. | otherwise = llegoTarde xs y
  75.  
  76. obtHHMM::[(String, Int, Int, Int)] -> String -> [Int]
  77. obtHHMM [] _ = []
  78. obtHHMM (x:xs) y | obtenerNombre x == y = ((obtHora x)* 60 + obtMin x): obtHHMM xs y
  79. | otherwise = obtHHMM xs y
  80.  
  81. obtHora :: (String, Int,Int,Int) -> Int
  82. obtHora (w, x, y, z) = y
  83.  
  84. obtMin :: (String, Int,Int,Int) -> Int
  85. obtMin (w, x, y, z) = z
  86.  
  87. obtHMIngreso :: [(String, Int, Int)] -> String -> Int
  88. obtHMIngreso [] _ = 0
  89. obtHMIngreso (x:xs) y | obtenerNombre2 x == y = obtMinTresUpla x
  90. | otherwise = obtHMIngreso xs y
  91.  
  92. obtMinTresUpla:: (String, Int, Int) -> Int
  93. obtMinTresUpla (x,y,z) = (y*60)+z
  94.  
  95. obtenerNombre2:: (String, Int, Int) -> String
  96. obtenerNombre2 (x,y,z) = x
  97.  
  98. horarioIngreso :: [(String, Int, Int)]
  99. horarioIngreso = [("pepe", 9, 0),("marcelo", 10, 15),("dario", 7, 30)]
  100.  
  101. enero = 1
  102. febrero = 2
  103. marzo = 3
  104. abril = 4
  105. mayo= 5
  106. junio = 6
  107. julio = 7
  108. agosto = 8
  109. septiembre = 9
  110. octubre = 10
  111. noviembre = 11
  112. diciembre = 12
  113.  
  114. sectores:: [(String, [String])]
  115. sectores = [("administrativo", ["contaduria", "facturacion", "proveedores"])]
  116.  
  117. --getRol::[(String, [String])] -> String -> [String]
  118. --getRol [] _ = []
  119. --getRol (x:xs) y | (obtNomRol x) == y = (obtRoles x): getRol xs y
  120. -- | otherwise = getRol xs y
  121.  
  122.  
  123. obtNomRol:: (String, [String]) -> String
  124. obtNomRol (x,y) = x
  125.  
  126. obtRoles:: (String, [String]) -> [String]
  127. obtRoles (x,y) = y
  128.  
  129. getNomSector:: (String, [String]) -> String
  130. getNomSector (x,y) = x
  131.  
  132. getSectores:: (String, [String]) -> [String]
  133. getSectores (x,y) = y
  134.  
  135. --getSector:: [(String, [String])] -> [String] -> [String]
  136. --getSector (x:xs) (y:ys) | (getNomSector x) == y = (getSectores x):(getSector xs ys)
  137. -- | otherwise = getSector xs (y:ys)
  138.  
  139.  
  140. quitaRepetidos :: String -> [String] -> [String]
  141. quitaRepetidos _ [] = []
  142. quitaRepetidos x (y:ys) | x/=y = y:quitaRepetidos x ys
  143. | otherwise = quitaRepetidos x ys
  144.  
  145. procesarSectores::[String] -> [String]
  146. procesarSectores []= []
  147. procesarSectores (x:xs) = x:procesarSectores(quitaRepetidos x xs)
  148.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
[1 of 1] Compiling Main             ( prog.hs, prog.o )

prog.hs:1:0: The function `main' is not defined in module `Main'
stdout
Standard output is empty