dec2TypeLevel :: Int -> Q Type
dec2TypeLevel n
 | n <  0 = error "natural number expected"
 | n < 10 = let name = case n of
                  0 -> ''D0; 1 -> ''D1; 2 -> ''D2; 3 -> ''D3; 4 -> ''D4
                  5 -> ''D5; 6 -> ''D6; 7 -> ''D7; 8 -> ''D8; 9 -> ''D9
            in conT name          
 | otherwise = let (quotient, reminder) = n `quotRem` 10 
                   remType  = dec2TypeLevel reminder
                   quotType = dec2TypeLevel quotient
               in (conT ''(:*)) `appT` quotType `appT` remType
dec2TypeLevel :: Int -> Q Type
dec2TypeLevel n
 | n <  0 = error "natural number expected"
 | n < 10 = let name = case n of
                  0 -> ''D0; 1 -> ''D1; 2 -> ''D2; 3 -> ''D3; 4 -> ''D4
                  5 -> ''D5; 6 -> ''D6; 7 -> ''D7; 8 -> ''D8; 9 -> ''D9
            in conT name          
 | otherwise = let (quotient, reminder) = n `quotRem` 10 
                   remType  = dec2TypeLevel reminder
                   quotType = dec2TypeLevel quotient
               in (conT ''(:*)) `appT` quotType `appT` remType
dec2TypeLevel n
 | n <  0 = error "natural number expected"
 | n < 10 = let name = case n of
                  0 -> ''D0; 1 -> ''D1; 2 -> ''D2; 3 -> ''D3; 4 -> ''D4
                  5 -> ''D5; 6 -> ''D6; 7 -> ''D7; 8 -> ''D8; 9 -> ''D9
            in conT name          
 | otherwise = let (quotient, reminder) = n `quotRem` 10 
                   remType  = dec2TypeLevel reminder
                   quotType = dec2TypeLevel quotient
               in (conT ''(:*)) `appT` quotType `appT` remType