[Haskell-cafe] Re: Increasing number of parameters
Kevin Jardine
kevinjardine at gmail.com
Fri Oct 15 05:53:24 EDT 2010
Jacek,
I haven't been following this thread in any detail, so I apologise if
I misunderstand your goal, but the ctm function in the polyToMonoid
library (which maps its parameters to any specified monoid) appears to
work in just this way.
It keeps consuming parameters until you hand it to the trm function to
deliver the final result. More documentation here:
http://hackage.haskell.org/packages/archive/polyToMonoid/0.1/doc/html/Data-PolyToMonoid.html
Kevin
On Oct 15, 11:38 am, Jacek Generowicz <jacek.generow... at cern.ch>
wrote:
> Thanks Brandon!
>
> I really like the addParam utility,
>
> > value val prompt = Question prompt (show val) (readCheck val)
>
> > addParam :: (Show a) => (funTy -> String -> qty) -> (a -> funTy) ->
> > String -> (a
> > -> qty)
> > addParam qmakr fun string v = qmakr (fun v) (string++" "++show v)
>
> > prefix1 = addParam value
> > prefix2 = addParam prefix1
> > prefix3 = addParam prefix2
>
> but my crusty and sleep-deprived brain is not really grokking the
> internal plumbing.
>
> So I'm trying to get to grips with a simpler variation on the same
> theme, and I'm still failing. I'm trying to write something along the
> lines of
>
> addArg :: nArgFn -> a -> nPlus1ArgFn
> addArg fn a = (a+) <---- fn where
> <---- = something which applies its right parameter to however
> many arguments it needs and feeds the result to the left parameter
>
> in order to allow me to say
>
> sum2 = (+)
> sum3 = addArg sum2
> sum4 = addArg sum3
>
> etc.
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-C... at haskell.orghttp://www.haskell.org/mailman/listinfo/haskell-cafe
More information about the Haskell-Cafe
mailing list