content: -----------------------------------------------------------------
  -- Autogenerated by Thrift
  --
  -- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
  --  @generated
  -----------------------------------------------------------------
  {-# LINE 8 "test/fixtures/gen-hs2/HsTest/Types.hs" #-}
  {-# LANGUAGE OverloadedStrings #-}
  {-# LANGUAGE BangPatterns #-}
  {-# OPTIONS_GHC -fno-warn-unused-imports#-}
  {-# OPTIONS_GHC -fno-warn-overlapping-patterns#-}
  {-# OPTIONS_GHC -fno-warn-incomplete-patterns#-}
  {-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns#-}
  {-# OPTIONS_GHC -fno-warn-incomplete-record-updates#-}
  {-# LANGUAGE GeneralizedNewtypeDeriving #-}
  module HsTest.Types
         (X(X, unX), Y, Z(Z, unZ), Foo(Foo, foo_bar, foo_baz),
          TUnion(TUnion_EMPTY, TUnion_StringOption, TUnion_I64Option,
                 TUnion_FooOption),
          TestStruct(TestStruct, testStruct_f_bool, testStruct_f_byte,
                     testStruct_f_double, testStruct_f_i16, testStruct_f_i32,
                     testStruct_f_i64, testStruct_f_float, testStruct_f_list,
                     testStruct_f_map, testStruct_f_text, testStruct_f_set,
                     testStruct_o_i32, testStruct_foo, testStruct_f_hash_map,
                     testStruct_f_newtype, testStruct_f_union, testStruct_f_string,
                     testStruct_f_binary, testStruct_f_optional_newtype,
                     testStruct_bool_map, testStruct_bool_list, testStruct_i64_vec,
                     testStruct_i64_svec, testStruct_binary_key,
                     testStruct_f_bytestring),
          Number(Number_One, Number_Two, Number_Three, Number__UNKNOWN),
          Perfect(Perfect_A, Perfect_B, Perfect_C, Perfect__UNKNOWN),
          Void(Void__UNKNOWN), List_i64_1894, List_i64_7708,
          Map_Number_i64_1522, String_1484, String_5858)
         where
  import qualified Control.DeepSeq as DeepSeq
  import qualified Control.Exception as Exception
  import qualified Control.Monad as Monad
  import qualified Control.Monad.ST.Trans as ST
  import qualified Control.Monad.Trans.Class as Trans
  import qualified Data.Aeson as Aeson
  import qualified Data.Aeson.Types as Aeson
  import qualified Data.ByteString as ByteString
  import qualified Data.Default as Default
  import qualified Data.Function as Function
  import qualified Data.HashMap.Strict as HashMap
  import qualified Data.Hashable as Hashable
  import qualified Data.Int as Int
  import qualified Data.List as List
  import qualified Data.Map.Strict as Map
  import qualified Data.Ord as Ord
  import qualified Data.Set as Set
  import qualified Data.Text as Text
  import qualified Data.Text.Encoding as Text
  import qualified Data.Vector as Vector
  import qualified Data.Vector.Storable as VectorStorable
  import qualified GHC.Magic as GHC
  import qualified Prelude as Prelude
  import qualified Thrift.Binary.Parser as Parser
  import qualified Thrift.CodegenTypesOnly as Thrift
  import Control.Applicative ((<|>), (*>), (<*))
  import Data.Aeson ((.:), (.:?), (.=), (.!=))
  import Data.Aeson ((.:), (.=))
  import Data.Monoid ((<>))
  import Prelude ((.), (++), (>), (==))
  import Prelude ((.), (<$>), (<*>), (>>=), (==), (++))
  import Prelude ((.), (<$>), (<*>), (>>=), (==), (/=), (<), (++))
  {-# LINE 4 "if/hs_test_instances.hs" #-}
  import qualified Test.QuickCheck as QuickCheck
  {-# LINE 5 "if/hs_test_instances.hs" #-}
  import qualified Data.Vector as Vector
  {-# LINE 6 "if/hs_test_instances.hs" #-}
  import qualified Data.Vector.Storable as VectorStorable
  {-# LINE 7 "if/hs_test_instances.hs" #-}
  import Prelude ((/=), ($))
  {-# LINE 76 "test/fixtures/gen-hs2/HsTest/Types.hs" #-}
  
  newtype X = X{unX :: Int.Int64}
              deriving (Prelude.Eq, Prelude.Show, DeepSeq.NFData, Prelude.Ord)
  
  instance Hashable.Hashable X where
    hashWithSalt __salt (X __val) = Hashable.hashWithSalt __salt __val
  
  instance Aeson.ToJSON X where
    toJSON (X __val) = Aeson.toJSON __val
  
  type Y = X
  
  newtype Z = Z{unZ :: Y}
              deriving (Prelude.Eq, Prelude.Show, DeepSeq.NFData, Prelude.Ord)
  
  instance Hashable.Hashable Z where
    hashWithSalt __salt (Z __val) = Hashable.hashWithSalt __salt __val
  
  instance Aeson.ToJSON Z where
    toJSON (Z __val) = Aeson.toJSON (unX __val)
  
  data Foo = Foo{foo_bar :: Int.Int32, foo_baz :: Int.Int32}
             deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
  
  instance Aeson.ToJSON Foo where
    toJSON (Foo __field__bar __field__baz)
      = Aeson.object
          ("bar" .= __field__bar : "baz" .= __field__baz : Prelude.mempty)
  
  instance Thrift.ThriftStruct Foo where
    buildStruct _proxy (Foo __field__bar __field__baz)
      = Thrift.genStruct _proxy
          (Thrift.genFieldPrim _proxy "bar" (Thrift.getI32Type _proxy) 5 0
             (Thrift.genI32Prim _proxy)
             __field__bar
             :
             Thrift.genFieldPrim _proxy "baz" (Thrift.getI32Type _proxy) 1 5
               (Thrift.genI32Prim _proxy)
               __field__baz
               : [])
    parseStruct _proxy
      = ST.runSTT
          (do Prelude.return ()
              __field__bar <- ST.newSTRef Default.def
              __field__baz <- ST.newSTRef Default.def
              let
                _parse _lastId
                  = do _fieldBegin <- Trans.lift
                                        (Thrift.parseFieldBegin _proxy _lastId _idMap)
                       case _fieldBegin of
                         Thrift.FieldBegin _type _id _bool -> do case _id of
                                                                   5 | _type ==
                                                                         Thrift.getI32Type _proxy
                                                                       ->
                                                                       do !_val <- Trans.lift
                                                                                     (Thrift.parseI32
                                                                                        _proxy)
                                                                          ST.writeSTRef __field__bar
                                                                            _val
                                                                   1 | _type ==
                                                                         Thrift.getI32Type _proxy
                                                                       ->
                                                                       do !_val <- Trans.lift
                                                                                     (Thrift.parseI32
                                                                                        _proxy)
                                                                          ST.writeSTRef __field__baz
                                                                            _val
                                                                   _ -> Trans.lift
                                                                          (Thrift.parseSkip _proxy
                                                                             _type
                                                                             (Prelude.Just _bool))
                                                                 _parse _id
                         Thrift.FieldEnd -> do !__val__bar <- ST.readSTRef __field__bar
                                               !__val__baz <- ST.readSTRef __field__baz
                                               Prelude.pure (Foo __val__bar __val__baz)
                _idMap = HashMap.fromList [("bar", 5), ("baz", 1)]
              _parse 0)
  
  instance DeepSeq.NFData Foo where
    rnf (Foo __field__bar __field__baz)
      = DeepSeq.rnf __field__bar `Prelude.seq`
          DeepSeq.rnf __field__baz `Prelude.seq` ()
  
  instance Default.Default Foo where
    def = Foo Default.def Default.def
  
  instance Hashable.Hashable Foo where
    hashWithSalt __salt (Foo _bar _baz)
      = Hashable.hashWithSalt (Hashable.hashWithSalt __salt _bar) _baz
  
  data TUnion = TUnion_StringOption Text.Text
              | TUnion_I64Option Int.Int64
              | TUnion_FooOption Foo
              | TUnion_EMPTY
                deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
  
  instance Aeson.ToJSON TUnion where
    toJSON (TUnion_StringOption __StringOption)
      = Aeson.object ["StringOption" .= __StringOption]
    toJSON (TUnion_I64Option __I64Option)
      = Aeson.object ["I64Option" .= __I64Option]
    toJSON (TUnion_FooOption __FooOption)
      = Aeson.object ["FooOption" .= __FooOption]
    toJSON TUnion_EMPTY = Aeson.object []
  
  instance Thrift.ThriftStruct TUnion where
    buildStruct _proxy (TUnion_StringOption __StringOption)
      = Thrift.genStruct _proxy
          [Thrift.genField _proxy "StringOption"
             (Thrift.getStringType _proxy)
             1
             0
             (Thrift.genText _proxy __StringOption)]
    buildStruct _proxy (TUnion_I64Option __I64Option)
      = Thrift.genStruct _proxy
          [Thrift.genFieldPrim _proxy "I64Option" (Thrift.getI64Type _proxy)
             2
             0
             (Thrift.genI64Prim _proxy)
             __I64Option]
    buildStruct _proxy (TUnion_FooOption __FooOption)
      = Thrift.genStruct _proxy
          [Thrift.genField _proxy "FooOption" (Thrift.getStructType _proxy) 3
             0
             (Thrift.buildStruct _proxy __FooOption)]
    buildStruct _proxy TUnion_EMPTY = Thrift.genStruct _proxy []
    parseStruct _proxy
      = do _fieldBegin <- Thrift.parseFieldBegin _proxy 0 _idMap
           case _fieldBegin of
             Thrift.FieldBegin _type _id _bool -> do case _id of
                                                       1 | _type == Thrift.getStringType _proxy ->
                                                           do _val <- Thrift.parseText _proxy
                                                              Thrift.parseStop _proxy
                                                              Prelude.return
                                                                (TUnion_StringOption _val)
                                                       2 | _type == Thrift.getI64Type _proxy ->
                                                           do _val <- Thrift.parseI64 _proxy
                                                              Thrift.parseStop _proxy
                                                              Prelude.return (TUnion_I64Option _val)
                                                       3 | _type == Thrift.getStructType _proxy ->
                                                           do _val <- Thrift.parseStruct _proxy
                                                              Thrift.parseStop _proxy
                                                              Prelude.return (TUnion_FooOption _val)
                                                       _ -> do Thrift.parseSkip _proxy _type
                                                                 Prelude.Nothing
                                                               Thrift.parseStop _proxy
                                                               Prelude.return TUnion_EMPTY
             Thrift.FieldEnd -> Prelude.return TUnion_EMPTY
      where
        _idMap
          = HashMap.fromList
              [("StringOption", 1), ("I64Option", 2), ("FooOption", 3)]
  
  instance DeepSeq.NFData TUnion where
    rnf (TUnion_StringOption __StringOption)
      = DeepSeq.rnf __StringOption
    rnf (TUnion_I64Option __I64Option) = DeepSeq.rnf __I64Option
    rnf (TUnion_FooOption __FooOption) = DeepSeq.rnf __FooOption
    rnf TUnion_EMPTY = ()
  
  instance Default.Default TUnion where
    def = TUnion_EMPTY
  
  instance Hashable.Hashable TUnion where
    hashWithSalt __salt (TUnion_StringOption _StringOption)
      = Hashable.hashWithSalt __salt
          (Hashable.hashWithSalt 1 _StringOption)
    hashWithSalt __salt (TUnion_I64Option _I64Option)
      = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 2 _I64Option)
    hashWithSalt __salt (TUnion_FooOption _FooOption)
      = Hashable.hashWithSalt __salt (Hashable.hashWithSalt 3 _FooOption)
    hashWithSalt __salt TUnion_EMPTY
      = Hashable.hashWithSalt __salt (0 :: Prelude.Int)
  
  data TestStruct = TestStruct{testStruct_f_bool :: Prelude.Bool,
                               testStruct_f_byte :: Int.Int8,
                               testStruct_f_double :: Prelude.Double,
                               testStruct_f_i16 :: Int.Int16, testStruct_f_i32 :: Int.Int32,
                               testStruct_f_i64 :: Int.Int64, testStruct_f_float :: Prelude.Float,
                               testStruct_f_list :: [Int.Int16],
                               testStruct_f_map :: Map.Map Int.Int16 Int.Int32,
                               testStruct_f_text :: Text.Text,
                               testStruct_f_set :: Set.Set Int.Int8,
                               testStruct_o_i32 :: Prelude.Maybe Int.Int32, testStruct_foo :: Foo,
                               testStruct_f_hash_map :: Map_Number_i64_1522,
                               testStruct_f_newtype :: Z, testStruct_f_union :: TUnion,
                               testStruct_f_string :: String_5858,
                               testStruct_f_binary :: ByteString.ByteString,
                               testStruct_f_optional_newtype :: Prelude.Maybe X,
                               testStruct_bool_map :: Map.Map Int.Int32 Prelude.Bool,
                               testStruct_bool_list :: [Prelude.Bool],
                               testStruct_i64_vec :: List_i64_7708,
                               testStruct_i64_svec :: List_i64_1894,
                               testStruct_binary_key :: Map.Map ByteString.ByteString Int.Int64,
                               testStruct_f_bytestring :: String_1484}
                    deriving (Prelude.Eq, Prelude.Show)
  
  instance Aeson.ToJSON TestStruct where
    toJSON
      (TestStruct __field__f_bool __field__f_byte __field__f_double
         __field__f_i16 __field__f_i32 __field__f_i64 __field__f_float
         __field__f_list __field__f_map __field__f_text __field__f_set
         __field__o_i32 __field__foo __field__f_hash_map __field__f_newtype
         __field__f_union __field__f_string __field__f_binary
         __field__f_optional_newtype __field__bool_map __field__bool_list
         __field__i64_vec __field__i64_svec __field__binary_key
         __field__f_bytestring)
      = Aeson.object
          ("f_bool" .= __field__f_bool :
             "f_byte" .= __field__f_byte :
               "f_double" .= __field__f_double :
                 "f_i16" .= __field__f_i16 :
                   "f_i32" .= __field__f_i32 :
                     "f_i64" .= __field__f_i64 :
                       "f_float" .= __field__f_float :
                         "f_list" .= __field__f_list :
                           "f_map" .= Map.mapKeys Thrift.keyToStr __field__f_map :
                             "f_text" .= __field__f_text :
                               "f_set" .= __field__f_set :
                                 Prelude.maybe Prelude.id ((:) . ("o_i32" .=)) __field__o_i32
                                   ("foo" .= __field__foo :
                                      "f_hash_map" .=
                                        Thrift.hmMapKeys Thrift.keyToStr __field__f_hash_map
                                        :
                                        "f_newtype" .= (unX . unZ) __field__f_newtype :
                                          "f_union" .= __field__f_union :
                                            "f_string" .= __field__f_string :
                                              "f_binary" .= Thrift.encodeBase64Text __field__f_binary
                                                :
                                                Prelude.maybe Prelude.id
                                                  ((:) . ("f_optional_newtype" .=))
                                                  (Prelude.fmap unX __field__f_optional_newtype)
                                                  ("bool_map" .=
                                                     Map.mapKeys Thrift.keyToStr __field__bool_map
                                                     :
                                                     "bool_list" .= __field__bool_list :
                                                       "i64_vec" .= __field__i64_vec :
                                                         "i64_svec" .= __field__i64_svec :
                                                           "binary_key" .=
                                                             Map.mapKeys Thrift.encodeBase64Text
                                                               __field__binary_key
                                                             :
                                                             "f_bytestring" .=
                                                               Text.decodeUtf8 __field__f_bytestring
                                                               : Prelude.mempty)))
  
  instance Thrift.ThriftStruct TestStruct where
    buildStruct _proxy
      (TestStruct __field__f_bool __field__f_byte __field__f_double
         __field__f_i16 __field__f_i32 __field__f_i64 __field__f_float
         __field__f_list __field__f_map __field__f_text __field__f_set
         __field__o_i32 __field__foo __field__f_hash_map __field__f_newtype
         __field__f_union __field__f_string __field__f_binary
         __field__f_optional_newtype __field__bool_map __field__bool_list
         __field__i64_vec __field__i64_svec __field__binary_key
         __field__f_bytestring)
      = Thrift.genStruct _proxy
          (Thrift.genFieldBool _proxy "f_bool" 1 0 __field__f_bool :
             Thrift.genFieldPrim _proxy "f_byte" (Thrift.getByteType _proxy) 2 1
               (Thrift.genBytePrim _proxy)
               __field__f_byte
               :
               Thrift.genField _proxy "f_double" (Thrift.getDoubleType _proxy) 3 2
                 (Thrift.genDouble _proxy __field__f_double)
                 :
                 Thrift.genFieldPrim _proxy "f_i16" (Thrift.getI16Type _proxy) 4 3
                   (Thrift.genI16Prim _proxy)
                   __field__f_i16
                   :
                   Thrift.genFieldPrim _proxy "f_i32" (Thrift.getI32Type _proxy) 5 4
                     (Thrift.genI32Prim _proxy)
                     __field__f_i32
                     :
                     Thrift.genFieldPrim _proxy "f_i64" (Thrift.getI64Type _proxy) 6 5
                       (Thrift.genI64Prim _proxy)
                       __field__f_i64
                       :
                       Thrift.genField _proxy "f_float" (Thrift.getFloatType _proxy) 7 6
                         (Thrift.genFloat _proxy __field__f_float)
                         :
                         Thrift.genField _proxy "f_list" (Thrift.getListType _proxy) 8 7
                           (Thrift.genListPrim _proxy (Thrift.getI16Type _proxy)
                              (Thrift.genI16Prim _proxy)
                              __field__f_list)
                           :
                           Thrift.genField _proxy "f_map" (Thrift.getMapType _proxy) 9 8
                             ((Thrift.genMapPrim _proxy (Thrift.getI16Type _proxy)
                                 (Thrift.getI32Type _proxy)
                                 Prelude.False
                                 (Thrift.genI16Prim _proxy)
                                 (Thrift.genI32Prim _proxy)
                                 . Map.toList)
                                __field__f_map)
                             :
                             Thrift.genField _proxy "f_text" (Thrift.getStringType _proxy) 10 9
                               (Thrift.genText _proxy __field__f_text)
                               :
                               Thrift.genField _proxy "f_set" (Thrift.getSetType _proxy) 11 10
                                 ((Thrift.genListPrim _proxy (Thrift.getByteType _proxy)
                                     (Thrift.genBytePrim _proxy)
                                     . Set.toList)
                                    __field__f_set)
                                 :
                                 let (__cereal__o_i32, __id__o_i32)
                                       = case __field__o_i32 of
                                           Prelude.Just _val -> ((:)
                                                                   (Thrift.genFieldPrim _proxy "o_i32"
                                                                      (Thrift.getI32Type _proxy)
                                                                      12
                                                                      11
                                                                      (Thrift.genI32Prim _proxy)
                                                                      _val),
                                                                 12)
                                           Prelude.Nothing -> (Prelude.id, 11)
                                   in
                                   __cereal__o_i32
                                     (Thrift.genField _proxy "foo" (Thrift.getStructType _proxy) 99
                                        __id__o_i32
                                        (Thrift.buildStruct _proxy __field__foo)
                                        :
                                        Thrift.genField _proxy "f_hash_map" (Thrift.getMapType _proxy)
                                          13
                                          99
                                          ((Thrift.genMap _proxy (Thrift.getI32Type _proxy)
                                              (Thrift.getI64Type _proxy)
                                              Prelude.False
                                              (Thrift.genI32 _proxy . Prelude.fromIntegral .
                                                 Thrift.fromThriftEnum)
                                              (Thrift.genI64 _proxy)
                                              . HashMap.toList)
                                             __field__f_hash_map)
                                          :
                                          Thrift.genField _proxy "f_newtype"
                                            (Thrift.getI64Type _proxy)
                                            14
                                            13
                                            ((Thrift.genI64 _proxy . unX . unZ) __field__f_newtype)
                                            :
                                            Thrift.genField _proxy "f_union"
                                              (Thrift.getStructType _proxy)
                                              15
                                              14
                                              (Thrift.buildStruct _proxy __field__f_union)
                                              :
                                              Thrift.genField _proxy "f_string"
                                                (Thrift.getStringType _proxy)
                                                16
                                                15
                                                ((Thrift.genText _proxy . Text.pack)
                                                   __field__f_string)
                                                :
                                                Thrift.genField _proxy "f_binary"
                                                  (Thrift.getStringType _proxy)
                                                  17
                                                  16
                                                  (Thrift.genBytes _proxy __field__f_binary)
                                                  :
                                                  let (__cereal__f_optional_newtype,
                                                       __id__f_optional_newtype)
                                                        = case __field__f_optional_newtype of
                                                            Prelude.Just _val -> ((:)
                                                                                    (Thrift.genField
                                                                                       _proxy
                                                                                       "f_optional_newtype"
                                                                                       (Thrift.getI64Type
                                                                                          _proxy)
                                                                                       18
                                                                                       17
                                                                                       ((Thrift.genI64
                                                                                           _proxy
                                                                                           . unX)
                                                                                          _val)),
                                                                                  18)
                                                            Prelude.Nothing -> (Prelude.id, 17)
                                                    in
                                                    __cereal__f_optional_newtype
                                                      (Thrift.genField _proxy "bool_map"
                                                         (Thrift.getMapType _proxy)
                                                         19
                                                         __id__f_optional_newtype
                                                         ((Thrift.genMapPrim _proxy
                                                             (Thrift.getI32Type _proxy)
                                                             (Thrift.getBoolType _proxy)
                                                             Prelude.False
                                                             (Thrift.genI32Prim _proxy)
                                                             (Thrift.genBoolPrim _proxy)
                                                             . Map.toList)
                                                            __field__bool_map)
                                                         :
                                                         Thrift.genField _proxy "bool_list"
                                                           (Thrift.getListType _proxy)
                                                           20
                                                           19
                                                           (Thrift.genListPrim _proxy
                                                              (Thrift.getBoolType _proxy)
                                                              (Thrift.genBoolPrim _proxy)
                                                              __field__bool_list)
                                                           :
                                                           Thrift.genField _proxy "i64_vec"
                                                             (Thrift.getListType _proxy)
                                                             21
                                                             20
                                                             ((Thrift.genListPrim _proxy
                                                                 (Thrift.getI64Type _proxy)
                                                                 (Thrift.genI64Prim _proxy)
                                                                 . Vector.toList)
                                                                __field__i64_vec)
                                                             :
                                                             Thrift.genField _proxy "i64_svec"
                                                               (Thrift.getListType _proxy)
                                                               22
                                                               21
                                                               ((Thrift.genListPrim _proxy
                                                                   (Thrift.getI64Type _proxy)
                                                                   (Thrift.genI64Prim _proxy)
                                                                   . VectorStorable.toList)
                                                                  __field__i64_svec)
                                                               :
                                                               Thrift.genField _proxy "binary_key"
                                                                 (Thrift.getMapType _proxy)
                                                                 23
                                                                 22
                                                                 ((Thrift.genMap _proxy
                                                                     (Thrift.getStringType _proxy)
                                                                     (Thrift.getI64Type _proxy)
                                                                     Prelude.True
                                                                     (Thrift.genBytes _proxy)
                                                                     (Thrift.genI64 _proxy)
                                                                     . Map.toList)
                                                                    __field__binary_key)
                                                                 :
                                                                 Thrift.genField _proxy "f_bytestring"
                                                                   (Thrift.getStringType _proxy)
                                                                   24
                                                                   23
                                                                   (Thrift.genByteString _proxy
                                                                      __field__f_bytestring)
                                                                   : [])))
    parseStruct _proxy
      = ST.runSTT
          (do Prelude.return ()
              __field__f_bool <- ST.newSTRef Prelude.Nothing
              __field__f_byte <- ST.newSTRef Default.def
              __field__f_double <- ST.newSTRef Default.def
              __field__f_i16 <- ST.newSTRef 5
              __field__f_i32 <- ST.newSTRef Default.def
              __field__f_i64 <- ST.newSTRef Default.def
              __field__f_float <- ST.newSTRef Default.def
              __field__f_list <- ST.newSTRef Default.def
              __field__f_map <- ST.newSTRef (Map.fromList [(1, 2)])
              __field__f_text <- ST.newSTRef ""
              __field__f_set <- ST.newSTRef Default.def
              __field__o_i32 <- ST.newSTRef Prelude.Nothing
              __field__foo <- ST.newSTRef
                                (Default.def :: Foo){foo_bar = 1, foo_baz = 2}
              __field__f_hash_map <- ST.newSTRef HashMap.empty
              __field__f_newtype <- ST.newSTRef (Z (X Default.def))
              __field__f_union <- ST.newSTRef Default.def
              __field__f_string <- ST.newSTRef Default.def
              __field__f_binary <- ST.newSTRef ""
              __field__f_optional_newtype <- ST.newSTRef Prelude.Nothing
              __field__bool_map <- ST.newSTRef Default.def
              __field__bool_list <- ST.newSTRef Default.def
              __field__i64_vec <- ST.newSTRef Vector.empty
              __field__i64_svec <- ST.newSTRef VectorStorable.empty
              __field__binary_key <- ST.newSTRef Default.def
              __field__f_bytestring <- ST.newSTRef Default.def
              let
                _parse _lastId
                  = do _fieldBegin <- Trans.lift
                                        (Thrift.parseFieldBegin _proxy _lastId _idMap)
                       case _fieldBegin of
                         Thrift.FieldBegin _type _id _bool -> do case _id of
                                                                   1 | _type ==
                                                                         Thrift.getBoolType _proxy
                                                                       ->
                                                                       do !_val <- Trans.lift
                                                                                     (Thrift.parseBoolF
                                                                                        _proxy
                                                                                        _bool)
                                                                          ST.writeSTRef
                                                                            __field__f_bool
                                                                            (Prelude.Just _val)
                                                                   2 | _type ==
                                                                         Thrift.getByteType _proxy
                                                                       ->
                                                                       do !_val <- Trans.lift
                                                                                     (Thrift.parseByte
                                                                                        _proxy)
                                                                          ST.writeSTRef
                                                                            __field__f_byte
                                                                            _val
                                                                   3 | _type ==
                                                                         Thrift.getDoubleType _proxy
                                                                       ->
                                                                       do !_val <- Trans.lift
                                                                                     (Thrift.parseDouble
                                                                                        _proxy)
                                                                          ST.writeSTRef
                                                                            __field__f_double
                                                                            _val
                                                                   4 | _type ==
                                                                         Thrift.getI16Type _proxy
                                                                       ->
                                                                       do !_val <- Trans.lift
                                                                                     (Thrift.parseI16
                                                                                        _proxy)
                                                                          ST.writeSTRef __field__f_i16
                                                                            _val
                                                                   5 | _type ==
                                                                         Thrift.getI32Type _proxy
                                                                       ->
                                                                       do !_val <- Trans.lift
                                                                                     (Thrift.parseI32
                                                                                        _proxy)
                                                                          ST.writeSTRef __field__f_i32
                                                                            _val
                                                                   6 | _type ==
                                                                         Thrift.getI64Type _proxy
                                                                       ->
                                                                       do !_val <- Trans.lift
                                                                                     (Thrift.parseI64
                                                                                        _proxy)
                                                                          ST.writeSTRef __field__f_i64
                                                                            _val
                                                                   7 | _type ==
                                                                         Thrift.getFloatType _proxy
                                                                       ->
                                                                       do !_val <- Trans.lift
                                                                                     (Thrift.parseFloat
                                                                                        _proxy)
                                                                          ST.writeSTRef
                                                                            __field__f_float
                                                                            _val
                                                                   8 | _type ==
                                                                         Thrift.getListType _proxy
                                                                       ->
                                                                       do !_val <- Trans.lift
                                                                                     (Prelude.snd <$>
                                                                                        Thrift.parseList
                                                                                          _proxy
                                                                                          (Thrift.parseI16
                                                                                             _proxy))
                                                                          ST.writeSTRef
                                                                            __field__f_list
                                                                            _val
                                                                   9 | _type ==
                                                                         Thrift.getMapType _proxy
                                                                       ->
                                                                       do !_val <- Trans.lift
                                                                                     (Map.fromList <$>
                                                                                        Thrift.parseMap
                                                                                          _proxy
                                                                                          (Thrift.parseI16
                                                                                             _proxy)
                                                                                          (Thrift.parseI32
                                                                                             _proxy)
                                                                                          Prelude.False)
                                                                          ST.writeSTRef __field__f_map
                                                                            _val
                                                                   10 | _type ==
                                                                          Thrift.getStringType _proxy
                                                                        ->
                                                                        do !_val <- Trans.lift
                                                                                      (Thrift.parseText
                                                                                         _proxy)
                                                                           ST.writeSTRef
                                                                             __field__f_text
                                                                             _val
                                                                   11 | _type ==
                                                                          Thrift.getSetType _proxy
                                                                        ->
                                                                        do !_val <- Trans.lift
                                                                                      (Set.fromList .
                                                                                         Prelude.snd
                                                                                         <$>
                                                                                         Thrift.parseList
                                                                                           _proxy
                                                                                           (Thrift.parseByte
                                                                                              _proxy))
                                                                           ST.writeSTRef
                                                                             __field__f_set
                                                                             _val
                                                                   12 | _type ==
                                                                          Thrift.getI32Type _proxy
                                                                        ->
                                                                        do !_val <- Trans.lift
                                                                                      (Thrift.parseI32
                                                                                         _proxy)
                                                                           ST.writeSTRef
                                                                             __field__o_i32
                                                                             (Prelude.Just _val)
                                                                   99 | _type ==
                                                                          Thrift.getStructType _proxy
                                                                        ->
                                                                        do !_val <- Trans.lift
                                                                                      (Thrift.parseStruct
                                                                                         _proxy)
                                                                           ST.writeSTRef __field__foo
                                                                             _val
                                                                   13 | _type ==
                                                                          Thrift.getMapType _proxy
                                                                        ->
                                                                        do !_val <- Trans.lift
                                                                                      (HashMap.fromList
                                                                                         <$>
                                                                                         Thrift.parseMap
                                                                                           _proxy
                                                                                           (Thrift.parseEnum
                                                                                              _proxy
                                                                                              "Number")
                                                                                           (Thrift.parseI64
                                                                                              _proxy)
                                                                                           Prelude.False)
                                                                           ST.writeSTRef
                                                                             __field__f_hash_map
                                                                             _val
                                                                   14 | _type ==
                                                                          Thrift.getI64Type _proxy
                                                                        ->
                                                                        do !_val <- Trans.lift
                                                                                      (Prelude.fmap Z
                                                                                         (Prelude.fmap
                                                                                            X
                                                                                            (Thrift.parseI64
                                                                                               _proxy)))
                                                                           ST.writeSTRef
                                                                             __field__f_newtype
                                                                             _val
                                                                   15 | _type ==
                                                                          Thrift.getStructType _proxy
                                                                        ->
                                                                        do !_val <- Trans.lift
                                                                                      (Thrift.parseStruct
                                                                                         _proxy)
                                                                           ST.writeSTRef
                                                                             __field__f_union
                                                                             _val
                                                                   16 | _type ==
                                                                          Thrift.getStringType _proxy
                                                                        ->
                                                                        do !_val <- Trans.lift
                                                                                      (Text.unpack <$>
                                                                                         Thrift.parseText
                                                                                           _proxy)
                                                                           ST.writeSTRef
                                                                             __field__f_string
                                                                             _val
                                                                   17 | _type ==
                                                                          Thrift.getStringType _proxy
                                                                        ->
                                                                        do !_val <- Trans.lift
                                                                                      (Thrift.parseBytes
                                                                                         _proxy)
                                                                           ST.writeSTRef
                                                                             __field__f_binary
                                                                             _val
                                                                   18 | _type ==
                                                                          Thrift.getI64Type _proxy
                                                                        ->
                                                                        do !_val <- Trans.lift
                                                                                      (Prelude.fmap X
                                                                                         (Thrift.parseI64
                                                                                            _proxy))
                                                                           ST.writeSTRef
                                                                             __field__f_optional_newtype
                                                                             (Prelude.Just _val)
                                                                   19 | _type ==
                                                                          Thrift.getMapType _proxy
                                                                        ->
                                                                        do !_val <- Trans.lift
                                                                                      (Map.fromList
                                                                                         <$>
                                                                                         Thrift.parseMap
                                                                                           _proxy
                                                                                           (Thrift.parseI32
                                                                                              _proxy)
                                                                                           (Thrift.parseBool
                                                                                              _proxy)
                                                                                           Prelude.False)
                                                                           ST.writeSTRef
                                                                             __field__bool_map
                                                                             _val
                                                                   20 | _type ==
                                                                          Thrift.getListType _proxy
                                                                        ->
                                                                        do !_val <- Trans.lift
                                                                                      (Prelude.snd <$>
                                                                                         Thrift.parseList
                                                                                           _proxy
                                                                                           (Thrift.parseBool
                                                                                              _proxy))
                                                                           ST.writeSTRef
                                                                             __field__bool_list
                                                                             _val
                                                                   21 | _type ==
                                                                          Thrift.getListType _proxy
                                                                        ->
                                                                        do !_val <- Trans.lift
                                                                                      (Prelude.uncurry
                                                                                         Vector.fromListN
                                                                                         <$>
                                                                                         Thrift.parseList
                                                                                           _proxy
                                                                                           (Thrift.parseI64
                                                                                              _proxy))
                                                                           ST.writeSTRef
                                                                             __field__i64_vec
                                                                             _val
                                                                   22 | _type ==
                                                                          Thrift.getListType _proxy
                                                                        ->
                                                                        do !_val <- Trans.lift
                                                                                      (Prelude.uncurry
                                                                                         VectorStorable.fromListN
                                                                                         <$>
                                                                                         Thrift.parseList
                                                                                           _proxy
                                                                                           (Thrift.parseI64
                                                                                              _proxy))
                                                                           ST.writeSTRef
                                                                             __field__i64_svec
                                                                             _val
                                                                   23 | _type ==
                                                                          Thrift.getMapType _proxy
                                                                        ->
                                                                        do !_val <- Trans.lift
                                                                                      (Map.fromList
                                                                                         <$>
                                                                                         Thrift.parseMap
                                                                                           _proxy
                                                                                           (Thrift.parseBytes
                                                                                              _proxy)
                                                                                           (Thrift.parseI64
                                                                                              _proxy)
                                                                                           Prelude.True)
                                                                           ST.writeSTRef
                                                                             __field__binary_key
                                                                             _val
                                                                   24 | _type ==
                                                                          Thrift.getStringType _proxy
                                                                        ->
                                                                        do !_val <- Trans.lift
                                                                                      (Thrift.parseByteString
                                                                                         _proxy)
                                                                           ST.writeSTRef
                                                                             __field__f_bytestring
                                                                             _val
                                                                   _ -> Trans.lift
                                                                          (Thrift.parseSkip _proxy
                                                                             _type
                                                                             (Prelude.Just _bool))
                                                                 _parse _id
                         Thrift.FieldEnd -> do !__maybe__f_bool <- ST.readSTRef
                                                                     __field__f_bool
                                               !__val__f_byte <- ST.readSTRef __field__f_byte
                                               !__val__f_double <- ST.readSTRef __field__f_double
                                               !__val__f_i16 <- ST.readSTRef __field__f_i16
                                               !__val__f_i32 <- ST.readSTRef __field__f_i32
                                               !__val__f_i64 <- ST.readSTRef __field__f_i64
                                               !__val__f_float <- ST.readSTRef __field__f_float
                                               !__val__f_list <- ST.readSTRef __field__f_list
                                               !__val__f_map <- ST.readSTRef __field__f_map
                                               !__val__f_text <- ST.readSTRef __field__f_text
                                               !__val__f_set <- ST.readSTRef __field__f_set
                                               !__val__o_i32 <- ST.readSTRef __field__o_i32
                                               !__val__foo <- ST.readSTRef __field__foo
                                               !__val__f_hash_map <- ST.readSTRef __field__f_hash_map
                                               !__val__f_newtype <- ST.readSTRef __field__f_newtype
                                               !__val__f_union <- ST.readSTRef __field__f_union
                                               !__val__f_string <- ST.readSTRef __field__f_string
                                               !__val__f_binary <- ST.readSTRef __field__f_binary
                                               !__val__f_optional_newtype <- ST.readSTRef
                                                                               __field__f_optional_newtype
                                               !__val__bool_map <- ST.readSTRef __field__bool_map
                                               !__val__bool_list <- ST.readSTRef __field__bool_list
                                               !__val__i64_vec <- ST.readSTRef __field__i64_vec
                                               !__val__i64_svec <- ST.readSTRef __field__i64_svec
                                               !__val__binary_key <- ST.readSTRef __field__binary_key
                                               !__val__f_bytestring <- ST.readSTRef
                                                                         __field__f_bytestring
                                               case __maybe__f_bool of
                                                 Prelude.Nothing -> Prelude.fail
                                                                      "Error parsing type TestStruct: missing required field f_bool of type Prelude.Bool"
                                                 Prelude.Just __val__f_bool -> Prelude.pure
                                                                                 (TestStruct
                                                                                    __val__f_bool
                                                                                    __val__f_byte
                                                                                    __val__f_double
                                                                                    __val__f_i16
                                                                                    __val__f_i32
                                                                                    __val__f_i64
                                                                                    __val__f_float
                                                                                    __val__f_list
                                                                                    __val__f_map
                                                                                    __val__f_text
                                                                                    __val__f_set
                                                                                    __val__o_i32
                                                                                    __val__foo
                                                                                    __val__f_hash_map
                                                                                    __val__f_newtype
                                                                                    __val__f_union
                                                                                    __val__f_string
                                                                                    __val__f_binary
                                                                                    __val__f_optional_newtype
                                                                                    __val__bool_map
                                                                                    __val__bool_list
                                                                                    __val__i64_vec
                                                                                    __val__i64_svec
                                                                                    __val__binary_key
                                                                                    __val__f_bytestring)
                _idMap
                  = HashMap.fromList
                      [("f_bool", 1), ("f_byte", 2), ("f_double", 3), ("f_i16", 4),
                       ("f_i32", 5), ("f_i64", 6), ("f_float", 7), ("f_list", 8),
                       ("f_map", 9), ("f_text", 10), ("f_set", 11), ("o_i32", 12),
                       ("foo", 99), ("f_hash_map", 13), ("f_newtype", 14),
                       ("f_union", 15), ("f_string", 16), ("f_binary", 17),
                       ("f_optional_newtype", 18), ("bool_map", 19), ("bool_list", 20),
                       ("i64_vec", 21), ("i64_svec", 22), ("binary_key", 23),
                       ("f_bytestring", 24)]
              _parse 0)
  
  instance DeepSeq.NFData TestStruct where
    rnf
      (TestStruct __field__f_bool __field__f_byte __field__f_double
         __field__f_i16 __field__f_i32 __field__f_i64 __field__f_float
         __field__f_list __field__f_map __field__f_text __field__f_set
         __field__o_i32 __field__foo __field__f_hash_map __field__f_newtype
         __field__f_union __field__f_string __field__f_binary
         __field__f_optional_newtype __field__bool_map __field__bool_list
         __field__i64_vec __field__i64_svec __field__binary_key
         __field__f_bytestring)
      = DeepSeq.rnf __field__f_bool `Prelude.seq`
          DeepSeq.rnf __field__f_byte `Prelude.seq`
            DeepSeq.rnf __field__f_double `Prelude.seq`
              DeepSeq.rnf __field__f_i16 `Prelude.seq`
                DeepSeq.rnf __field__f_i32 `Prelude.seq`
                  DeepSeq.rnf __field__f_i64 `Prelude.seq`
                    DeepSeq.rnf __field__f_float `Prelude.seq`
                      DeepSeq.rnf __field__f_list `Prelude.seq`
                        DeepSeq.rnf __field__f_map `Prelude.seq`
                          DeepSeq.rnf __field__f_text `Prelude.seq`
                            DeepSeq.rnf __field__f_set `Prelude.seq`
                              DeepSeq.rnf __field__o_i32 `Prelude.seq`
                                DeepSeq.rnf __field__foo `Prelude.seq`
                                  DeepSeq.rnf __field__f_hash_map `Prelude.seq`
                                    DeepSeq.rnf __field__f_newtype `Prelude.seq`
                                      DeepSeq.rnf __field__f_union `Prelude.seq`
                                        DeepSeq.rnf __field__f_string `Prelude.seq`
                                          DeepSeq.rnf __field__f_binary `Prelude.seq`
                                            DeepSeq.rnf __field__f_optional_newtype `Prelude.seq`
                                              DeepSeq.rnf __field__bool_map `Prelude.seq`
                                                DeepSeq.rnf __field__bool_list `Prelude.seq`
                                                  DeepSeq.rnf __field__i64_vec `Prelude.seq`
                                                    DeepSeq.rnf __field__i64_svec `Prelude.seq`
                                                      DeepSeq.rnf __field__binary_key `Prelude.seq`
                                                        DeepSeq.rnf __field__f_bytestring
                                                          `Prelude.seq` ()
  
  instance Default.Default TestStruct where
    def
      = TestStruct Prelude.False Default.def Default.def 5 Default.def
          Default.def
          Default.def
          Default.def
          (Map.fromList [(1, 2)])
          ""
          Default.def
          Prelude.Nothing
          (Default.def :: Foo){foo_bar = 1, foo_baz = 2}
          HashMap.empty
          (Z (X Default.def))
          Default.def
          Default.def
          ""
          Prelude.Nothing
          Default.def
          Default.def
          Vector.empty
          VectorStorable.empty
          Default.def
          Default.def
  
  instance Hashable.Hashable TestStruct where
    hashWithSalt __salt
      (TestStruct _f_bool _f_byte _f_double _f_i16 _f_i32 _f_i64 _f_float
         _f_list _f_map _f_text _f_set _o_i32 _foo _f_hash_map _f_newtype
         _f_union _f_string _f_binary _f_optional_newtype _bool_map
         _bool_list _i64_vec _i64_svec _binary_key _f_bytestring)
      = Hashable.hashWithSalt
          (Hashable.hashWithSalt
             (Hashable.hashWithSalt
                (Hashable.hashWithSalt
                   (Hashable.hashWithSalt
                      (Hashable.hashWithSalt
                         (Hashable.hashWithSalt
                            (Hashable.hashWithSalt
                               (Hashable.hashWithSalt
                                  (Hashable.hashWithSalt
                                     (Hashable.hashWithSalt
                                        (Hashable.hashWithSalt
                                           (Hashable.hashWithSalt
                                              (Hashable.hashWithSalt
                                                 (Hashable.hashWithSalt
                                                    (Hashable.hashWithSalt
                                                       (Hashable.hashWithSalt
                                                          (Hashable.hashWithSalt
                                                             (Hashable.hashWithSalt
                                                                (Hashable.hashWithSalt
                                                                   (Hashable.hashWithSalt
                                                                      (Hashable.hashWithSalt
                                                                         (Hashable.hashWithSalt
                                                                            (Hashable.hashWithSalt
                                                                               (Hashable.hashWithSalt
                                                                                  __salt
                                                                                  _f_bool)
                                                                               _f_byte)
                                                                            _f_double)
                                                                         _f_i16)
                                                                      _f_i32)
                                                                   _f_i64)
                                                                _f_float)
                                                             _f_list)
                                                          ((Prelude.map (\ (_k, _v) -> (_k, _v)) .
                                                              Map.toAscList)
                                                             _f_map))
                                                       _f_text)
                                                    (Set.elems _f_set))
                                                 _o_i32)
                                              _foo)
                                           ((List.sort .
                                               Prelude.map (\ (_k, _v) -> (_k, _v)) . HashMap.toList)
                                              _f_hash_map))
                                        _f_newtype)
                                     _f_union)
                                  _f_string)
                               _f_binary)
                            _f_optional_newtype)
                         ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList) _bool_map))
                      _bool_list)
                   (Vector.toList _i64_vec))
                (VectorStorable.toList _i64_svec))
             ((Prelude.map (\ (_k, _v) -> (_k, _v)) . Map.toAscList)
                _binary_key))
          _f_bytestring
  
  instance Ord.Ord TestStruct where
    compare __a __b
      = case Ord.compare (testStruct_f_bool __a) (testStruct_f_bool __b)
          of
          Ord.LT -> Ord.LT
          Ord.GT -> Ord.GT
          Ord.EQ -> case
                      Ord.compare (testStruct_f_byte __a) (testStruct_f_byte __b) of
                      Ord.LT -> Ord.LT
                      Ord.GT -> Ord.GT
                      Ord.EQ -> case
                                  Ord.compare (testStruct_f_double __a) (testStruct_f_double __b) of
                                  Ord.LT -> Ord.LT
                                  Ord.GT -> Ord.GT
                                  Ord.EQ -> case
                                              Ord.compare (testStruct_f_i16 __a)
                                                (testStruct_f_i16 __b)
                                              of
                                              Ord.LT -> Ord.LT
                                              Ord.GT -> Ord.GT
                                              Ord.EQ -> case
                                                          Ord.compare (testStruct_f_i32 __a)
                                                            (testStruct_f_i32 __b)
                                                          of
                                                          Ord.LT -> Ord.LT
                                                          Ord.GT -> Ord.GT
                                                          Ord.EQ -> case
                                                                      Ord.compare
                                                                        (testStruct_f_i64 __a)
                                                                        (testStruct_f_i64 __b)
                                                                      of
                                                                      Ord.LT -> Ord.LT
                                                                      Ord.GT -> Ord.GT
                                                                      Ord.EQ -> case
                                                                                  Ord.compare
                                                                                    (testStruct_f_float
                                                                                       __a)
                                                                                    (testStruct_f_float
                                                                                       __b)
                                                                                  of
                                                                                  Ord.LT -> Ord.LT
                                                                                  Ord.GT -> Ord.GT
                                                                                  Ord.EQ -> case
                                                                                              Ord.compare
                                                                                                (testStruct_f_list
                                                                                                   __a)
                                                                                                (testStruct_f_list
                                                                                                   __b)
                                                                                              of
                                                                                              Ord.LT -> Ord.LT
                                                                                              Ord.GT -> Ord.GT
                                                                                              Ord.EQ -> case
                                                                                                          Ord.compare
                                                                                                            (testStruct_f_map
                                                                                                               __a)
                                                                                                            (testStruct_f_map
                                                                                                               __b)
                                                                                                          of
                                                                                                          Ord.LT -> Ord.LT
                                                                                                          Ord.GT -> Ord.GT
                                                                                                          Ord.EQ -> case
                                                                                                                      Ord.compare
                                                                                                                        (testStruct_f_text
                                                                                                                           __a)
                                                                                                                        (testStruct_f_text
                                                                                                                           __b)
                                                                                                                      of
                                                                                                                      Ord.LT -> Ord.LT
                                                                                                                      Ord.GT -> Ord.GT
                                                                                                                      Ord.EQ -> case
                                                                                                                                  Ord.compare
                                                                                                                                    (testStruct_f_set
                                                                                                                                       __a)
                                                                                                                                    (testStruct_f_set
                                                                                                                                       __b)
                                                                                                                                  of
                                                                                                                                  Ord.LT -> Ord.LT
                                                                                                                                  Ord.GT -> Ord.GT
                                                                                                                                  Ord.EQ -> case
                                                                                                                                              Ord.compare
                                                                                                                                                (testStruct_o_i32
                                                                                                                                                   __a)
                                                                                                                                                (testStruct_o_i32
                                                                                                                                                   __b)
                                                                                                                                              of
                                                                                                                                              Ord.LT -> Ord.LT
                                                                                                                                              Ord.GT -> Ord.GT
                                                                                                                                              Ord.EQ -> case
                                                                                                                                                          Ord.compare
                                                                                                                                                            (testStruct_foo
                                                                                                                                                               __a)
                                                                                                                                                            (testStruct_foo
                                                                                                                                                               __b)
                                                                                                                                                          of
                                                                                                                                                          Ord.LT -> Ord.LT
                                                                                                                                                          Ord.GT -> Ord.GT
                                                                                                                                                          Ord.EQ -> case
                                                                                                                                                                      Ord.compare
                                                                                                                                                                        ((List.sort
                                                                                                                                                                            .
                                                                                                                                                                            Prelude.map
                                                                                                                                                                              (\ (_k,
                                                                                                                                                                                  _v)
                                                                                                                                                                                 ->
                                                                                                                                                                                 (_k,
                                                                                                                                                                                  _v))
                                                                                                                                                                              .
                                                                                                                                                                              HashMap.toList)
                                                                                                                                                                           (testStruct_f_hash_map
                                                                                                                                                                              __a))
                                                                                                                                                                        ((List.sort
                                                                                                                                                                            .
                                                                                                                                                                            Prelude.map
                                                                                                                                                                              (\ (_k,
                                                                                                                                                                                  _v)
                                                                                                                                                                                 ->
                                                                                                                                                                                 (_k,
                                                                                                                                                                                  _v))
                                                                                                                                                                              .
                                                                                                                                                                              HashMap.toList)
                                                                                                                                                                           (testStruct_f_hash_map
                                                                                                                                                                              __b))
                                                                                                                                                                      of
                                                                                                                                                                      Ord.LT -> Ord.LT
                                                                                                                                                                      Ord.GT -> Ord.GT
                                                                                                                                                                      Ord.EQ -> case
                                                                                                                                                                                  Ord.compare
                                                                                                                                                                                    (testStruct_f_newtype
                                                                                                                                                                                       __a)
                                                                                                                                                                                    (testStruct_f_newtype
                                                                                                                                                                                       __b)
                                                                                                                                                                                  of
                                                                                                                                                                                  Ord.LT -> Ord.LT
                                                                                                                                                                                  Ord.GT -> Ord.GT
                                                                                                                                                                                  Ord.EQ -> case
                                                                                                                                                                                              Ord.compare
                                                                                                                                                                                                (testStruct_f_union
                                                                                                                                                                                                   __a)
                                                                                                                                                                                                (testStruct_f_union
                                                                                                                                                                                                   __b)
                                                                                                                                                                                              of
                                                                                                                                                                                              Ord.LT -> Ord.LT
                                                                                                                                                                                              Ord.GT -> Ord.GT
                                                                                                                                                                                              Ord.EQ -> case
                                                                                                                                                                                                          Ord.compare
                                                                                                                                                                                                            (testStruct_f_string
                                                                                                                                                                                                               __a)
                                                                                                                                                                                                            (testStruct_f_string
                                                                                                                                                                                                               __b)
                                                                                                                                                                                                          of
                                                                                                                                                                                                          Ord.LT -> Ord.LT
                                                                                                                                                                                                          Ord.GT -> Ord.GT
                                                                                                                                                                                                          Ord.EQ -> case
                                                                                                                                                                                                                      Ord.compare
                                                                                                                                                                                                                        (testStruct_f_binary
                                                                                                                                                                                                                           __a)
                                                                                                                                                                                                                        (testStruct_f_binary
                                                                                                                                                                                                                           __b)
                                                                                                                                                                                                                      of
                                                                                                                                                                                                                      Ord.LT -> Ord.LT
                                                                                                                                                                                                                      Ord.GT -> Ord.GT
                                                                                                                                                                                                                      Ord.EQ -> case
                                                                                                                                                                                                                                  Ord.compare
                                                                                                                                                                                                                                    (testStruct_f_optional_newtype
                                                                                                                                                                                                                                       __a)
                                                                                                                                                                                                                                    (testStruct_f_optional_newtype
                                                                                                                                                                                                                                       __b)
                                                                                                                                                                                                                                  of
                                                                                                                                                                                                                                  Ord.LT -> Ord.LT
                                                                                                                                                                                                                                  Ord.GT -> Ord.GT
                                                                                                                                                                                                                                  Ord.EQ -> case
                                                                                                                                                                                                                                              Ord.compare
                                                                                                                                                                                                                                                (testStruct_bool_map
                                                                                                                                                                                                                                                   __a)
                                                                                                                                                                                                                                                (testStruct_bool_map
                                                                                                                                                                                                                                                   __b)
                                                                                                                                                                                                                                              of
                                                                                                                                                                                                                                              Ord.LT -> Ord.LT
                                                                                                                                                                                                                                              Ord.GT -> Ord.GT
                                                                                                                                                                                                                                              Ord.EQ -> case
                                                                                                                                                                                                                                                          Ord.compare
                                                                                                                                                                                                                                                            (testStruct_bool_list
                                                                                                                                                                                                                                                               __a)
                                                                                                                                                                                                                                                            (testStruct_bool_list
                                                                                                                                                                                                                                                               __b)
                                                                                                                                                                                                                                                          of
                                                                                                                                                                                                                                                          Ord.LT -> Ord.LT
                                                                                                                                                                                                                                                          Ord.GT -> Ord.GT
                                                                                                                                                                                                                                                          Ord.EQ -> case
                                                                                                                                                                                                                                                                      Ord.compare
                                                                                                                                                                                                                                                                        (testStruct_i64_vec
                                                                                                                                                                                                                                                                           __a)
                                                                                                                                                                                                                                                                        (testStruct_i64_vec
                                                                                                                                                                                                                                                                           __b)
                                                                                                                                                                                                                                                                      of
                                                                                                                                                                                                                                                                      Ord.LT -> Ord.LT
                                                                                                                                                                                                                                                                      Ord.GT -> Ord.GT
                                                                                                                                                                                                                                                                      Ord.EQ -> case
                                                                                                                                                                                                                                                                                  Ord.compare
                                                                                                                                                                                                                                                                                    (testStruct_i64_svec
                                                                                                                                                                                                                                                                                       __a)
                                                                                                                                                                                                                                                                                    (testStruct_i64_svec
                                                                                                                                                                                                                                                                                       __b)
                                                                                                                                                                                                                                                                                  of
                                                                                                                                                                                                                                                                                  Ord.LT -> Ord.LT
                                                                                                                                                                                                                                                                                  Ord.GT -> Ord.GT
                                                                                                                                                                                                                                                                                  Ord.EQ -> case
                                                                                                                                                                                                                                                                                              Ord.compare
                                                                                                                                                                                                                                                                                                (testStruct_binary_key
                                                                                                                                                                                                                                                                                                   __a)
                                                                                                                                                                                                                                                                                                (testStruct_binary_key
                                                                                                                                                                                                                                                                                                   __b)
                                                                                                                                                                                                                                                                                              of
                                                                                                                                                                                                                                                                                              Ord.LT -> Ord.LT
                                                                                                                                                                                                                                                                                              Ord.GT -> Ord.GT
                                                                                                                                                                                                                                                                                              Ord.EQ -> Ord.compare
                                                                                                                                                                                                                                                                                                          (testStruct_f_bytestring
                                                                                                                                                                                                                                                                                                             __a)
                                                                                                                                                                                                                                                                                                          (testStruct_f_bytestring
                                                                                                                                                                                                                                                                                                             __b)
  
  data Number = Number_One
              | Number_Two
              | Number_Three
              | Number__UNKNOWN Prelude.Int
                deriving (Prelude.Eq, Prelude.Show)
  
  instance Aeson.ToJSON Number where
    toJSON = Aeson.toJSON . Thrift.fromThriftEnum
  
  instance DeepSeq.NFData Number where
    rnf __Number = Prelude.seq __Number ()
  
  instance Default.Default Number where
    def = Number_One
  
  instance Hashable.Hashable Number where
    hashWithSalt _salt _val
      = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
  
  instance Thrift.ThriftEnum Number where
    toThriftEnum 1 = Number_One
    toThriftEnum 2 = Number_Two
    toThriftEnum 3 = Number_Three
    toThriftEnum val = Number__UNKNOWN val
    fromThriftEnum Number_One = 1
    fromThriftEnum Number_Two = 2
    fromThriftEnum Number_Three = 3
    fromThriftEnum (Number__UNKNOWN val) = val
    allThriftEnumValues = [Number_One, Number_Two, Number_Three]
    toThriftEnumEither 1 = Prelude.Right Number_One
    toThriftEnumEither 2 = Prelude.Right Number_Two
    toThriftEnumEither 3 = Prelude.Right Number_Three
    toThriftEnumEither val
      = Prelude.Left
          ("toThriftEnumEither: not a valid identifier for enum Number: " ++
             Prelude.show val)
  
  instance Prelude.Ord Number where
    compare = Function.on Prelude.compare Thrift.fromThriftEnum
  
  data Perfect = Perfect_A
               | Perfect_B
               | Perfect_C
               | Perfect__UNKNOWN Prelude.Int
                 deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
  
  instance Aeson.ToJSON Perfect where
    toJSON = Aeson.toJSON . Thrift.fromThriftEnum
  
  instance DeepSeq.NFData Perfect where
    rnf __Perfect = Prelude.seq __Perfect ()
  
  instance Default.Default Perfect where
    def = Perfect_A
  
  instance Hashable.Hashable Perfect where
    hashWithSalt _salt _val
      = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
  
  instance Thrift.ThriftEnum Perfect where
    toThriftEnum 0 = Perfect_A
    toThriftEnum 1 = Perfect_B
    toThriftEnum 2 = Perfect_C
    toThriftEnum val = Perfect__UNKNOWN val
    fromThriftEnum Perfect_A = 0
    fromThriftEnum Perfect_B = 1
    fromThriftEnum Perfect_C = 2
    fromThriftEnum (Perfect__UNKNOWN val) = val
    allThriftEnumValues = [Perfect_A, Perfect_B, Perfect_C]
    toThriftEnumEither 0 = Prelude.Right Perfect_A
    toThriftEnumEither 1 = Prelude.Right Perfect_B
    toThriftEnumEither 2 = Prelude.Right Perfect_C
    toThriftEnumEither val
      = Prelude.Left
          ("toThriftEnumEither: not a valid identifier for enum Perfect: " ++
             Prelude.show val)
  
  data Void = Void__UNKNOWN Prelude.Int
              deriving (Prelude.Eq, Prelude.Show, Prelude.Ord)
  
  instance Aeson.ToJSON Void where
    toJSON = Aeson.toJSON . Thrift.fromThriftEnum
  
  instance DeepSeq.NFData Void where
    rnf __Void = Prelude.seq __Void ()
  
  instance Default.Default Void where
    def
      = Exception.throw
          (Thrift.ProtocolException "def: enum Void has no constructors")
  
  instance Hashable.Hashable Void where
    hashWithSalt _salt _val
      = Hashable.hashWithSalt _salt (Thrift.fromThriftEnum _val)
  
  instance Thrift.ThriftEnum Void where
    toThriftEnum val = Void__UNKNOWN val
    fromThriftEnum (Void__UNKNOWN val) = val
    allThriftEnumValues = []
    toThriftEnumEither val
      = Prelude.Left
          ("toThriftEnumEither: not a valid identifier for enum Void: " ++
             Prelude.show val)
  
  type List_i64_1894 = VectorStorable.Vector Int.Int64
  
  type List_i64_7708 = Vector.Vector Int.Int64
  
  type Map_Number_i64_1522 = HashMap.HashMap Number Int.Int64
  
  type String_1484 = ByteString.ByteString
  
  type String_5858 = Prelude.String
  {-# LINE 9 "if/hs_test_instances.hs" #-}
  instance QuickCheck.Arbitrary Foo where
    arbitrary = Foo <$> QuickCheck.arbitrary <*> QuickCheck.arbitrary
  {-# LINE 12 "if/hs_test_instances.hs" #-}
  instance QuickCheck.Arbitrary TestStruct where
    arbitrary
      = TestStruct <$> QuickCheck.arbitrary <*> QuickCheck.arbitrary <*>
          QuickCheck.arbitrary
          <*> QuickCheck.arbitrary
          <*> QuickCheck.arbitrary
          <*> QuickCheck.arbitrary
          <*> QuickCheck.arbitrary
          <*> QuickCheck.arbitrary
          <*> (Map.fromList <$> QuickCheck.arbitrary)
          <*> arbitraryText
          <*> (Set.fromList <$> QuickCheck.arbitrary)
          <*> QuickCheck.arbitrary
          <*> QuickCheck.arbitrary
          <*> (HashMap.fromList <$> QuickCheck.arbitrary)
          <*> ((Z . X) <$> QuickCheck.arbitrary)
          <*> QuickCheck.arbitrary
          <*> arbitraryString
          <*> arbitraryBS
          <*> (Prelude.fmap X <$> QuickCheck.arbitrary)
          <*> QuickCheck.arbitrary
          <*> QuickCheck.arbitrary
          <*> (Vector.fromList <$> QuickCheck.arbitrary)
          <*> (VectorStorable.fromList <$> QuickCheck.arbitrary)
          <*> arbitraryBSMap
          <*> (Text.encodeUtf8 <$> arbitraryText)
  {-# LINE 40 "if/hs_test_instances.hs" #-}
  instance QuickCheck.Arbitrary Number where
    arbitrary
      = QuickCheck.oneof $
          Prelude.map Prelude.pure [Number_One, Number_Two, Number_Three]
  {-# LINE 44 "if/hs_test_instances.hs" #-}
  instance QuickCheck.Arbitrary TUnion where
    arbitrary
      = QuickCheck.oneof
          [TUnion_StringOption <$> arbitraryText,
           TUnion_I64Option <$> QuickCheck.arbitrary,
           TUnion_FooOption <$> QuickCheck.arbitrary,
           Prelude.pure TUnion_EMPTY]
  {-# LINE 52 "if/hs_test_instances.hs" #-}
  arbitraryString :: QuickCheck.Gen Prelude.String
  {-# LINE 53 "if/hs_test_instances.hs" #-}
  arbitraryString
    = Prelude.filter (/= '\NUL') <$> QuickCheck.arbitrary
  {-# LINE 55 "if/hs_test_instances.hs" #-}
  arbitraryText :: QuickCheck.Gen Text.Text
  {-# LINE 56 "if/hs_test_instances.hs" #-}
  arbitraryText = Text.pack <$> arbitraryString
  {-# LINE 58 "if/hs_test_instances.hs" #-}
  arbitraryBS :: QuickCheck.Gen ByteString.ByteString
  {-# LINE 59 "if/hs_test_instances.hs" #-}
  arbitraryBS = ByteString.pack <$> QuickCheck.arbitrary
  {-# LINE 61 "if/hs_test_instances.hs" #-}
  arbitraryBSMap ::
                   QuickCheck.Arbitrary a =>
                   QuickCheck.Gen (Map.Map ByteString.ByteString a)
  {-# LINE 63 "if/hs_test_instances.hs" #-}
  arbitraryBSMap
    = Map.fromList . Prelude.map (\ (k, v) -> (ByteString.pack k, v))
        <$> QuickCheck.arbitrary
  