, concat
, reverse
, iterate
+ , iteraten
, generate
+ , generaten
, copy
, copyn
) where
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
reverse :: TFVec s a -> TFVec s a
reverse = liftV P.reverse
-iterate :: NaturalT s => s -> (a -> a) -> a -> TFVec s a
-iterate s f x = let s' = fromIntegerT s in TFVec (P.take s' $ P.iterate f x)
+iterate :: NaturalT s => (a -> a) -> a -> TFVec s a
+iterate = iteraten (undefined :: s)
-generate :: NaturalT s => s -> (a -> a) -> a -> TFVec s a
-generate s f x = let s' = fromIntegerT s in TFVec (P.take s' $ P.tail $ P.iterate f x)
+iteraten :: NaturalT s => s -> (a -> a) -> a -> TFVec s a
+iteraten s f x = let s' = fromIntegerT s in TFVec (P.take s' $ P.iterate f x)
+
+generate :: NaturalT s => (a -> a) -> a -> TFVec s a
+generate = generaten (undefined :: s)
+
+generaten :: NaturalT s => s -> (a -> a) -> a -> TFVec s a
+generaten s f x = let s' = fromIntegerT s in TFVec (P.take s' $ P.tail $ P.iterate f x)
copy :: NaturalT s => a -> TFVec s a
copy x = copyn (undefined :: s) x
copyn :: NaturalT s => s -> a -> TFVec s a
-copyn s x = iterate s id x
+copyn s x = iteraten s id x
-- =============
-- = Instances =