# Reflecting Code to Syntax (with Arrows)

**URL:** <https://discourse.haskell.org/t/reflecting-code-to-syntax-with-arrows/13646>\
**Category:** Uncategorized\
**Created:** [February 3, 2026, 6:48pm UTC](https://discourse.haskell.org/t/reflecting-code-to-syntax-with-arrows/13646 "2026-02-03T18:48:15Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![jaror](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/jaror/32/3271_2.png) [@jaror](https://discourse.haskell.org/u/jaror)\
**Post date:** [February 4, 2026, 2:40pm UTC](https://discourse.haskell.org/t/reflecting-code-to-syntax-with-arrows/13646/11 "2026-02-04T14:40:54Z")

</div>

> [@tomjaguarpaw](#):
>
> [Simple and Compositional Reification of Monadic Embedded Languages](https://dl.acm.org/doi/epdf/10.1145/2500365.2500611)

That’s a cool paper! I guess you could even make it safe if you make the `EBool` type opaque and only expose functions to construct it. Pattern matching on `EBool` would lead to exotic terms, which break the compilation. That does seem more straightforward than PHOAS which is usually my go to approach to make HOAS safe.

> [@tomjaguarpaw](#):
>
> If you write your Opaleye database expression purely using arrow combinators then you know statically that it doesn’t use `lateral` (or indeed anything else that introduces a lateral join).

Ah, I feel like you might be able to do the same with an applicative interface. I have posted about that idea before:

- [`transformers` vs `arrows` packages - #5 by jaror](https://discourse.haskell.org/t/transformers-vs-arrows-packages/9664/5)
- [Reactimate - A new AFRP library - #27 by jaror](https://discourse.haskell.org/t/reactimate-a-new-afrp-library/8852/27)

I wish I had the time to really put that to the test. I really wonder if there is a gap between monad and applicative where arrows do add something. It feel a bit like P vs NP, but then `Applicative` vs `Arrow`.

---

_[View the full topic](https://discourse.haskell.org/t/reflecting-code-to-syntax-with-arrows/13646)._
