summaryrefslogtreecommitdiff
path: root/applicative/h2.hs
blob: 6d9b801c5fef4c8b3c64da2e95dc536a7d019d7a (plain)
1
2
3
4
5
6
7
8
9
10
import Control.Applicative

newtype MyZipList a = MyZipList { getMyZipList :: [a] }

instance Functor MyZipList where
    fmap f (MyZipList x) = MyZipList (fmap f x)

instance Applicative MyZipList where
     pure x = MyZipList [x]
     (MyZipList gs) <*> (MyZipList xs) = MyZipList (zipWith ($) gs xs)