module Auto

pfunc i2s : Int -> String := `(i) => ''+i`
pfunc _++_ : String -> String -> String := `(a,b) => a + b`

infixl 4 _++_

-- We need sugar and marking as class/instance on all of this

data Show : U -> U where
  MkShow : { A : U } -> ((show : A) -> String) -> Show A

-- FIXME - we'd like to inline this, so `show _ {{showInt}} a` ends up as `i2s a`
show : {A : U} {{myshow : Show A}} -> A -> String
show {_} {{MkShow foo}} a = foo a

showInt : Show Int
showInt = MkShow i2s

ptype World
pfunc log : {A : U} -> A -> World := `(_, a) => console.log(a)`

main : Int -> World
main _ = log ("answer: " ++ show 42)
