"Richard O'Keefe" <o...@cs.otago.ac.nz> writes:

> newtype PS a = PS [a] deriving (Eq, Show)
>
> u f (PS x)        = PS $ map f x
> b f (PS x) (PS y) = PS $ zipWith f x y
> to_ps x           = PS (x : repeat 0)

BTW, isn't this a good candidate for an Applicative instance (similar to
ZipList)?

 u f p     = f <$> p          -- or u = fmap
 b f p1 p2 = f <$> p1 <*> p2

Not a big deal for the Num instance, perhaps, but more general than u
and b, and it might make it easier to work with in other ways.

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to