ekmett/free — pull request #62 by fizruk (2014-04-27 23:34:11+00:00)
Title: [TH] makeFree support for GADTs

`makeFree` now supports GADTs:

```haskell
type RetryIO = Free RetryF

data RetryF next where
Output :: String -> next -> RetryF next
Input :: Read a => (a -> next) -> RetryF next
Retry :: RetryIO a -> (a -> next) -> RetryF next

instance Functor RetryF where
fmap f (Output s x) = Output s (f x)
fmap f (Input g) = Input (f . g)
fmap f (Retry block g) = Retry block (f . g)

makeFree ''RetryF

test :: RetryIO ()
test = do
n <- retry $ do
output "Enter any number: "
input
output $ "You've just entered " ++ show (n :: Int)
```

In this example the following functions are declared via `makeFree`:

```haskell
output :: MonadFree RetryF m => String -> m ()

input :: (MonadFree RetryF m, Read a) => m a

retry :: MonadFree RetryF m => RetryIO a -> m a
```