From 42ea8a52e13b6ca88f86ee60699088fb83eb2b16 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Mon, 17 Aug 2009 12:09:25 +0200 Subject: [PATCH] Make vectorTH use singleton when possible. This enabled the code generated by vectorTH to work with precision. --- Data/Param/TFVec.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Data/Param/TFVec.hs b/Data/Param/TFVec.hs index 1b2051e..33758f9 100644 --- a/Data/Param/TFVec.hs +++ b/Data/Param/TFVec.hs @@ -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 + -- 2.30.2