20230922
Fell asleep around midnight I guess. Woke up around 6 and finished the game I left before falling asleep. Had breakfast and played piano around 7. Then started to work around 8. Basically completed the mobile app part of database actions, though I hadn't started the app. Became familiar with functional programming, didn't have to check the return type of a function every time I made a change. But, sometimes I had to write some weird codes, like "await requireSystem()()()". To give an explaination, requireSystem is a function returning ReaderTaskEither<void, Error, System>, which represents an action that reads a value of type System from nowhere (that's why the second pair of parentheses is empty, otherwise it should be something like requireDb()(system), getting database connection from system), and an error of type Error could happen in this procedure. So the second pair of parentheses returns TaskEither<Error, System>, which is another function returning Promise<Either<Error, System>>, so the third pair of parentheses is needed to make it run, and so is "await". Of course, there is only one system in the application, but it is initialized asynchronously due to some database initialization jobs, so I had to use a function to get it, rather than exporting it as global variable. Played Zelda after lunch as usual, and returned to my work then. Tried to did the cycling exercise at 3, but felt tired and had no motivation. Oh, forgot to mention that my weight was 84.7 kg this morning, dropped below 85 kg for the first time this year. Completed 11 pomodoroes today - one for learning and ten for work.
评论
发表评论