Your data declarations are probably not what you intended.
TX_OR_TY just defines two constructors: TX and TY.
The following data declarations define the types TX and TY.
You probably meant something like
data TX_OR_TY = AnX TX | AnY TY
data TX = X Int
data TY = Y Float
-- Now I write some function return their data type:
funcTX :: TX
funcTX = X 3
funcTY :: TY
funcTY = Y 5
ordFuncTX :: TX -> Int -> Bool
ordFuncTX (X a) b = (a > b)
funcTX_TY :: TX_OR_TY
funcTX_TY = if (ordFuncTX funcTX 4) then AnX funcTX else AnX funcTY
Note that TX_OR_TY is a specialized version of the Either data type from the standard prelude. To use Either, omit the definition of TX_OR_TY and change the function thus:
funcTX_TY :: Either TX TY
funcTX_TY = if (ordFuncTX funcTX 4) then Left funcTX else Right funcTY