> You can also define a lifting function, that "lifts" functions on lists
> to your datatype.
> 
> liftSS :: ([Int] -> a) -> SS -> a
> liftSS f (SS xs) =3D f xs
> 
> and so write=20
> liftSS (take 5) (SS [1..100])
> for instance.
> 
> but this only works for functions with one list argument.

You probably want

lift0SS :: [Int] -> SS
lift0SS xs = SS xs

lift1SS :: ([Int] -> [Int]) -> SS -> SS
lift1SS f (SS xs) = SS (f xs)

lift2SS :: ([Int] -> [Int] -> [Int]) -> SS -> SS -> SS
lift2SS f (SS xs) (SS ys) = SS (f xs ys)

etc.

--KW 8-)
-- 
: Keith Wansbrough, MSc, BSc(Hons) (Auckland) ------------------------:
: PhD Student, Computer Laboratory, University of Cambridge, England. :
:  (and recently of the University of Glasgow, Scotland. [><] )       :
: Native of Antipodean Auckland, New Zealand: 174d47' E, 36d55' S.    :
: http://www.cl.cam.ac.uk/users/kw217/  mailto:[EMAIL PROTECTED]     :
:---------------------------------------------------------------------:


Reply via email to