[jhc] JHC: problem with transformers

Dmitry Kulagin dmitry.kulagin at gmail.com
Mon Jul 21 21:22:52 UTC 2014


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 at .Box.*::* (EVar
x20202872::Jhc.Prim.IO.State_ Jhc.Prim.IO.RealWorld::*::#)),#,Jhc at .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 at repetae.net> wrote:

> On Mon, Jul 21, 2014 at 2:41 AM, Dmitry Kulagin
> <dmitry.kulagin at 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/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/jhc/attachments/20140722/26943b42/attachment.html>


More information about the jhc mailing list