basvandijk/monad-control — Issue #4: Doesn't support transformer state that depends on the transformed monad
Author: ehird
Created: 2011-12-04 17:28:18+00:00
State: open

Hi,

I have a monad that looks like

```haskell
newtype FooT s m a = FooT { unFooT :: StateT (Bar m s) m a }
```

The problem here is that `Bar m s` is part of the monadic state, and depends on `m`, so an attempt to define the associated `StT` falls down:

```haskell
data StT (FooT s) a = StSupply (Bar m s) a
```

(`m` is unbound.)

Do you have any suggestions for solving this issue? I think it's a limitation in monad-control, but I'm not quite sure.

The definition of Bar in my code is as follows:

```haskell
newtype Bar m s = Bar { unBar :: m (s, Bar m s) }
```

(obviously it's not called Bar though :))