Skip to content

Changes to type definitions do not correctly trigger cell reruns #10

Description

@fabeulous

It seems the dependency graph between cells does not track user-defined types correctly. When a cell containing a type definition is changed, cells using a constructor of that type definition will correctly be rerun, while cells only "consuming" that type will not be rerun. These different cells will then refer to different types (the former to the newly run type, the latter to the type defined before rerunning) and can cause type errors. It is also not possible to manually rerun the missing cells without making a change in them or restarting the kernel.

Consider the following notebook:

  • cell 1 defines a type A
data A = A
  • cell 2 uses the constructor of type A
mkA :: A
mkA = A
  • cell 3 only "consumes" type A, but does not use the constructor
consumeA :: A -> ()
consumeA _ = ()
-- consumeA A = () <- would also cause the same issue
  • cell 4 uses values from cell 2 and cell 3
problemFun :: ()
problemFun = consumeA mkA

Running the notebook will behave as expected. However, if we now make a change to cell 1, even a trivial whitespace change, we can rerun it. This triggers cells 2 and 4 to be rerun, but not cell 3. This immediately causes a type error in cell 4, since mkA returns a value of the "new" type A, while consumeA expects a value of the "old" type A.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions