From: Christiaan Baaij Date: Mon, 29 Jun 2009 13:47:07 +0000 (+0200) Subject: Split copy function in two, one that accepts a lenght param, and one that doesn't X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=ba75d3efd05940488c5816ed20413d5f5f113e58;p=matthijs%2Fmaster-project%2Fsupport%2Ftfvec.git Split copy function in two, one that accepts a lenght param, and one that doesn't --- diff --git a/Data/Param/TFVec.hs b/Data/Param/TFVec.hs index dbe46e9..50b2fda 100644 --- a/Data/Param/TFVec.hs +++ b/Data/Param/TFVec.hs @@ -53,6 +53,7 @@ module Data.Param.TFVec , iterate , generate , copy + , copyn ) where @@ -234,8 +235,11 @@ iterate s f x = let s' = fromIntegerT s in TFVec (P.take s' $ P.iterate f x) 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) -copy :: NaturalT s => s -> a -> TFVec s a -copy s x = iterate s id 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 -- ============= -- = Instances =