locateSubstring :: Eq a => [a] -> [a] -> [Int]
locateSubstring needle haystack =
  map fst $ filter (\(i,s) -> needle `isPrefixOf` s) indexedTails
  where indexedTails = zip [0..] (tails haystack)
locateSubstring :: Eq a => [a] -> [a] -> [Int]
locateSubstring needle haystack =
  map fst $ filter (\(i,s) -> needle `isPrefixOf` s) indexedTails
  where indexedTails = zip [0..] (tails haystack)
locateSubstring needle haystack =
  map fst $ filter (\(i,s) -> needle `isPrefixOf` s) indexedTails
  where indexedTails = zip [0..] (tails haystack)