From 77490e28587ba7696671acc458f1b87b72c81415 Mon Sep 17 00:00:00 2001 From: Olle Fredriksson Date: Thu, 23 May 2024 22:47:47 +0200 Subject: [PATCH] Add Tsil.toReverseList --- src/Data/Tsil.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Data/Tsil.hs b/src/Data/Tsil.hs index f6a61f6..9107002 100644 --- a/src/Data/Tsil.hs +++ b/src/Data/Tsil.hs @@ -55,6 +55,10 @@ instance Foldable Tsil where go acc Empty = acc go acc (xs :> x) = go (x : acc) xs +toReverseList :: Tsil a -> [a] +toReverseList Empty = [] +toReverseList (as :> a) = a : toReverseList as + null :: Tsil a -> Bool null Empty = True null (_ :> _) = False