Wandbox
SettingsLog
SettingsLog
Language
GitHubLogin
Ran/Viewed Log

Author

anonymous

over 7 years ago

Language

Haskell

Compiler

ghc 8.2.1

Options
Warnings

Author

anonymous

over 7 years ago

$ ghc prog.hs -o prog.exe -Wall
[1 of 1] Compiling Main             ( prog.hs, prog.o )

prog.hs:4:10: error:
    • Couldn't match expected type ‘[t]’
                  with actual type ‘[t0] -> [t0]’
    • Probable cause: ‘f’ is applied to too few arguments
      In the expression: f xs
      In the expression: if p x then f xs else as
      In an equation for ‘f’: f p as@(x : xs) = if p x then f xs else as
    • Relevant bindings include
        xs :: [t] (bound at prog.hs:2:11)
        x :: t (bound at prog.hs:2:9)
        as :: [t] (bound at prog.hs:2:5)
        p :: t -> Bool (bound at prog.hs:2:3)
        f :: (t -> Bool) -> [t] -> [t] (bound at prog.hs:2:1)
  |
4 |     then f xs
  |          ^^^^

prog.hs:4:12: error:
    • Couldn't match expected type ‘t0 -> Bool’ with actual type ‘[t]’
    • In the first argument of ‘f’, namely ‘xs’
      In the expression: f xs
      In the expression: if p x then f xs else as
    • Relevant bindings include
        xs :: [t] (bound at prog.hs:2:11)
        x :: t (bound at prog.hs:2:9)
        as :: [t] (bound at prog.hs:2:5)
        p :: t -> Bool (bound at prog.hs:2:3)
        f :: (t -> Bool) -> [t] -> [t] (bound at prog.hs:2:1)
  |
4 |     then f xs
  |            ^^
Exit Code:
1