/ Haskell /

记录详情

Compile Error

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

/in/foo.hs:2:8: error:
    * Ambiguous type variable `t0' arising from a use of `readLn'
      prevents the constraint `(Read (t0 String))' from being solved.
      Probable fix: use a type annotation to specify what `t0' should be.
      These potential instances exist:
        instance (Read a, Read b) => Read (Either a b)
          -- Defined in `Data.Either'
        instance Read a => Read (Maybe a) -- Defined in `GHC.Read'
        instance (Read a, Read b) => Read (a, b) -- Defined in `GHC.Read'
        ...plus 14 others
        ...plus 18 instances involving out-of-scope types
        (use -fprint-potential-instances to see them all)
    * In a stmt of a 'do' block: t <- readLn
      In the expression:
        do { t <- readLn;
             putStrLn $ sum t }
      In an equation for `main':
          main
            = do { t <- readLn;
                   putStrLn $ sum t }

/in/foo.hs:3:16: error:
    * No instance for (Num String) arising from a use of `sum'
    * In the second argument of `($)', namely `sum t'
      In a stmt of a 'do' block: putStrLn $ sum t
      In the expression:
        do { t <- readLn;
             putStrLn $ sum t }

信息

递交者
类型
递交
题目
P1000 a+b
语言
Haskell
递交时间
2020-07-21 17:01:41
评测时间
2020-07-21 17:01:41
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes