Skip to content

I can't get any of the examples to work #37

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

Open
kdvolder opened this issue Apr 27, 2022 · 3 comments
Open

I can't get any of the examples to work #37

kdvolder opened this issue Apr 27, 2022 · 3 comments

Comments

@kdvolder
Copy link

Installed notty from opam. Then tried to follow the 'Basics' instructions.

For example here's what I tried:

─( 19:49:50 )─< command 0 >───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────{ counter: 0 }─
utop # #require "notty";;
─( 19:49:52 )─< command 1 >───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────{ counter: 0 }─
utop # #require "notty.top";;
─( 19:50:03 )─< command 2 >───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────{ counter: 0 }─
utop # I.string A.empty "Rad!";;
- : image = Rad!
─( 19:51:22 )─< command 3 >───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────{ counter: 0 }─
utop # I.string A.empty "Rad!" |> Notty_unix.output_image;;
Line 1:
Error: Reference to undefined global `Notty_unix'
─( 19:51:52 )─< command 4 >───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────{ counter: 0 }─
@kdvolder
Copy link
Author

It seems to create images alright, but I'm not really sure how you can make it show anything on the screen at all. Every time I have tried someImage |> Notty_unix.output_image;;. I always get

   Error: Reference to undefined global `Notty_unix`.

I'm relatively new to Ocaml, so perhaps I am doing something obviously wrong because I don't understand it. But if so, the 'basics' could do with some more 'basic' explanation of how you install the library properly and how you actually get it to a point where a basic example actually displays something on the screen.

@kdvolder
Copy link
Author

Okay, so I figured what I was missing. Apparantly it was #require "notty.unix";;.

@kdvolder
Copy link
Author

So FYI: the full sequence of 'stuff' needed in front of 'the basics':

#require "notty";;
#require "notty.top";;
#require "notty.unix";;
open Notty;;
(* after all that, the example from https://pqwy.github.io/notty/doc/Notty.html#basics works *)
let wow = I.string A.(fg red ++ bg black) "Wow!" in
I.(wow <-> (void 2 0 <|> wow)) |> Notty_unix.output_image

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