ref: bceced6e4b829eb0b2e401c34a593ad37c99ff8d
parent: 4a7a73a6c99c0e7ce6b84e4ee0813b85e1d747d7
author: Lennart Augustsson <lennart.augustsson@epicgames.com>
date: Fri Feb 2 06:40:34 EST 2024
Add Data.ZipList
--- a/lib/AllOfLib.hs
+++ b/lib/AllOfLib.hs
@@ -61,6 +61,7 @@
import Data.Void
import Data.Word
import Data.Word8
+import Data.ZipList
import Debug.Trace
import Foreign.C.String
import Foreign.Marshal.Alloc
--- /dev/null
+++ b/lib/Data/ZipList.hs
@@ -1,0 +1,15 @@
+module Data.ZipList(ZipList(..), getZipList) where
+import Prelude
+
+newtype ZipList a = ZipList [a]
+ deriving (Eq, Ord, Show)
+
+getZipList :: forall a . ZipList a -> [a]
+getZipList (ZipList as) = as
+
+instance Functor ZipList where
+ fmap f (ZipList as) = ZipList (map f as)
+
+instance Applicative ZipList where
+ pure a = ZipList (repeat a)
+ liftA2 f (ZipList xs) (ZipList ys) = ZipList (zipWith f xs ys)
--
⑨