Skip to content

Commit ed194f1

Browse files
Yuji Yamamototreeowl
authored andcommitted
Fix sample code of alterF in haddock
Found by a question in StackOverflow https://stackoverflow.com/questions/52828746/haskell-data-map-strict-alterf-parse-error-on-input/52829097
1 parent b4ca184 commit ed194f1

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

Data/IntMap/Internal.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -963,14 +963,14 @@ alter f k Nil = case f Nothing of
963963
-- @
964964
-- interactiveAlter :: Int -> IntMap String -> IO (IntMap String)
965965
-- interactiveAlter k m = alterF f k m where
966-
-- f Nothing -> do
966+
-- f Nothing = do
967967
-- putStrLn $ show k ++
968968
-- " was not found in the map. Would you like to add it?"
969969
-- getUserResponse1 :: IO (Maybe String)
970-
-- f (Just old) -> do
971-
-- putStrLn "The key is currently bound to " ++ show old ++
970+
-- f (Just old) = do
971+
-- putStrLn $ "The key is currently bound to " ++ show old ++
972972
-- ". Would you like to change or delete it?"
973-
-- getUserresponse2 :: IO (Maybe String)
973+
-- getUserResponse2 :: IO (Maybe String)
974974
-- @
975975
--
976976
-- 'alterF' is the most general operation for working with an individual

Data/IntMap/Strict.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -607,14 +607,14 @@ alter f !k t =
607607
-- @
608608
-- interactiveAlter :: Int -> IntMap String -> IO (IntMap String)
609609
-- interactiveAlter k m = alterF f k m where
610-
-- f Nothing -> do
610+
-- f Nothing = do
611611
-- putStrLn $ show k ++
612612
-- " was not found in the map. Would you like to add it?"
613613
-- getUserResponse1 :: IO (Maybe String)
614-
-- f (Just old) -> do
615-
-- putStrLn "The key is currently bound to " ++ show old ++
614+
-- f (Just old) = do
615+
-- putStrLn $ "The key is currently bound to " ++ show old ++
616616
-- ". Would you like to change or delete it?"
617-
-- getUserresponse2 :: IO (Maybe String)
617+
-- getUserResponse2 :: IO (Maybe String)
618618
-- @
619619
--
620620
-- 'alterF' is the most general operation for working with an individual

Data/Map/Internal.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,14 +1167,14 @@ data AreWeStrict = Strict | Lazy
11671167
-- @
11681168
-- interactiveAlter :: Int -> Map Int String -> IO (Map Int String)
11691169
-- interactiveAlter k m = alterF f k m where
1170-
-- f Nothing -> do
1170+
-- f Nothing = do
11711171
-- putStrLn $ show k ++
11721172
-- " was not found in the map. Would you like to add it?"
11731173
-- getUserResponse1 :: IO (Maybe String)
1174-
-- f (Just old) -> do
1175-
-- putStrLn "The key is currently bound to " ++ show old ++
1174+
-- f (Just old) = do
1175+
-- putStrLn $ "The key is currently bound to " ++ show old ++
11761176
-- ". Would you like to change or delete it?"
1177-
-- getUserresponse2 :: IO (Maybe String)
1177+
-- getUserResponse2 :: IO (Maybe String)
11781178
-- @
11791179
--
11801180
-- 'alterF' is the most general operation for working with an individual

Data/Map/Strict/Internal.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -814,14 +814,14 @@ alter = go
814814
-- @
815815
-- interactiveAlter :: Int -> Map Int String -> IO (Map Int String)
816816
-- interactiveAlter k m = alterF f k m where
817-
-- f Nothing -> do
817+
-- f Nothing = do
818818
-- putStrLn $ show k ++
819819
-- " was not found in the map. Would you like to add it?"
820820
-- getUserResponse1 :: IO (Maybe String)
821-
-- f (Just old) -> do
822-
-- putStrLn "The key is currently bound to " ++ show old ++
821+
-- f (Just old) = do
822+
-- putStrLn $ "The key is currently bound to " ++ show old ++
823823
-- ". Would you like to change or delete it?"
824-
-- getUserresponse2 :: IO (Maybe String)
824+
-- getUserResponse2 :: IO (Maybe String)
825825
-- @
826826
--
827827
-- 'alterF' is the most general operation for working with an individual

0 commit comments

Comments
 (0)