Skip to content

Case expression with Array.popFirst and redundant branches #268

Open
@aramiscd

Description

@aramiscd

The code:

module Bug exposing ( .. )

err : Array Int -> Int
err array =
    case Array.popFirst array of
        Nothing -> 0
        Just { first = _, rest = _ } -> 0
        _ -> 0

The error:

Compiling ...gren: Map.!: given key is not an element in the map
CallStack (from HasCallStack):
  error, called at libraries/containers/containers/src/Data/Map/Internal.hs:617:17 in containers-0.6.7:Data.Map.Internal

-- ERROR -----------------------------------------------------------------------

I ran into something that bypassed the normal error reporting process! I
extracted whatever information I could from the internal error:

>   thread blocked indefinitely in an MVar operation
...

It compiles without the last branch. Without the first branch it also compiles. But it seems to have problems with the redundant branches. If I remove the Array.popFirst, it also compiles.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions