-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More work towards first-class operators
- Loading branch information
Showing
11 changed files
with
309 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,3 +27,4 @@ cabal.project.local~ | |
*.wat | ||
*.wasm | ||
result | ||
*.tix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,41 @@ | ||
# let split ([]: String sep: String) => [String] = [""] | ||
# let split ((c:cs): String sep: String) => [String] = do | ||
# let rest = split cs, sep | ||
# if c == sep then do | ||
# "" : (split cs, sep) | ||
# else do | ||
# (c : (head rest)) : (tail rest) | ||
# end | ||
# # let split ([]: String sep: String) => [String] = [""] | ||
# # let split ((c:cs): String sep: String) => [String] = do | ||
# # let rest = split cs, sep | ||
# # if c == sep then do | ||
# # "" : (split cs, sep) | ||
# # else do | ||
# # (c : (head rest)) : (tail rest) | ||
# # end | ||
# # end | ||
# trait Number | ||
# impl Number for Int | ||
# impl Number for Float | ||
# | ||
# # let add<N: Number> (a: N b: N) => N = a + b | ||
# | ||
# let split<T> ([]: [T] sep: T) => [T] = [""] | ||
# | ||
# let printNumList<N: Number> (l: [N] n: N) => IO = do | ||
# | ||
# end | ||
trait Number | ||
impl Number for Int | ||
impl Number for Float | ||
|
||
let add<N: Number> (a: N b: N) => N = a + b | ||
|
||
let split<T> ([]: [T] sep: T) => [T] = [""] | ||
|
||
let printNumList<N: Number> (l: [N] n: N) => IO = do | ||
|
||
end | ||
|
||
let xxx (a: Int) => Int = a | ||
|
||
# let test (a: A b: B) => C = do | ||
# | ||
# let xxx (a: Int) => Int = a | ||
# | ||
# | ||
# struct Child = (name: String, age: Int) satisfies (it.age < 18) | ||
# let a+ (a: Int b: Int) => Int = a | ||
# let main => IO = do | ||
# println 1 a+ 2 | ||
# # println Child {name: "John", age: 13} | ||
# # println Child {name: "Abram", age: 20} | ||
# end | ||
|
||
let main => IO = do | ||
println xxx (add 1,2) | ||
# println add 1.0, 10 | ||
# println split [1, 2, 3, 4, 5], 3 | ||
# printNumList [1, 2, 3, 4, 5], 3 | ||
# println "Hello, world!" | ||
end | ||
# `+` :: Int -> Int -> Int | ||
# struct Cat = (name: String, age: Int) | ||
# # let + (a: Cat b: Cat) => Cat = Cat {name: a.name : b.name, age: a.age + b.age} | ||
# # let add (a: Int b: Int) => Int = a + b | ||
# # let add (a: Float b: Float) => Float = a - b | ||
# add :: Int -> Int -> Int | ||
# add a b = a + b | ||
# let main => IO = println add 3.0, 4.0 | ||
2+5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.