Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled algaeff effect; use Algaeff.State.run but I am using it #27

Closed
kentookura opened this issue Feb 14, 2024 · 3 comments
Closed

Comments

@kentookura
Copy link

Perhaps I am wrong in using S.get in a function like this?

https://github.com/kentookura/forester-html/blob/e99e13e75c8cde73a8c7277df740a9d172f03692/bin/main.ml#L18-L23

  S.run ~init:forest @@ fun () ->
  let param s f req = Dream_html.respond @@ f @@ Dream.param req s in
  let page addr =
    let forest = S.get () in
    Renderer.page addr forest
  in
14.02.24 14:54:17.850                       Running at http://localhost:1234
14.02.24 14:54:17.850                       Type Ctrl+C to stop
14.02.24 14:54:19.384       dream.log  INFO REQ 1 GET /forest/foo-0001 127.0.0.1:54020 Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:122.0) Gecko/200
14.02.24 14:54:19.385       dream.log  WARN REQ 1 Aborted by: Unhandled algaeff effect; use Algaeff.State.run
14.02.24 14:54:19.385       dream.log  WARN Raised by primitive operation at Algaeff__State.Make.get in file "src/State.ml" (inlined), line 17, cha3
14.02.24 14:54:19.385       dream.log  WARN Called from Dune__exe__Main.(fun).page in file "bin/main.ml", line 21, characters 17-25
14.02.24 14:54:19.385       dream.log  WARN Called from Dune__exe__Main.(fun).param in file "bin/main.ml", line 19, characters 44-66
14.02.24 14:54:19.385       dream.log  WARN Called from Lwt.Sequence_associated_storage.with_value in file "src/core/lwt.ml", line 804, characters 3
14.02.24 14:54:19.385       dream.log  WARN Re-raised at Lwt.Sequence_associated_storage.with_value in file "src/core/lwt.ml", line 809, characters5
14.02.24 14:54:19.385       dream.log  WARN Called from Lwt.Sequential_composition.try_bind in file "src/core/lwt.ml", line 2139, characters 10-14
14.02.24 14:54:19.385      dream.http ERROR REQ 1 Unhandled algaeff effect; use Algaeff.State.run
14.02.24 14:54:19.385      dream.http ERROR REQ 1 Raised at Stdlib__Map.Make.find in file "map.ml", line 141, characters 10-25
14.02.24 14:54:19.385      dream.http ERROR REQ 1 Called from Logs.Tag.find in file "src/logs.ml", line 154, characters 14-32
14.02.24 14:54:19.404       dream.log  INFO REQ 2 GET /favicon.ico 127.0.0.1:54020 Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:122.0) Gecko/2010010
14.02.24 14:54:19.404       dream.log  WARN REQ 2 404 in 114 μs

If you need it I can create a more minimal reproducing example.

@kentookura
Copy link
Author

kentookura commented Feb 15, 2024

Here is a minimal reproducing example:

module S = Algaeff.State.Make (Int)

let () =
  S.run ~init:100 @@ fun () ->
  Dream.run (fun _ -> Dream.html (Printf.sprintf "%i" (S.get ())))

Perhaps this is an issue with dream. Will investigate

@kentookura
Copy link
Author

This is an issue with lwt (which is used by dream) not being compatible with effects.

@favonia
Copy link
Contributor

favonia commented Feb 20, 2024

@kentookura Sorry for my slow response. In fact, many effects-based lightweight threading libraries are also not (fully) compositional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants