genCheckOffsetsUnion' :: String -> String
genCheckOffsetsUnion' name = concat [fst_line, snd_line, trd_line, fth_line, last_line]
    where fst_line = concat ["int checkOffsets",name,"(HsInt16 *offs){\n"]
          snd_line = concat ["    int t = offsetof(",name,", tag) == offs[0];\n"]
          trd_line = concat ["    int v = offsetof(",name,", val) == offs[1];\n"]
          fth_line = concat ["    return t && v;\n"]
          last_line    = "}\n\n"
genCheckOffsetsUnion' :: String -> String
genCheckOffsetsUnion' name = concat [fst_line, snd_line, trd_line, fth_line, last_line]
    where fst_line = concat ["int checkOffsets",name,"(HsInt16 *offs){\n"]
          snd_line = concat ["    int t = offsetof(",name,", tag) == offs[0];\n"]
          trd_line = concat ["    int v = offsetof(",name,", val) == offs[1];\n"]
          fth_line = concat ["    return t && v;\n"]
          last_line    = "}\n\n"
genCheckOffsetsUnion' name = concat [fst_line, snd_line, trd_line, fth_line, last_line]
    where fst_line = concat ["int checkOffsets",name,"(HsInt16 *offs){\n"]
          snd_line = concat ["    int t = offsetof(",name,", tag) == offs[0];\n"]
          trd_line = concat ["    int v = offsetof(",name,", val) == offs[1];\n"]
          fth_line = concat ["    return t && v;\n"]
          last_line    = "}\n\n"