I'm encountering an issue while using lwt_ppx
and the let%lwt
syntax as described in the CS3110 textbook's section on promises (https://cs3110.github.io/textbook/chapters/ds/promises.html).
In the code snippet provided:
open Lwt_iolet p = let%lwt s1 = read_line stdin in let%lwt s2 = read_line stdin in Lwt_io.printf "%s\n" (s1^s2)let _ = Lwt_main.run p
I'm trying to compile the code using dune. My dune file looks like this:
(executable (name main) (libraries lwt.unix lwt_ppx))
However, when I run the command dune exec ./main.exe
, I'm getting the error message "Uninterpreted extension 'lwt'."
I've verified that I have the lwt_ppx
package installed using opam list
, and interestingly, the code works as expected in utop
when I run:
#require "lwt_ppx";;#require "lwt.unix";;#use "main.ml";;
What might I be doing wrong with my dune configuration? Any help would be greatly appreciated.