[Haskell-cafe] polyvariadic function for Applicative instances

Chris Eidhof chris at eidhof.nl
Mon May 10 09:14:56 EDT 2010


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
> 
> 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 <*> b
> 
> Thanks,
> Xiao-Yong
> -- 
> J    c/*    __o/*
> X    <\     * (__
> Y    */\      <
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list