HomeNotesDevelopment Blog

Week 33, 2026 (Aug 10 - 16)

Initial Frontend

I made the decision to use Svelte for the frontend development.

I debated between React and Svelte for a bit. On one hand, I had more experience in React; On the other hand, I have heard great things about Svelte. After learning there is a drag-and-drop library for Svelte, I made the choice to choose Svelte.

Another decision to make was whether or not I should use SvelteKit. At this moment, I am not concerned about any advanced features besides routing. In such case, SvelteKit may be overkill in comparison to a lightweight library. In the end, I still chose SvelteKit, because I figure I can simply opt-out of any advanced features (such as loading data server-side).

Cross-Origin Resource Sharing

I made one endpoint and one frontend page to test the concept. In the process, I ran into a cross-origin resource sharing (CORS) error in the frontend.

While I have encountered similar errors before, this time I went to the source to understand the underpinning logic behind the mechanism. The source I used was MDN 1, and a detailed note can be found elsewhere.

After understanding the motivation of the mechanism, I decided to solve the error by setting Access-Control-Allow-Origin: *. I am aware this is a temporary solution and it is only valid because I am in control of the development environment. When the time to deploy comes, I will set it up properly to only allow calls from trusted sources.

GHC -ddump-XXX Options

I ran into a case where I had to compare two values with seemingly different types (syntactically).

The types I was dealing with are generated by a template Haskell. I believe there are no way to view the result of the quasiquoter besides using GHC's debug messages 2. I had some difficulty setting up the ghc-options in my cabal file and finding where the -ddump-XXX files are located. A few lessons learned are the following:

  • Use -ddump-to-file to output debug messages to files.
  • Use -ddump-splices to see the result of splicing a Template Haskell expression.
  • Use find . -name "to_find" to find a file with a specific name under the current directory. Prepend and append * if wants to search by substring.

Footnotes: