Variable argument functions


#1

gist here

adapted from this comment on /r/haskell


#2

You could do this with instance chains now and have a Fail case for better errors.


#3

You might be interested in the Sprintf demo Csongor did a while ago, updated here: https://github.com/justinwoo/purescript-safe-printf/tree/compiler/0.12

main :: Effect Unit
main = do
  let formatted = format (SProxy :: SProxy "Hi %s! You are %d") "Bill" 12
  assert $ formatted == "Hi Bill! You are 12"

#4

Oh wow, I never would have considered using type classes to do that! Very cool!


#5

This is super interesting! Thanks for the link.