You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Top level definitions allow cyclic values to be declared when the recursive call is guarded behind a lambda.
In let bindings however, they're disallowed more strongly, based on whether the binding itself has arguments. This is a different algorithm, and forbids working programs.
Even though these definitions are semantically identical.
Elm: 0.19.1
Additional Details
Code in question is checkCycles in Canonicalize.Expression.
case binding ofDefine def@(Can.Def name args _) ->ifnull args thenResult.throw (Error.RecursiveLet name (toNames otherBindings defs))
else
checkCycle otherBindings (def:defs)
This is overly strict and could instead use the toNodeOne and toNodeTwo approach from Canonicalize.Module.
While the above example is indeed liftable to the top level, not all let bindings are, and the alternative (to put everything in the let behind a function call, means potentially a lot of extra computation may occur.
The text was updated successfully, but these errors were encountered:
Quick Summary:
Top level definitions allow cyclic values to be declared when the recursive call is guarded behind a lambda.
In let bindings however, they're disallowed more strongly, based on whether the binding itself has arguments. This is a different algorithm, and forbids working programs.
SSCCE
This works (as per the bad-recursion document)
While this doesn't
Even though these definitions are semantically identical.
Additional Details
Code in question is
checkCycles
inCanonicalize.Expression
.This is overly strict and could instead use the
toNodeOne
andtoNodeTwo
approach fromCanonicalize.Module
.While the above example is indeed liftable to the top level, not all let bindings are, and the alternative (to put everything in the let behind a function call, means potentially a lot of extra computation may occur.
The text was updated successfully, but these errors were encountered: