Compiler trips up on extensible records?

My application is a data science application that displays several interactive tables in a SPA. Each table has different columns with possibly different data types. An earlier version of the app used dwyl/elm-input-tables, but that package has not been updated for Elm 0.19, and I had to hack it in too many places to suit my needs, so I decided to roll my own table module.

I have separated all the table logic out into a Table.elm containing a model, a view function and an update function. In my main application I configure each table separately, and messages to each table are wrapped, so the main update function looks like

case msg of
  Table1Wrap m ->
    { model | table1 = Table1.update m }
  Table2Wrap m ->
    { model | table2 = Table2.update m }
  ...

The type of the messages to each table depend on the record corresponding to a row in the table. And this is where my problem arise. In my Table.elm a row record is an extensible record

type alias Row a = { a | id : String }

@Philipp_Krueger suggested in one of his posts that I used a row wrapper record type. I initially resisted this, because it would complicate updating the rows (now nested records), as per e.g. this.

I marked @Philipp_Krueger’s post as a solution because his code was able to compile with the signature change, but it does not solve the fundamental issue at stake. It does not suffice for my needs. Maybe I should unmark it as the solution?

1 Like