Re: [Haskell-cafe] an instance in other than the last type parameters

2009-07-17 Thread Geoffrey Marchant
> data X a b = X a b> instance Functor (X a) where > fmap f (X a b) = X a (f b) Yeah, that works just fine. On Fri, Jul 17, 2009 at 1:14 PM, Petr Pudlak wrote: > Hi, I have probably a very simple question, but I wasn't able to figure it > out > myself. > > Consider a two-parameter data type

Re: [Haskell-cafe] Monoid wants a (++) equivalent

2009-07-01 Thread Geoffrey Marchant
Obviously `mappend` is good enough as it is. Choosing (+>) or (<>) are just for prettifying code. Generalizing (++) not only makes the code prettier, but also brings Monoid into the Prelude. You can either Do It Right(tm), or be conservative and try to maintain backwards compatibility as much as

Re: [Haskell-cafe] List spine traversal

2009-06-29 Thread Geoffrey Marchant
I think I can see the point of forcing a list without forcing the actual data, but is there a way to do this that works on circular lists as well? On Mon, Jun 29, 2009 at 3:30 AM, Ketil Malde wrote: > Deniz Dogan writes: > > > What is the spine of a list? Google seems to fail me on this one. >

Re: [Haskell-cafe] A small puzzle: inTwain as function of foldr

2009-06-04 Thread Geoffrey Marchant
The linked paper appears to show the right style. This appears to satisfy the conditions, however: inTwain as = let (x,y,_) = foldr (\a (r,s,t) -> case (t) of {b:(b':bs) -> (r,a:s,bs); _ -> (a:r,s,t)}) ([],[],as) as in (x,y) In the case of a list of odd length, the first half is given the extra e