mkInst :: String -> String -> [String] -> [String] -> String
mkInst inst lid args impls =
  let header = "instance " ++ inst ++ " " ++ lid
      argL = length args > 1
      impE = not $ null impls
      in header ++
         if argL && impE then
            sepTabVert $ args ++ ["where"] ++ impls else
            if argL then
               sepTabVert args else
               if impE then
                  sepHoriz args ++ " where" ++ sepTabVert impls else
                  sepHoriz args
mkInst :: String -> String -> [String] -> [String] -> String
mkInst inst lid args impls =
  let header = "instance " ++ inst ++ " " ++ lid
      argL = length args > 1
      impE = not $ null impls
      in header ++
         if argL && impE then
            sepTabVert $ args ++ ["where"] ++ impls else
            if argL then
               sepTabVert args else
               if impE then
                  sepHoriz args ++ " where" ++ sepTabVert impls else
                  sepHoriz args
mkInst inst lid args impls =
  let header = "instance " ++ inst ++ " " ++ lid
      argL = length args > 1
      impE = not $ null impls
      in header ++
         if argL && impE then
            sepTabVert $ args ++ ["where"] ++ impls else
            if argL then
               sepTabVert args else
               if impE then
                  sepHoriz args ++ " where" ++ sepTabVert impls else
                  sepHoriz args