X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=Data%2FParam%2FTFVec.hs;h=33758f9f5762aec6b422493be1b5b8f22887ac39;hb=refs%2Fheads%2Fmaster;hp=529c52c12a163dfb3b31397ddfbd987189e78ca4;hpb=92cb4e3a487e88220aba94d7fc6003384e971e5c;p=matthijs%2Fmaster-project%2Fsupport%2Ftfvec.git diff --git a/Data/Param/TFVec.hs b/Data/Param/TFVec.hs index 529c52c..33758f9 100644 --- a/Data/Param/TFVec.hs +++ b/Data/Param/TFVec.hs @@ -100,9 +100,10 @@ vectorCPS xs = unsafeVectorCPS (toInteger (P.length xs)) xs -- FIXME: Not the most elegant solution... but it works for now in clash vectorTH :: (Lift a, Typeable a) => [a] -> ExpQ -vectorTH xs = sigE [| (TFVec xs) |] (decTFVecT (toInteger (P.length xs)) xs) --- vectorTH [] = [| empty |] --- vectorTH (x:xs) = [| x +> $(vectorTH xs) |] +-- 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 unsafeVector l xs @@ -349,4 +350,4 @@ lexTFVec :: ReadS String lexTFVec ('>':rest) = [(">",rest)] lexTFVec ('<':rest) = [("<",rest)] lexTFVec str = lex str - \ No newline at end of file +