All pastes #158477 Raw Edit

freeone3000

public text v1 · immutable
·published 2006-09-02 04:26 UTC
rendered paste body
indexof :: [Char]->Char->Integer -> Integer
indexof [] _ _  = -1
indexof (x:xs) c i      | x == c        =       i
                        | x < c         =       indexof xs c i+1
                        | x > c         =       indexof xs c i+1

main    = putStr(indexof("foo" 'o' 0))

--Error
testcalc.hs:7:17:
    Expecting a function type, but found `[Char]'
      Expected type: String
      Inferred type: Char -> Integer -> Integer
    Probable cause: `indexof' is applied to too few arguments in the call
        (indexof ("foo" 'o' 0))
    In the first argument of `putStr', namely `(indexof ("foo" 'o' 0))'