That page already has an example built using the decoder APIs so unless something is changing to disallow the creation of such cyclic decoders, cycles remain. The lifting trick still has a cycle at the end — it has to given the desire to build something recursive —through the functions and variables even if it doesn't end up in some of the data structures.
Specifically, since the lifting is being done to prevent repeated allocations of the Random.andThen and we potentially need to pass through the Random.andThen logic multiple times, the node must lead back to itself. Mark > On Nov 27, 2017, at 2:37 AM, 'Rupert Smith' via Elm Discuss > <[email protected]> wrote: > > >> On Monday, November 27, 2017 at 7:50:01 AM UTC, Mark Hamburg wrote: >> P.S. Cyclic structures can be avoided by having the compiler perform a >> strongly connected component analysis (e.g., using Tarjan's algorithm) and >> disallowing any SCC's that include anything other than function definitions. >> In fact, not doing so likely leaves open other cyclic cases and hence >> getting rid of Lazy likely does not eliminate cycles and instead just >> narrows the cases for which Elm is suitable. > > My hunch is that enough has been done to make cyclic structures impossible, > but I have made no detailed analysis to support that. If all data structures > are immutable, then references within them have to be created when the > structure is first created. The first structure in a cycle to be created must > contain a reference to another structure in the cycle, for a cycle to be > formed, but as the other structures have not yet been created, this cannot be > done. > > I think you should post an example of building a cyclic structure here, if > you think it can be done: > > https://gist.github.com/evancz/07436448b7d6c947f21742dab46d1218 > -- > You received this message because you are subscribed to the Google Groups > "Elm Discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
