adapted from this comment on /r/haskell
You could do this with instance chains now and have a Fail case for better errors.
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"
Oh wow, I never would have considered using type classes to do that! Very cool!
This is super interesting! Thanks for the link.