Guest User

Untitled

a guest
Nov 19th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.96 KB | None | 0 0
  1. module Main where
  2.  
  3. import Data.Fixed
  4.  
  5. trip j 1 = if sqrt(j^2 + 1) mod' 1 == 0 then putStrLn j * k * sqrt(j^2 + k^2) else 1
  6. trip 1 k = if sqrt(1 + k^2) mod' 1 == 0 then putStrLn j * k * sqrt(j^2 + k^2) else 1
  7.  
  8. trip j k = if sqrt(j^2 + k^2) mod' 1 == 0 then putStrLn j * k * sqrt(j^2 + k^2) else (trip j-1 k) + (trip j k-1)
  9.  
  10. main = trip 1000 1000
  11.  
  12.  
  13. [1 of 1] Compiling Main ( 0009.hs, 0009.o )
  14.  
  15. 0009.hs:5:56: error:
  16. • Couldn't match type ‘(a -> a -> a) -> t -> a2’ with ‘[Char]’
  17. Expected type: String
  18. Actual type: (a -> a -> a) -> t -> a2
  19. • Probable cause: ‘j’ is applied to too few arguments
  20. In the first argument of ‘putStrLn’, namely ‘j’
  21. In the first argument of ‘(*)’, namely ‘putStrLn j’
  22. In the first argument of ‘(*)’, namely ‘putStrLn j * k’
  23. • Relevant bindings include
  24. j :: (a -> a -> a) -> t -> a2 (bound at 0009.hs:5:6)
  25. trip :: ((a -> a -> a) -> t -> a2)
  26. -> ((a -> a -> a) -> t -> a2) -> IO ()
  27. (bound at 0009.hs:5:1)
  28. |
  29. 5 | trip j 1 = if sqrt(j^2 + 1) mod' 1 == 0 then putStrLn j * k * sqrt(j^2 + k^2) else 1
  30. | ^
  31.  
  32. 0009.hs:5:60: error: Variable not in scope: k :: IO ()
  33. |
  34. 5 | trip j 1 = if sqrt(j^2 + 1) mod' 1 == 0 then putStrLn j * k * sqrt(j^2 + k^2) else 1
  35. | ^
  36.  
  37. 0009.hs:5:64: error:
  38. • Couldn't match expected type ‘IO ()’
  39. with actual type ‘(a -> a -> a) -> t -> a2’
  40. • Probable cause: ‘sqrt’ is applied to too few arguments
  41. In the second argument of ‘(*)’, namely ‘sqrt (j ^ 2 + k ^ 2)’
  42. In the expression: putStrLn j * k * sqrt (j ^ 2 + k ^ 2)
  43. In the expression:
  44. if sqrt (j ^ 2 + 1) mod' 1 == 0 then
  45. putStrLn j * k * sqrt (j ^ 2 + k ^ 2)
  46. else
  47. 1
  48. • Relevant bindings include
  49. j :: (a -> a -> a) -> t -> a2 (bound at 0009.hs:5:6)
  50. trip :: ((a -> a -> a) -> t -> a2)
  51. -> ((a -> a -> a) -> t -> a2) -> IO ()
  52. (bound at 0009.hs:5:1)
  53. |
  54. 5 | trip j 1 = if sqrt(j^2 + 1) mod' 1 == 0 then putStrLn j * k * sqrt(j^2 + k^2) else 1
  55. | ^^^^^^^^^^^^^^^
  56.  
  57. 0009.hs:5:75: error:
  58. Variable not in scope: k :: (a -> a -> a) -> t -> a2
  59. |
  60. 5 | trip j 1 = if sqrt(j^2 + 1) mod' 1 == 0 then putStrLn j * k * sqrt(j^2 + k^2) else 1
  61. | ^
  62.  
  63. 0009.hs:6:56: error: Variable not in scope: j :: String
  64. |
  65. 6 | trip 1 k = if sqrt(1 + k^2) mod' 1 == 0 then putStrLn j * k * sqrt(j^2 + k^2) else 1
  66. | ^
  67.  
  68. 0009.hs:6:60: error:
  69. • Couldn't match expected type ‘IO ()’
  70. with actual type ‘(a -> a -> a) -> t -> a2’
  71. • Probable cause: ‘k’ is applied to too few arguments
  72. In the second argument of ‘(*)’, namely ‘k’
  73. In the first argument of ‘(*)’, namely ‘putStrLn j * k’
  74. In the expression: putStrLn j * k * sqrt (j ^ 2 + k ^ 2)
  75. • Relevant bindings include
  76. k :: (a -> a -> a) -> t -> a2 (bound at 0009.hs:6:8)
  77. trip :: ((a -> a -> a) -> t -> a2)
  78. -> ((a -> a -> a) -> t -> a2) -> IO ()
  79. (bound at 0009.hs:5:1)
  80. |
  81. 6 | trip 1 k = if sqrt(1 + k^2) mod' 1 == 0 then putStrLn j * k * sqrt(j^2 + k^2) else 1
  82. | ^
  83.  
  84. 0009.hs:6:64: error:
  85. • Couldn't match expected type ‘IO ()’
  86. with actual type ‘(a -> a -> a) -> t -> a2’
  87. • Probable cause: ‘sqrt’ is applied to too few arguments
  88. In the second argument of ‘(*)’, namely ‘sqrt (j ^ 2 + k ^ 2)’
  89. In the expression: putStrLn j * k * sqrt (j ^ 2 + k ^ 2)
  90. In the expression:
  91. if sqrt (1 + k ^ 2) mod' 1 == 0 then
  92. putStrLn j * k * sqrt (j ^ 2 + k ^ 2)
  93. else
  94. 1
  95. • Relevant bindings include
  96. k :: (a -> a -> a) -> t -> a2 (bound at 0009.hs:6:8)
  97. trip :: ((a -> a -> a) -> t -> a2)
  98. -> ((a -> a -> a) -> t -> a2) -> IO ()
  99. (bound at 0009.hs:5:1)
  100. |
  101. 6 | trip 1 k = if sqrt(1 + k^2) mod' 1 == 0 then putStrLn j * k * sqrt(j^2 + k^2) else 1
  102. | ^^^^^^^^^^^^^^^
  103.  
  104. 0009.hs:6:69: error:
  105. Variable not in scope: j :: (a -> a -> a) -> t -> a2
  106. |
  107. 6 | trip 1 k = if sqrt(1 + k^2) mod' 1 == 0 then putStrLn j * k * sqrt(j^2 + k^2) else 1
  108. | ^
  109.  
  110. 0009.hs:8:58: error:
  111. • Couldn't match type ‘(a -> a -> a) -> t -> a2’ with ‘[Char]’
  112. Expected type: String
  113. Actual type: (a -> a -> a) -> t -> a2
  114. • Probable cause: ‘j’ is applied to too few arguments
  115. In the first argument of ‘putStrLn’, namely ‘j’
  116. In the first argument of ‘(*)’, namely ‘putStrLn j’
  117. In the first argument of ‘(*)’, namely ‘putStrLn j * k’
  118. • Relevant bindings include
  119. k :: (a -> a -> a) -> t -> a2 (bound at 0009.hs:8:8)
  120. j :: (a -> a -> a) -> t -> a2 (bound at 0009.hs:8:6)
  121. trip :: ((a -> a -> a) -> t -> a2)
  122. -> ((a -> a -> a) -> t -> a2) -> IO ()
  123. (bound at 0009.hs:5:1)
  124. |
  125. 8 | trip j k = if sqrt(j^2 + k^2) mod' 1 == 0 then putStrLn j * k * sqrt(j^2 + k^2) else (trip j-1 k) + (trip j k-1)
  126. | ^
  127.  
  128. 0009.hs:8:62: error:
  129. • Couldn't match expected type ‘IO ()’
  130. with actual type ‘(a -> a -> a) -> t -> a2’
  131. • Probable cause: ‘k’ is applied to too few arguments
  132. In the second argument of ‘(*)’, namely ‘k’
  133. In the first argument of ‘(*)’, namely ‘putStrLn j * k’
  134. In the expression: putStrLn j * k * sqrt (j ^ 2 + k ^ 2)
  135. • Relevant bindings include
  136. k :: (a -> a -> a) -> t -> a2 (bound at 0009.hs:8:8)
  137. j :: (a -> a -> a) -> t -> a2 (bound at 0009.hs:8:6)
  138. trip :: ((a -> a -> a) -> t -> a2)
  139. -> ((a -> a -> a) -> t -> a2) -> IO ()
  140. (bound at 0009.hs:5:1)
  141. |
  142. 8 | trip j k = if sqrt(j^2 + k^2) mod' 1 == 0 then putStrLn j * k * sqrt(j^2 + k^2) else (trip j-1 k) + (trip j k-1)
  143. | ^
  144.  
  145. 0009.hs:8:66: error:
  146. • Couldn't match expected type ‘IO ()’
  147. with actual type ‘(a -> a -> a) -> t -> a2’
  148. • Probable cause: ‘sqrt’ is applied to too few arguments
  149. In the second argument of ‘(*)’, namely ‘sqrt (j ^ 2 + k ^ 2)’
  150. In the expression: putStrLn j * k * sqrt (j ^ 2 + k ^ 2)
  151. In the expression:
  152. if sqrt (j ^ 2 + k ^ 2) mod' 1 == 0 then
  153. putStrLn j * k * sqrt (j ^ 2 + k ^ 2)
  154. else
  155. (trip j - 1 k) + (trip j k - 1)
  156. • Relevant bindings include
  157. k :: (a -> a -> a) -> t -> a2 (bound at 0009.hs:8:8)
  158. j :: (a -> a -> a) -> t -> a2 (bound at 0009.hs:8:6)
  159. trip :: ((a -> a -> a) -> t -> a2)
  160. -> ((a -> a -> a) -> t -> a2) -> IO ()
  161. (bound at 0009.hs:5:1)
  162. |
  163. 8 | trip j k = if sqrt(j^2 + k^2) mod' 1 == 0 then putStrLn j * k * sqrt(j^2 + k^2) else (trip j-1 k) + (trip j k-1)
  164. | ^^^^^^^^^^^^^^^
  165.  
  166. 0009.hs:8:87: error:
  167. • Couldn't match expected type ‘IO ()’
  168. with actual type ‘((a -> a -> a) -> t -> a2) -> IO ()’
  169. • Probable cause: ‘(+)’ is applied to too few arguments
  170. In the expression: (trip j - 1 k) + (trip j k - 1)
  171. In the expression:
  172. if sqrt (j ^ 2 + k ^ 2) mod' 1 == 0 then
  173. putStrLn j * k * sqrt (j ^ 2 + k ^ 2)
  174. else
  175. (trip j - 1 k) + (trip j k - 1)
  176. In an equation for ‘trip’:
  177. trip j k
  178. = if sqrt (j ^ 2 + k ^ 2) mod' 1 == 0 then
  179. putStrLn j * k * sqrt (j ^ 2 + k ^ 2)
  180. else
  181. (trip j - 1 k) + (trip j k - 1)
  182. • Relevant bindings include
  183. k :: (a -> a -> a) -> t -> a2 (bound at 0009.hs:8:8)
  184. j :: (a -> a -> a) -> t -> a2 (bound at 0009.hs:8:6)
  185. trip :: ((a -> a -> a) -> t -> a2)
  186. -> ((a -> a -> a) -> t -> a2) -> IO ()
  187. (bound at 0009.hs:5:1)
  188. |
  189. 8 | trip j k = if sqrt(j^2 + k^2) mod' 1 == 0 then putStrLn j * k * sqrt(j^2 + k^2) else (trip j-1 k) + (trip j k-1)
  190. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  191.  
  192. 0009.hs:8:103: error:
  193. • Couldn't match expected type ‘((a -> a -> a) -> t -> a2)
  194. -> IO ()’
  195. with actual type ‘IO ()’
  196. • Possible cause: ‘(-)’ is applied to too many arguments
  197. In the second argument of ‘(+)’, namely ‘(trip j k - 1)’
  198. In the expression: (trip j - 1 k) + (trip j k - 1)
  199. In the expression:
  200. if sqrt (j ^ 2 + k ^ 2) mod' 1 == 0 then
  201. putStrLn j * k * sqrt (j ^ 2 + k ^ 2)
  202. else
  203. (trip j - 1 k) + (trip j k - 1)
  204. • Relevant bindings include
  205. k :: (a -> a -> a) -> t -> a2 (bound at 0009.hs:8:8)
  206. j :: (a -> a -> a) -> t -> a2 (bound at 0009.hs:8:6)
  207. trip :: ((a -> a -> a) -> t -> a2)
  208. -> ((a -> a -> a) -> t -> a2) -> IO ()
  209. (bound at 0009.hs:5:1)
  210. |
  211. 8 | trip j k = if sqrt(j^2 + k^2) mod' 1 == 0 then putStrLn j * k * sqrt(j^2 + k^2) else (trip j-1 k) + (trip j k-1)
  212. | ^^^^^^^^^^
  213.  
  214. 0009.hs:10:13: error:
  215. • No instance for (Num ((a0 -> a0 -> a0) -> t0 -> a1))
  216. arising from the literal ‘1000’
  217. (maybe you haven't applied a function to enough arguments?)
  218. • In the first argument of ‘trip’, namely ‘1000’
  219. In the expression: trip 1000 1000
  220. In an equation for ‘main’: main = trip 1000 1000
  221. |
  222. 10 | main = trip 1000 1000
Add Comment
Please, Sign In to add comment