cgEnumerationTyCon :: Text -> TyCon -> CodeGen ()
cgEnumerationTyCon tyConCl tyCon = do
  dflags <- getDynFlags
  thisClass <- getClass
  let fieldName = nameTypeTable dflags $ tyConName tyCon
      loadCodes = [    dup arrayFt
                    <> iconst jint i
                    <> new dataFt
                    <> dup dataFt
                    <> invokespecial (mkMethodRef dataClass "<init>" [] void)
                    <> gastore elemFt
                    | (i, con) <- zip [0..] $ tyConDataCons tyCon
                    , let dataFt    = obj dataClass
                          dataClass = dataConClass dflags con ]
  defineField $ mkFieldDef [Public, Static, Final] fieldName arrayFt
  let field = mkFieldRef thisClass fieldName arrayFt
  addInitStep (fold
    [
      iconst jint $ fromIntegral familySize,
      new arrayFt,
      fold loadCodes,
      putstatic field
    ]
    , field
    , []
    )
  where
        arrayFt = jarray elemFt
        elemFt = obj tyConCl
        familySize = tyConFamilySize tyCon
cgEnumerationTyCon :: Text -> TyCon -> CodeGen ()
cgEnumerationTyCon tyConCl tyCon = do
  dflags <- getDynFlags
  thisClass <- getClass
  let fieldName = nameTypeTable dflags $ tyConName tyCon
      loadCodes = [    dup arrayFt
                    <> iconst jint i
                    <> new dataFt
                    <> dup dataFt
                    <> invokespecial (mkMethodRef dataClass "<init>" [] void)
                    <> gastore elemFt
                    | (i, con) <- zip [0..] $ tyConDataCons tyCon
                    , let dataFt    = obj dataClass
                          dataClass = dataConClass dflags con ]
  defineField $ mkFieldDef [Public, Static, Final] fieldName arrayFt
  let field = mkFieldRef thisClass fieldName arrayFt
  addInitStep (fold
    [
      iconst jint $ fromIntegral familySize,
      new arrayFt,
      fold loadCodes,
      putstatic field
    ]
    , field
    , []
    )
  where
        arrayFt = jarray elemFt
        elemFt = obj tyConCl
        familySize = tyConFamilySize tyCon
cgEnumerationTyCon tyConCl tyCon = do
  dflags <- getDynFlags
  thisClass <- getClass
  let fieldName = nameTypeTable dflags $ tyConName tyCon
      loadCodes = [    dup arrayFt
                    <> iconst jint i
                    <> new dataFt
                    <> dup dataFt
                    <> invokespecial (mkMethodRef dataClass "<init>" [] void)
                    <> gastore elemFt
                    | (i, con) <- zip [0..] $ tyConDataCons tyCon
                    , let dataFt    = obj dataClass
                          dataClass = dataConClass dflags con ]
  defineField $ mkFieldDef [Public, Static, Final] fieldName arrayFt
  let field = mkFieldRef thisClass fieldName arrayFt
  addInitStep (fold
    [
      iconst jint $ fromIntegral familySize,
      new arrayFt,
      fold loadCodes,
      putstatic field
    ]
    , field
    , []
    )
  where
        arrayFt = jarray elemFt
        elemFt = obj tyConCl
        familySize = tyConFamilySize tyCon