From ba75d3efd05940488c5816ed20413d5f5f113e58 Mon Sep 17 00:00:00 2001 From: Christiaan Baaij Date: Mon, 29 Jun 2009 15:47:07 +0200 Subject: [PATCH 1/1] Split copy function in two, one that accepts a lenght param, and one that doesn't --- Data/Param/TFVec.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 = -- 2.30.2