1-----------------------------------------------------------------------------
3-- Module : Language.PureScript.Traversals
4-- Copyright : (c) 2014 Phil Freeman
7-- Maintainer : Phil Freeman <paf31@cantab.net>
8-- Stability : experimental
11-- | Common functions for implementing generic traversals
13-----------------------------------------------------------------------------
17module Language.PureScript.Traversals where
19#if __GLASGOW_HASKELL__ < 710
20import Control.Applicative
23fstM :: (Functor f) => (a -> f c) -> (a, b) -> f (c, b)
24fstM f (a, b) = flip (,) b <$> f a
26sndM :: (Functor f) => (b -> f c) -> (a, b) -> f (a, c)
27sndM f (a, b) = (,) a <$> f b
29thirdM :: (Functor f) => (c -> f d) -> (a, b, c) -> f (a, b, d)
30thirdM f (a, b, c) = (,,) a b <$> f c
32pairM :: (Applicative f) => (a -> f c) -> (b -> f d) -> (a, b) -> f (c, d)
33pairM f g (a, b) = (,) <$> f a <*> g b
35maybeM :: (Applicative f) => (a -> f b) -> Maybe a -> f (Maybe b)
36maybeM _ Nothing = pure Nothing
37maybeM f (Just a) = Just <$> f a
39eitherM :: (Applicative f) => (a -> f c) -> (b -> f d) -> Either a b -> f (Either c d)
40eitherM f _ (Left a) = Left <$> f a
41eitherM _ g (Right b) = Right <$> g b
43defS :: (Monad m) => st -> val -> m (st, val)
44defS s val = return (s, val)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list