ekmett/free — pull request #60 by fizruk (2014-04-23 22:36:00+00:00)
Title: Free applicative transformer

Comments need to be fixed.
I'm not sure about using `Foldable` in `runAlt` (though seems ok).

I have some ideas for `runApT`:

```haskell
-- Applicative version

runApF :: (Applicative h, Functor g) => (forall a. f a -> h a) -> (forall a. g (h a) -> h a) -> ApF f g b -> h b
runApF _ _ (Pure x) = pure x
runApF f h (Ap x y) = f x <**> runApT f h y

runApT :: (Applicative h, Functor g) => (forall a. f a -> h a) -> (forall a. g (h a) -> h a) -> ApT f g b -> h b
runApT f h (ApT g) = h (runApF f h <$> g)
```

```haskell
-- Monad version

runApF' :: (Monad m) => (forall a. f a -> m a) -> ApF f m b -> m b
runApF' _ (Pure x) = return x
runApF' f (Ap x k) = do
x' <- f x
k' <- runApT' f k
return (k' x')

runApT' :: (Monad m) => (forall a. f a -> m a) -> ApT f m b -> m b
runApT' f (ApT m) = m >>= runApF' f
```