channel Signup {
    out accounts(accDB:Map, signup(aid:Str)) = insert(accDB, aid, {"favorites": nil, "books": nil})
    out keeplog(a:Str, signup(account))=account
}

channel CreateBook(aid:Str) {
    out accounts.{aid}.books(bookList:List, createBook(title:Str)) = append(bookList, {"title": title, "favorited": nil})
}

channel Slog {
    out temp(a:Str,Slog(account))=account
}

channel Login {
    in  temp(ac:Str,login(acoount: Str,accDB: Map))=account
    ref accounts(accDB:Map, login(account: Str,accDB: Map))
    out keeplog(a:Str,login(account: Str, accDB: Map))=if(contains(accDB, account), account, "")
}