From 9de49155acf26c3a68e07b7b3d981736b9142da4 Mon Sep 17 00:00:00 2001
From: Hans-Peter Deifel <hpd@hpdeifel.de>
Date: Wed, 17 Oct 2018 09:52:42 +0200
Subject: [PATCH] Explain amortized cost for Stack.push in documentation

---
 src/Data/Stack.hs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/Data/Stack.hs b/src/Data/Stack.hs
index 975827f..7907219 100644
--- a/src/Data/Stack.hs
+++ b/src/Data/Stack.hs
@@ -95,7 +95,9 @@ clear s = writeSTRefU (tos s) 0
 
 -- | Insert a new element on top of the stack.
 --
--- Runtime: O(1)
+-- This will reallocate the underlying memory if needed.
+--
+-- Runtime: Amortized O(1)
 push :: VM.Unbox a => Stack s a -> a -> ST s ()
 push s x = do
   currentTos <- readSTRefU (tos s)
-- 
GitLab