Variable argument functions

gist here

adapted from this comment on /r/haskell

1 Like

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

1 Like

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"
2 Likes

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

This is super interesting! Thanks for the link.