Strange compiler error with an undefined reference

Hello,

I’m struggling with the following code:


Basically when I use the dummy react component toHtmlFirstLevelCpt, everything compiles fine, but when I substitute with
toHtmlFirstLevel = R.createElement toHtmlFirstLevelCpt'

I get a really strange compiler error about an unknown reference:

Error found:
in module Gargantext.Components.Forest.Tree
at src/Gargantext/Components/Forest/Tree.purs:183:36 - 183:56 (line 183, column 36 - line 183, column 56)
 
  The value of toHtmlFirstLevelCpt' is undefined here, so this reference is not allowed.
 
while inferring the type of toHtmlFirstLevelCpt'
while applying a function createElement
  of type IsComponent t0 t1 t2 => t0 -> Record t1 -> t2 -> Element
  to argument toHtmlFirstLevelCpt'
in binding group toHtmlFirstLevelCpt', toHtmlFirstLevel, childNodeFirstLevelPaint, childNodeFirstLevel
 
where t0 is an unknown type
      t1 is an unknown type
      t2 is an unknown type
 
See https://github.com/purescript/documentation/blob/master/errors/CycleInDeclaration.md for more information,
or to contribute content related to this error.

I’m not sure how toHtmlFirstLevelCpt' can be undefined when this compiles fine otherwise. Could this be a compiler bug?

Purescript version is 0.13.8

Hi @CGenie,

It is a bit hidden but it seems to be undefined because of an illegal cycle:

Well, indeed it’s true that: toHtmlFirstLevelCpt calls childNodeFirstLevel which calls childNodeFirstLevelPaint which calls toHtmlFirstLevel back again.

In fact, when I comment out


the code compiles fine.