Finding simple autos after elab
This commit is contained in:
27
tests/black/Auto.newt
Normal file
27
tests/black/Auto.newt
Normal file
@@ -0,0 +1,27 @@
|
||||
module Auto
|
||||
|
||||
ptype String
|
||||
ptype Int
|
||||
|
||||
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)
|
||||
Reference in New Issue
Block a user