From: Christiaan Baaij Date: Fri, 3 Jul 2009 19:37:59 +0000 (+0200) Subject: vectorTH function updated so that it works in Clash X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fmaster-project%2Fsupport%2Ftfvec.git;a=commitdiff_plain;h=a748975fba960d8aa82c4b863619c693e649e65e;hp=c10bc759aefb228a7471f4230c3b19c9735b788e vectorTH function updated so that it works in Clash Will probebly convert it to something better in the future --- diff --git a/Data/Param/TFVec.hs b/Data/Param/TFVec.hs index fd620e7..2357c21 100644 --- a/Data/Param/TFVec.hs +++ b/Data/Param/TFVec.hs @@ -95,8 +95,11 @@ singleton x = x +> empty vectorCPS :: [a] -> (forall s . NaturalT s => TFVec s a -> w) -> w vectorCPS xs = unsafeVectorCPS (toInteger (P.length xs)) xs +-- FIXME: Not the most elegant solution... but it works for now in clash vectorTH :: Lift a => [a] -> ExpQ -vectorTH xs = (vectorCPS xs) lift +-- vectorTH xs = (vectorCPS xs) lift +vectorTH [] = [| empty |] +vectorTH (x:xs) = [| x +> $(vectorTH xs) |] unsafeVector :: NaturalT s => s -> [a] -> TFVec s a unsafeVector l xs