Submission #1520011


Source Code Expand

main = interact $ f . read
 
f :: Int -> String
f m
    | m < 100 = "00"
    | k < 1 = '0' : show $ m `div` 100
    | k <= 5 = show $ m `div` 100
    | k <= 30 = show $ 50 + k
    | k <= 70 = show . (+ 80) . (`div` 5) $ k - 30
    | k > 70 = "89"
    where k = m `div` 1000

Submission Info

Submission Time
Task B - 視程の通報
User Gash788
Language Haskell (GHC 7.10.3)
Score 0
Code Size 283 Byte
Status CE

Compile Error

Main.hs:6:15:
    Couldn't match expected type ‘Int -> String’
                with actual type ‘[Char]’
    The first argument of ($) takes one argument,
    but its type ‘[Char]’ has none
    In the expression: '0' : show $ m `div` 100
    In an equation for ‘f’:
        f m
          | m < 100 = "00"
          | k < 1 = '0' : show $ m `div` 100
          | k <= 5 = show $ m `div` 100
          | k <= 30 = show $ 50 + k
          | k <= 70 = show . (+ 80) . (`div` 5) $ k - 30
          | k > 70 = "89"
          where
              k = m `div` 1000

Main.hs:6:21:
    Couldn't match expected type ‘[Char]’
                with actual type ‘a0 -> String’
    Probable cause: ‘show’ is applied to too few arguments
    In the second argument of ‘(:)’, namely ‘show’
    In the expression: '0' : show