]> gitweb @ CieloNegro.org - hs-rrdtool.git/blobdiff - Data/HList/String.hs
HString and HLength
[hs-rrdtool.git] / Data / HList / String.hs
index bcec59c6d750ab623878087757d95302453fa7e3..e3f878a25b69a8ecb82109dca957cc3c6d56c75a 100644 (file)
@@ -4,17 +4,18 @@ module Data.HList.String
     )
     where
 
-import Data.HList.Number
 import Data.HList.Prelude
 import Language.Haskell.TH
 import Language.Haskell.TH.Quote
+import Types.Data.Num.Decimal.Literals.TH
+import Types.Data.Num.Ops
 
 
 class HString s
 
 instance HString HNil
 
-instance HNat c => HString (HCons c s)
+instance IntegerT c => HString (HCons c s)
 
 hString :: QuasiQuoter
 hString = QuasiQuoter quoteStrExp quoteStrPat
@@ -22,12 +23,13 @@ hString = QuasiQuoter quoteStrExp quoteStrPat
 quoteStrExp :: String -> ExpQ
 quoteStrExp []     = varE (mkName "hNil")
 quoteStrExp (c:cs) = appsE [ varE (mkName "hCons")
-                           , hNatLiteralE (fromEnum c)
+                           , decLiteralV (toInteger $ fromEnum c)
                            , quoteStrExp cs
                            ]
 
 quoteStrPat :: String -> PatQ
 quoteStrPat []     = varP (mkName "HNil")
-quoteStrPat (c:cs) = conP (mkName "HCons") [ hNatLiteralP (fromEnum c)
-                                           , quoteStrPat cs
-                                           ]
+quoteStrPat (c:cs) = conP (mkName "HCons")
+                     [ sigP wildP (decLiteralT $ toInteger $ fromEnum c)
+                     , quoteStrPat cs
+                     ]