Re: Setting custom prompt in utop with UTop.prompt

"Chingfan Tsao [email protected] [ocaml_beginners]" <[email protected]>
Newsgroups gmane.comp.lang.ocaml.beginners
Message-ID <CAOCiaG7BNh5fwBLBFcotTiM7-RDQ0tp9hx5p5E218wZ80qhhtg@mail.gmail.com>
Hi John:

Since LTerm_text belongs to the lambda-term package, it seems that your
utop couldn't find LTerm_text, a little strange, since if you installed
utop via opam, lambda-term should be installed automatically as dependency,
can you show your whole ocamlinit content? Changing UTop.prompt definitly
works in my ocamlinit file.

2015-04-04 16:00 GMT+08:00 John Magolske [email protected] [ocaml_beginners]
<[email protected]>:

>
>
> Hi,
>
> I'd like to adjust the utop prompt, and am trying to sort out what to
> input to utop & place in my ~/.ocamlinit file. It says here:
>
> https://opam.ocaml.org/blog/about-utop/
>
> The prompt can be customized by the user, by setting the reference
> UTop.prompt:
>
> utop # UTop.prompt;;
> - : LTerm_text.t React.signal ref = {contents = <abstr>}
>
> But I'm not sure what to do beyond entering UTop.prompt;; into utop...
> following some suggestions here:
>
> http://irclog.whitequark.org/ocaml/2015-03-19.txt
>
> I tried:
>
> #require "react";;
> UTop.prompt := React.S.const (LTerm_text.of_string "");;
>
> but got:
>
> Error: Unbound module LTerm_text
>
> also took a look at this:
>
> https://twitter.com/keleshev/status/573401484177612800
> UTop.prompt := fst (React.S.create LTerm_text.(eval [B_fg
> (LTerm_style.green); S "# "])
>
> Which has unbalanced parentheses...not sure what it should be.
> Not sure what to make of this either:
>
>
> http://stackoverflow.com/questions/6158596/setting-the-prompt-in-an-ocaml-custom-toplevel
>
> I'm just getting started learning OCaml basics, so feeling a bit lost
> here...any clarification would be much appreciated.
>
> John
>
> --
> John Magolske
> http://B79.net/contact
>  
>



-- 
曹竞帆
哈尔滨工业大学计算机科学与技术专业本科在读
哈尔滨工业大学IBMTC成员
Chingfan Tsao
Senior Student of Computer Science and Technology at HIT
Member of HIT IBMTC
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.