Skip to content

Commit 9d563f3

Browse files
committed
Modify GenUnboxTuple to not generate warnings
Many definitions ignore some of their arguments, and with -Wall enabled, these will be warned about unless the variable names begin with an underscore. So the code generator has been modified to put leading underscores on most variable names. These are still legal variable names to refer to (they don't act like _, which is a special pattern, not a variable name). This successfully makes the generated code compile warning-free, although it isn't identical to the code that is checked in.
1 parent 808f647 commit 9d563f3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/GenUnboxTuple.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ generate n =
3333
]
3434

3535
where
36-
vars = map char $ take n ['a'..]
36+
vars = map (\c -> text ['_',c]) $ take n ['a'..]
3737
varss = map (<> char 's') vars
3838
tuple xs = parens $ hsep $ punctuate comma xs
3939
vtuple xs = parens $ sep $ punctuate comma xs
4040
con s = text s <> char '_' <> int n
41-
var c = text (c : "_")
41+
var c = text ('_' : c : "_")
4242

4343
data_instance ty c
4444
= hang (hsep [text "data instance", text ty, tuple vars])

0 commit comments

Comments
 (0)