From 18f565567a8f750f2594da943e8b8d1b9603c837 Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Fri, 14 Mar 2025 15:40:21 +0100 Subject: [PATCH] feat(users/Profpatsch/my-prelude): inline RevList defs Change-Id: Iab727a98a8c078ce5f32d53aa87ee149356997d4 Reviewed-on: https://cl.tvl.fyi/c/depot/+/13266 Reviewed-by: Profpatsch Tested-by: BuildkiteCI --- users/Profpatsch/my-prelude/src/RevList.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/users/Profpatsch/my-prelude/src/RevList.hs b/users/Profpatsch/my-prelude/src/RevList.hs index 0f002c07e..a79e1668f 100644 --- a/users/Profpatsch/my-prelude/src/RevList.hs +++ b/users/Profpatsch/my-prelude/src/RevList.hs @@ -11,18 +11,23 @@ newtype RevList a = RevList [a] deriving (Semigroup, Monoid) via (Semigroup.Dual [a]) empty :: RevList a +{-# INLINE empty #-} empty = RevList [] singleton :: a -> RevList a +{-# INLINE singleton #-} singleton a = RevList [a] -- | (@O(n)@) Turn the list into a reversed list (by reversing) revList :: [a] -> RevList a +{-# INLINE revList #-} revList xs = RevList $ reverse xs -- | (@O(n)@) Turn the reversed list into a list (by reversing) revListToList :: RevList a -> [a] +{-# INLINE revListToList #-} revListToList (RevList rev) = reverse rev instance (Show a) => Show (RevList a) where + {-# INLINE show #-} show (RevList rev) = rev & show