Re: [Haskell-cafe] polyvariadic function for Applicative instances

2010-05-10 Thread Xiao-Yong Jin
Thanks, Chris and Bartek. It was quite a read. I finally arrived at an implementation as follows. --8<---cut here---start->8--- {-# LANGUAGE MultiParamTypeClasses , FunctionalDependencies , FlexibleInstances , UndecidableInstan

Re: [Haskell-cafe] polyvariadic function for Applicative instances

2010-05-10 Thread Chris Eidhof
Maybe this is what you are looking for: http://www.haskell.org/haskellwiki/Idiom_brackets -chris On 9 mei 2010, at 18:39, Xiao-Yong Jin wrote: > Hi, > > Is it possible to have a function accept variable number of > arguments, such that 'f' can be instantiated to different > concrete types as >

Re: [Haskell-cafe] polyvariadic function for Applicative instances

2010-05-09 Thread Bartek Ćwikłowski
hello, > Is it possible to have a function accept variable number of > arguments, such that 'f' can be instantiated to different > concrete types as > > f :: Applicative a => (e1 -> f) -> a e1 -> A f > f g a = pure g <*> a > > f :: Applicative a => (e1 -> e2 -> f) -> a e1 -> a e2 -> A f > f g a b

[Haskell-cafe] polyvariadic function for Applicative instances

2010-05-09 Thread Xiao-Yong Jin
Hi, Is it possible to have a function accept variable number of arguments, such that 'f' can be instantiated to different concrete types as f :: Applicative a => (e1 -> f) -> a e1 -> A f f g a = pure g <*> a f :: Applicative a => (e1 -> e2 -> f) -> a e1 -> a e2 -> A f f g a b = pure g <*> a <*>