Skip to content

Commit

Permalink
Modify GenUnboxTuple to not generate warnings
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dolio committed Aug 28, 2016
1 parent 808f647 commit 9d563f3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/GenUnboxTuple.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ generate n =
]

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

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

0 comments on commit 9d563f3

Please sign in to comment.