Hi John,

Here is the case I was talking about (transformers + 'global-optimize'):

> import Control.Monad.Trans.Class (lift)
> import Control.Monad.Trans.Error
> x :: ErrorT String IO ()
> x = lift (print "hello") >> return ()
> main = runErrorT x

This code fails to compile with 'global-optimize' enabled:

Collected Compilation...
-- TypeAnalyzeMethods
-- BoxifyProgram
-- Boxy WorkWrap
Stack:
transformProgram: Simplify-SuperSimplify after Boxy WorkWrap
jhc: E.TypeCheck.getType: (EPi x20202872::Jhc.Prim.IO.State_ Jhc.Prim.IO.RealWorld::*::# (EAp Jhc@.Box.*::* (EVar x20202872::Jhc.Prim.IO.State_ Jhc.Prim.IO.RealWorld::*::#)),#,Jhc@.Box.*::*)

My original code (which is still too big) fails with very similar error.
However, if you change line:

> x = lift (print "hello") >> return ()

to:

> x = lift (print "hello")

then it is compiled successfully.

Thanks!



On Mon, Jul 21, 2014 at 4:26 PM, John Meacham <john@repetae.net> wrote:
On Mon, Jul 21, 2014 at 2:41 AM, Dmitry Kulagin
<dmitry.kulagin@gmail.com> wrote:
>
> Yes, original code seems to be pretty large. It fails to compile before code
> generation. I will try tonight to get the minimal example of the case.
> If I am not mistaken 'global-optimize' does not play nicely with monad
> transformers.


It is possible, there are some optimizatinos that can blow up in size
in certain cases. Usually I can fix them once identified.

    John

--
John Meacham - http://notanumber.net/