Submission #1520009


Source Code Expand

main = interact $ f . read
 
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 263 Byte
Status CE

Compile Error

Main.hs:1:23:
    No instance for (Read a1) arising from a use of ‘read’
    The type variable ‘a1’ is ambiguous
    Note: there are several potential instances:
      instance (GHC.Arr.Ix a, Read a, Read b) => Read (GHC.Arr.Array a b)
        -- Defined in ‘GHC.Read’
      instance Read a => Read (Maybe a) -- Defined in ‘GHC.Read’
      instance (Integral a, Read a) => Read (GHC.Real.Ratio a)
        -- Defined in ‘GHC.Read’
      ...plus 25 others
    In the second argument of ‘(.)’, namely ‘read’
    In the second argument of ‘($)’, namely ‘f . read’
    In the expression: interact $ f . read

Main.hs:5:15:
    Couldn't match expected type ‘a -> [Char]’
                with actual type ‘[Char]’
    Relevant bindings include
      k :: a (bound at Main.hs:10:11)
      m :: a (bound at Main.hs:3:3)
      f :: a -> [Char] (bound at Main.hs:3:1)
    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’:
     ...