+import Prelude ( (++), (+), (==), Show, show, (.), ($) )
+import qualified Prelude
+import qualified HscTypes
+import qualified GHC.Base
+import qualified CoreMonad
+import qualified System.IO.Unsafe
+
+getTyConTyVars :: TyCon.TyCon -> [Var.TyVar]
+getTyConTyVars tc =
+ if TyCon.isFunTyCon tc
+ then []
+ else if TyCon.isPrimTyCon tc
+ then []
+ else TyCon.tyConTyVars tc
+
+cmpAlts :: (CoreSyn.AltCon,[Var.Var],CoreSyn.Expr Var.Var) -> (CoreSyn.AltCon,[Var.Var],CoreSyn.Expr Var.Var) -> Data.Ord.Ordering
+cmpAlts (CoreSyn.DEFAULT,_,_) _ = Data.Ord.LT
+cmpAlts _ (CoreSyn.DEFAULT,_,_) = Data.Ord.GT
+cmpAlts (a1,_,_) (a2,_,_) = Data.Ord.compare a2 a1
+
+sortAlts :: [(CoreSyn.AltCon,[Var.Var],CoreSyn.Expr Var.Var)] -> [(CoreSyn.AltCon,[Var.Var],CoreSyn.Expr Var.Var)]
+sortAlts x = Data.List.sortBy (\a b -> if a `CoreSyn.ltAlt` b then Data.Ord.LT else Data.Ord.GT) x