[Ur] effectful? (Re: 'Anonymous function remains at code generation' error)

Adam Chlipala adamc at csail.mit.edu
Wed Feb 22 13:36:54 EST 2017


Sorry for not getting around to the original question yet.  As with 
Haskell, we still consider memory-allocating code pure. However, in C, 
use function uw_malloc() to allocate the memory, so that the Ur/Web 
runtime system can reclaim the memory automatically.

I don't remember right now why that 'effectful' annotation would have 
this effect, in detail, but it must be because certain program 
simplifications conservatively refuse to touch effectful code.


On 02/22/2017 01:32 PM, Marko Schütz Schmuck wrote:
> [sorry for not continuing the thread: I was having some issues with my
> subscription to the mailing list and did not receive list emails.]
>
> In lib.urp of blobText I had marked BlobText.blobText as
> effectful since it allocates memory. With the effectful annotation I
> got the error
>
> Anonymous function remains at code generation
>
> When I remove the annotation it compiles without error.
>
> Is effectful used correctly in this way?
> If this is so, what can I do to get the compiler to accept the source
> code? I had tried decomposing and annotating some types in the hope
> that this was an issue with the type checker that could be solved this
> way...
> How should the allocated memory be released?
> Or is effectful not needed here? Why?
>
> Thanks,
>
> Marko



More information about the Ur mailing list