记录详情

Compile Error

[1 of 1] Compiling Main             ( /in/foo.hs, /tmp/Main.o )

/in/foo.hs:1:19: error:
    * Couldn't match expected type `Int -> [a0]'
                  with actual type `[a1]'
    * The function `solve' is applied to one argument,
      but its type `[a1]' has none
      In the first argument of `(!!)', namely `solve p'
      In the expression: solve p !! (n - p)

/in/foo.hs:1:35: error:
    * Couldn't match type `[b0]' with `Int'
      Expected type: String -> Int
        Actual type: String -> [b0]
    * In the second argument of `(.)', namely `map read . words'
      In the second argument of `(.)', namely
        `(\ n p -> solve p !! (n - p)) . map read . words'
      In the first argument of `(=<<)', namely
        `print . (\ n p -> solve p !! (n - p)) . map read . words'

/in/foo.hs:2:9: error:
    * Couldn't match expected type `[a]'
                  with actual type `Integer -> [Integer]'
    * In an equation for `main':
          main
            = print . (\ n p -> solve p !! (n - p)) . map read . words
              =<< getLine
            where
                solve y = (y * 2) : zipWith (+) (tail solve x y) [y .. ]
    * Relevant bindings include solve :: [a] (bound at /in/foo.hs:2:9)

/in/foo.hs:2:34: error:
    * Couldn't match expected type `t0 -> Integer -> [Integer]'
                  with actual type `[a]'
    * The function `tail' is applied to three arguments,
      but its type `[a] -> [a]' has only one
      In the second argument of `zipWith', namely `(tail solve x y)'
      In the second argument of `(:)', namely
        `zipWith (+) (tail solve x y) [y .. ]'
    * Relevant bindings include solve :: [a] (bound at /in/foo.hs:2:9)

/in/foo.hs:2:45: error: Variable not in scope: x

信息

递交者
类型
自测
题目
平面分割(surface.pas/c/cpp)
语言
Haskell
递交时间
2017-11-27 12:59:42
评测时间
2019-01-10 22:28:39
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes