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))