gt;)` infix alias - `(gt;)` and `(<$)` replace a value in the context. The arrow points to the new value. - `void` puts `()` in the context. - See `Data.Functor` ## Applicative ### The `pure` for `ZipList` Since zip caps the longer list, `pure id <*> x == x` requires that the list created by `pure` is not shorter than any list. It can only be an infinite list repeating the given value, so `pure = ZipList . repeat`. ### `ApplicativeDo` ```haskell -- | -- >>> myApp (+) (Just 2) (Just 3) -- Just 5 myApp :: (a -> b -> c) -> Maybe a -> Maybe b -> Maybe c myApp g x y = do x' <- x y' <- y pure $ g x' y' ``` ### Notes - `pure` turns a value into an effective-free context. - `(*>)` and `(<*)` sequences both computation contexts but keep only result on the arrow direction. - `(<**>)` flips `(<*>)` but reserve the sequence. - `when`, `unless` in `Control.Monad` performs the computation conditionally and drops the result. - See `Control.Applicative` - It's a bit tricky to implement Applicative for a function newtype. ```haskell (TFun g) <*> (TFun h) = TFun $ (\x -> g x . h $ x) ```