Skip to content

[generics-rep] Trivial genericShow blows up the call stack #245

Open
@karljs

Description

@karljs

I have the following code in my library:

data VVis a
  = Fill a (Frame a)
  | ...

derive instance genericVVis :: Generic (VVis a) _
instance showVVis :: Show a => Show (VVis a) where
  show = genericShow

data Frame a = Frame
  { frameMax :: a
  , frameMin :: a
  }

derive instance genericFrame :: Generic (Frame a) _
instance showFrame :: Show a => Show (Frame a) where
  show = genericShow

If I now load my code in a REPL and create the following trivial value:

> Fill 2.0 (Frame {frameMax: 1.0, frameMin: 0.0})
return new Data_Show.Show(Data_Generic_Rep_Show.genericShow(genericVVis)(Data_Generic_Rep_Show.genericShowSum(Data_Generic_Rep_Show.genericShowConstructor(Data_Generic_Rep_Show.genericShowArgsProduct(Data_Generic_Rep_Show.genericShowArgsArgument(dictShow))(Data_Generic_Rep_Show.genericShowArgsArgument(showFrame(dictShow))))(new Data_Symbol.IsSymbol(function () {
                                                                             ^

RangeError: Maximum call stack size exceeded
...

This is a very small value, so I don't understand why this is blowing up the call stack. Could somebody help me understand please?

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: documentationImprovements or additions to documentation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions