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

demo won't compile #102

Open
glyh opened this issue Dec 13, 2024 · 2 comments
Open

demo won't compile #102

glyh opened this issue Dec 13, 2024 · 2 comments

Comments

@glyh
Copy link

glyh commented Dec 13, 2024

Here's relevant lines in my dune-project file:

(pin (package (name riot)) (url "git+https://github.com/riot-ml/riot"))
(pin (package (name rio)) (url "git+https://github.com/riot-ml/rio"))
(pin (package (name gluon)) (url "git+https://github.com/riot-ml/gluon"))
(pin (package (name bytestring)) (url "git+https://github.com/riot-ml/bytestring"))

(package
 (name ochain)
 (synopsis "A simple blockchain implemented in OCaml")
 (description "A simple blockchain implemented in OCaml")
 (depends 
   ocaml 
   dune
   (cryptokit (>= 1.20))
   (yojson (>= 2.2.2))
   (ppx_deriving_yojson (>= 3.9.0))
   (batteries (>= 3.8.0))
   riot)

And the example:

open Riot

type Message.t += Hello_world

let () =
  Riot.run @@ fun () ->
  let pid =
    spawn (fun () ->
        match receive () with
        | Hello_world ->
            Logger.info (fun f -> f "hello world from %a!" Pid.pp (self ()));
            shutdown ())
  in
  send pid Hello_world

OCaml complains this:

Entering directory '/home/lyh/Documents/Knowledge/CS/PL/Experiments/ochain'
File "bin/main.ml", lines 9-12, characters 8-23:
 9 | ........match receive () with
10 |         | Hello_world ->
11 |             Logger.info (fun f -> f "hello world from %a!" Pid.pp (self ()));
12 |             shutdown ().
Error (warning 8 [partial-match]): this pattern-matching is not exhaustive.
Here is an example of a case that is not matched:
*extension*
Matching over values of extensible variant types (the *extension* above)
must include a wild card pattern in order to be exhaustive.
Copy link

linear bot commented Dec 13, 2024

@glyh
Copy link
Author

glyh commented Dec 13, 2024

RIOT-37 demo won't compile

image

Why can't the explaination just be hosted on github?

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

1 participant