[Haskell-cafe] Calling function with unknown number and type arguments

Antoine Latter aslatter at gmail.com
Sun Aug 16 20:35:19 EDT 2009


On Sun, Aug 16, 2009 at 3:07 PM, Sean Leather<leather at cs.uu.nl> wrote:
>
> On Sun, Aug 16, 2009 at 17:00, Brandon S. Allbery wrote:
>>
>> On Aug 16, 2009, at 06:45 , Maciej Piechotka wrote:
>>>
>>> I have to write a function which calls a function with unknown (i.e.
>>> given in runtime) number and type of arguments.
>>
>> Take a look at the implementation of Text.Printf.
>
>
> Or Text.XFormat.Show in xformat while you're at it. (Warning: blatant
> self-promoting.)
>
>   http://hackage.haskell.org/package/xformat
>
> From the tests in the package:
>
>   showf (Show % Int % String) 4.05 20 " blah" == "4.0520 blah"
>   showf (Wrap '(' Int ')') 24 == "(24)"
>

But with those, the number of arguments is still known at compile time, correct?

Antoine


More information about the Haskell-Cafe mailing list