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
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
>
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
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 <*>