-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add examples to document features #305
Conversation
Thank you for your contributions! Here are a few remarks before we can merge this:
|
import immutable/list | ||
|
||
interface DataBase[R] { | ||
//will save name to database |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//will save name to database | |
// will save name to database |
why "name"?
Student(firstName, lastName, nextId()); | ||
} | ||
|
||
db.addEntry(newStudent("Max","Marschall")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
db.addEntry(newStudent("Max","Marschall")); | |
db.addEntry(newStudent("Max", "Marschall")); |
db.addEntry(newStudent("Pierre","Drole")); | ||
db.addEntry(newStudent("Airan","Sayüt")); | ||
|
||
db.printEntries[Student]() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the type annotation necessary?
println(db.getEntries[Student]()) | ||
} | ||
|
||
def makeNewDB(){ r: Region }:DataBase[Student] at { r } = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def makeNewDB(){ r: Region }:DataBase[Student] at { r } = { | |
def makeNewDB { r: Region }: DataBase[Student] at { r } = { |
} | ||
|
||
def makeNewDB(){ r: Region }:DataBase[Student] at { r } = { | ||
//create database instance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//create database instance | |
// create database instance |
def firebase = new DataBase[Student] { | ||
|
||
def addEntry(entry: Student) = { | ||
names = Cons[Student](entry, names) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, is the type annotation necessary?
} | ||
|
||
def printEntries() = { | ||
names.foreach(){ name => println(name); ()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
names.foreach(){ name => println(name); ()} | |
names.foreach { name => println(name) } |
def getEntries() = { | ||
return names; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def getEntries() = { | |
return names; | |
} | |
def getEntries() = names |
}; | ||
|
||
region r { | ||
def fb2 = makeNewDB(){ r }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def fb2 = makeNewDB(){ r }; | |
def fb2 = makeNewDB {r}; |
Typically we omit empty value sections
var time = currentTimeNanos(); | ||
var timeMillis = time / 1000000; | ||
println("time millis: " ++ show(timeMillis)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
printing the time in a "test" is difficult because you don't know what the expected result will be
I am writing such detailed review comments since it would be great if you could also apply them to Effekt code that you write in general :) |
No description provided.