Determine if a string has all unique characters: Difference between revisions

Content added Content deleted
Line 454: Line 454:
go [] = Nothing
go [] = Nothing
go [_] = Nothing
go [_] = Nothing
go ((c, i):xs) =
go ((c, i):cs) =
maybe (go xs) (\(x, j) -> Just (x, [i, j])) (find ((c ==) . fst) xs)
maybe (go cs) (\(x, j) -> Just (x, [i, j])) (find ((c ==) . fst) cs)