boltzmann-brain icon indicating copy to clipboard operation
boltzmann-brain copied to clipboard

Compilation error with some symbol names

Open Kerl13 opened this issue 2 years ago • 2 comments

Compilation breaks if the entry point of my grammar is named S, it seems to clash with some other type with the same identifier in the generated code.

Minimal working example:

@module   Sampler
@size     1000
@generate S

S = Leaf
  | Node S S.

The error:

/tmp/tmpap7caq9k/src/Sampler.hs:20:15: error:
    Ambiguous occurrence ‘S’
    It could refer to either ‘GHC.Generics.S’,
                             imported from ‘GHC.Generics’ at src/Sampler.hs:9:1-19
                          or ‘Sampler.S’, defined at src/Sampler.hs:19:1
   |
20 |        | Node S S

My setup:

$ python -c 'import paganini; print(paganini.__version__)'
1.4.0
$ git log --oneline | head -n 1
a85fcc3 Update link

Kerl13 avatar Jul 01 '22 18:07 Kerl13

Do you think it's possible to scope things so as to prevent that from ever happening? (I'm not very familiar with Haskell)

Kerl13 avatar Jul 01 '22 20:07 Kerl13

We should explicitly list what we need to import, so to avoid unnecessary clashes.

maciej-bendkowski avatar Jul 08 '22 12:07 maciej-bendkowski