Make vectorTH use singleton when possible.
[matthijs/master-project/support/tfvec.git] / Data / Param / TFVec.hs
index 1b2051e6e9ba176335d69a01033e06b4dd1e1912..33758f9f5762aec6b422493be1b5b8f22887ac39 100644 (file)
@@ -102,6 +102,7 @@ vectorCPS xs = unsafeVectorCPS (toInteger (P.length xs)) xs
 vectorTH :: (Lift a, Typeable a) => [a] -> ExpQ
 -- vectorTH xs = sigE [| (TFVec xs) |] (decTFVecT (toInteger (P.length xs)) xs)
 vectorTH [] = [| empty |]
+vectorTH [x] = [| singleton x |]
 vectorTH (x:xs) = [| x +> $(vectorTH xs) |]
 
 unsafeVector :: NaturalT s => s -> [a] -> TFVec s a
@@ -349,4 +350,4 @@ lexTFVec :: ReadS String
 lexTFVec ('>':rest) = [(">",rest)]
 lexTFVec ('<':rest) = [("<",rest)]
 lexTFVec str = lex str
-                                           
\ No newline at end of file
+