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
(The result is the same as #1669, but by my understanding I'd say this is a type contradiction not an infinite type.)
With the following code (or full Main.elm), the Elm 0.18 compiler hangs and eventually crashes due to out of memory:
type alias FullRecord={ fieldA :String, fieldB :MaybeString}type alias PartialRecordA a ={ a
| fieldA :String}type alias PartialRecordB a ={ a
| fieldB :String}fullRecord:PartialRecordAa->Maybe (PartialRecordBb) ->FullRecordfullRecord partialRecordA partialRecordB ={ fieldA = partialRecordA.fieldA
, fieldB =Maybe.map .fieldB partialRecordB
}combineA:PartialRecordAa->FullRecordcombineA =
combineMaybeAB (always Nothing)combineAB:PartialRecordA (PartialRecordBa) ->FullRecordcombineAB =
combineMaybeAB JustcombineMaybeAB: (PartialRecordAa->Maybe (PartialRecordBa)) ->PartialRecordAa->FullRecord-- Hangs--combineMaybeAB : (PartialRecordA a -> Maybe (PartialRecordB b)) -> PartialRecordA a -> FullRecord -- WorkscombineMaybeAB partialSelectorB partialRecordA =
fullRecord partialRecordA (partialSelectorB partialRecordA)
The type inference is impossible because no single a can satisfy both PartialRecordA a and PartialRecordA (PartialRecordB a) when combineAB calls combineMaybeAB. (The second a needs to have fewer fields.) Instead of giving an error message, the compiler gets stuck and keeps allocating more memory.
If combineAB is written with parameters instead of point-free, the correct compiler message gets generated.
If the correct type signature for combineMaybeAB is used, the compile succeeds and doesn't hang.
The text was updated successfully, but these errors were encountered:
(The result is the same as #1669, but by my understanding I'd say this is a type contradiction not an infinite type.)
With the following code (or full Main.elm), the Elm 0.18 compiler hangs and eventually crashes due to out of memory:
The type inference is impossible because no single
a
can satisfy bothPartialRecordA a
andPartialRecordA (PartialRecordB a)
whencombineAB
callscombineMaybeAB
. (The seconda
needs to have fewer fields.) Instead of giving an error message, the compiler gets stuck and keeps allocating more memory.If
combineAB
is written with parameters instead of point-free, the correct compiler message gets generated.If the correct type signature for
combineMaybeAB
is used, the compile succeeds and doesn't hang.The text was updated successfully, but these errors were encountered: