From cc2498fd603a85d33fd9efa5e15ccda09d4a1547 Mon Sep 17 00:00:00 2001 From: Harry Garrood Date: Fri, 10 Jul 2015 20:42:27 +0100 Subject: [PATCH] Docs updates * Fix a mistake in docs for stripPrefix * Update all remaining references to -1 (replaced by Maybe), fixes #33 --- docs/Data/String.md | 6 +++--- src/Data/String.purs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/Data/String.md b/docs/Data/String.md index d894dd2..b5f4771 100644 --- a/docs/Data/String.md +++ b/docs/Data/String.md @@ -86,8 +86,8 @@ stripPrefix :: String -> String -> Maybe String If the string starts with the given prefix, return the portion of the string left after removing it, as a Just value. Otherwise, return Nothing. -* `stripPrefix "http:" "http://purescript.org" == Just "//purescript.org" -* `stripPrefix "http:" "https://purescript.org" == Nothing +* `stripPrefix "http:" "http://purescript.org" == Just "//purescript.org"` +* `stripPrefix "http:" "https://purescript.org" == Nothing` #### `fromCharArray` @@ -131,7 +131,7 @@ lastIndexOf :: String -> String -> Maybe Int ``` Returns the index of the last occurrence of the first string in the -second string. Returns `-1` if there is no match. +second string. Returns `Nothing` if there is no match. #### `lastIndexOf'` diff --git a/src/Data/String.purs b/src/Data/String.purs index 2e62a7e..da56098 100644 --- a/src/Data/String.purs +++ b/src/Data/String.purs @@ -97,8 +97,8 @@ dropWhile p s = drop (count p s) s -- | If the string starts with the given prefix, return the portion of the -- | string left after removing it, as a Just value. Otherwise, return Nothing. --- | * `stripPrefix "http:" "http://purescript.org" == Just "//purescript.org" --- | * `stripPrefix "http:" "https://purescript.org" == Nothing +-- | * `stripPrefix "http:" "http://purescript.org" == Just "//purescript.org"` +-- | * `stripPrefix "http:" "https://purescript.org" == Nothing` stripPrefix :: String -> String -> Maybe String stripPrefix prefix str = case indexOf prefix str of @@ -137,7 +137,7 @@ foreign import _indexOf' :: (forall a. a -> Maybe a) -> Maybe Int -- | Returns the index of the last occurrence of the first string in the --- | second string. Returns `-1` if there is no match. +-- | second string. Returns `Nothing` if there is no match. lastIndexOf :: String -> String -> Maybe Int lastIndexOf = _lastIndexOf Just Nothing