You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Haskell: local variables in Printer may clash with printing functions #337
[4of6] CompilingPrintTest ( PrintTest.hs, PrintTest.o )
PrintTest.hs:110:43:error:•Couldn't match expected type‘t0 ->AbsTest.Prt->Doc’
with actual type‘AbsTest.Prt’•The function ‘prt’ is applied to two arguments,
but its type‘AbsTest.Prt’ has none
In the expression: prt 0 prt
In the first argument of‘concatD’, namely ‘[prt 0 prt]’|110|AbsTest.M prt -> prPrec i 0 (concatD [prt 0 prt])
|^^^^^^^^^
The problem is that the constructor arguments are lowercase versions of the argument types, e.g. Prt gives prt, which is the name of the printing function.
A solution is to prefix the local variables with an underscore.
Activity
[ re #337 ] Haskell: use \case in Print.hs
andreasabel commentedon Jan 31, 2021
There was also a list of names to avoid, I added
prtanddoc.[ #337 ] XML printer: avoid clashes with "prt"
[ fixed BNFC#337 ] avoid local variables "prt" and "doc" in Haskell p…