adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.09 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.09/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
_whitelogger has joined #ocaml
mangoicedtea has quit [Quit: Leaving]
Hrundi_V_Bakshi has quit [Ping timeout: 240 seconds]
ollehar has quit [Ping timeout: 258 seconds]
amiloradovsky has joined #ocaml
ollehar has joined #ocaml
Haudegen has quit [Ping timeout: 265 seconds]
d_bot has joined #ocaml
d_bot has quit [Client Quit]
d_bot_ has quit [Remote host closed the connection]
Bluddy has joined #ocaml
d_bot has joined #ocaml
<Bluddy> ok I registered d_bot
<d_bot> <Bluddy> ```ocaml
<d_bot> <Bluddy> let x = test ()
<d_bot> <Bluddy> ```
<d_bot> <Bluddy> @octachron could you explain your request? What do you mean by 'skip block codes'?
<companion_cube> cool!
mfp has quit [Ping timeout: 240 seconds]
Bluddy has quit [Quit: Connection closed for inactivity]
amiloradovsky has quit [Ping timeout: 240 seconds]
ldbeth has joined #ocaml
<ldbeth> hello
<ldbeth> is there a way to extend `ocamldep` to recognize some other files?
waleee-cl has quit [Quit: Connection closed for inactivity]
<ldbeth> for example some ML files with custom syntax specified by CamlP5
ldbeth has quit [Read error: Connection reset by peer]
reynir has quit [Ping timeout: 264 seconds]
reynir has joined #ocaml
vicfred has quit [Quit: Leaving]
vicfred has joined #ocaml
<d_bot> <octachron> @Bluddy , I tend to write fairly large code block in discord. Unfortunately, they are very noisy once transcribed to the irc side. I think it would make sense to skip those.
Guest86335 has quit [Ping timeout: 240 seconds]
Guest86335 has joined #ocaml
narimiran has joined #ocaml
ggole has joined #ocaml
<zozozo> @Bluddy : I guess the ideal would be for the bot to paste code blocks of more than a certain length to some web paste service and replace the code block with the link on the irc side
osa1 has joined #ocaml
Tuplanolla has joined #ocaml
raver has quit [Quit: Gateway shutdown]
artymort has quit [Read error: Connection reset by peer]
artymort6 has joined #ocaml
<reynir> ^ I agree
<zozozo> (ah, and edits for messages containing code are a bit annoying seing as the bot simply reposts the whole message with the edits, leading to quite a lot of noise)
<d_bot> <undu> Maybe link to gists, and modify the code in the gists directly
<d_bot> <Et7f3> I think we can take habit to use gist (because some we might use some snippet again) + even on discord some time code are too large and aren't foldable
nullcone has quit [Quit: Connection closed for inactivity]
Haudegen has joined #ocaml
Hail_Spacecake has left #ocaml [#ocaml]
osa1 has quit [Quit: osa1]
<d_bot> <taritsu_n> > for example some ML files with custom syntax specified by CamlP5
<d_bot> <taritsu_n> Speaking of Camlp5, will it be merged to the standard Camlp
mbuf has joined #ocaml
averell has quit [Remote host closed the connection]
averell has joined #ocaml
bitonic has quit [Ping timeout: 265 seconds]
Guest75717 has quit [Ping timeout: 246 seconds]
kandu has joined #ocaml
sadiq has quit [Ping timeout: 260 seconds]
kandu is now known as Guest82115
Guest86335 has quit [Ping timeout: 264 seconds]
sadiq has joined #ocaml
vsiles has quit [Ping timeout: 256 seconds]
rdivyanshu_ has quit [Ping timeout: 244 seconds]
adrianbrink has quit [Ping timeout: 244 seconds]
robmyers has quit [Ping timeout: 244 seconds]
l1x has quit [Ping timeout: 244 seconds]
Duns_Scrotus has quit [Ping timeout: 244 seconds]
alehander92 has quit [Ping timeout: 244 seconds]
strmpnk has quit [Ping timeout: 244 seconds]
Boarders has quit [Ping timeout: 244 seconds]
kit_ty_kate has quit [Ping timeout: 240 seconds]
Drup has quit [Ping timeout: 272 seconds]
vsiles has joined #ocaml
conjunctive has quit [Read error: Connection reset by peer]
metadave has quit [Read error: Connection reset by peer]
chewbranca has quit [Read error: Connection reset by peer]
stylewarning has quit [Write error: Connection reset by peer]
bitonic has joined #ocaml
chewbranca has joined #ocaml
rdivyanshu_ has joined #ocaml
robmyers has joined #ocaml
metadave has joined #ocaml
Boarders has joined #ocaml
stylewarning has joined #ocaml
adrianbrink has joined #ocaml
conjunctive has joined #ocaml
adi_________ has quit [Read error: Connection reset by peer]
adi_________ has joined #ocaml
cbarrett has quit [Ping timeout: 244 seconds]
zebrag has joined #ocaml
Drup has joined #ocaml
inkbottle has quit [Ping timeout: 240 seconds]
Guest86335 has joined #ocaml
cbarrett has joined #ocaml
rwmjones has quit [Remote host closed the connection]
rwmjones has joined #ocaml
kit_ty_kate has joined #ocaml
strmpnk has joined #ocaml
Duns_Scrotus has joined #ocaml
alehander92 has joined #ocaml
narimiran has quit [Ping timeout: 265 seconds]
l1x has joined #ocaml
Duns_Scrotus has quit [Ping timeout: 244 seconds]
alehander92 has quit [Ping timeout: 244 seconds]
alehander92 has joined #ocaml
alehander92 has quit [Excess Flood]
Duns_Scrotus has joined #ocaml
alehander92 has joined #ocaml
<mbuf> Why do I get "Unbound Value" error for the following code snippet? https://pastebin.com/2yxmuG2z
<mbuf> Is there a better way to write it?
<d_bot> <craigfe> What do you expect the value of [n] to be on line 4? At risk of re-stating the error message, it's not defined anywhere ๐Ÿ™‚
<mbuf> d_bot, the same value that I pass to exe_found, n
<mbuf> If I give it an explicit "foo.exe" in line 4, it works fine.
<d_bot> <craigfe> That value of [n] scoped inside the definition of [exe_found], but the [match] comes after the definition of that function
<mbuf> I want to search a list of strings, and return the string that matches .exe. But, Str.search_forward returns an integer, so I am trying to convert that to boolean, so that I can use it in filter
<mbuf> Is there a better way to write it?
strmpnk has quit [Ping timeout: 244 seconds]
<d_bot> <craigfe> Using `string_match`, perhaps? That function returns a boolean
Serpent7776 has quit [Ping timeout: 240 seconds]
l1x has quit [Read error: Connection reset by peer]
strmpnk has joined #ocaml
<mbuf> d_bot, I tried string_match, but, it expects the correct start position to start from to match a search
l1x has joined #ocaml
<mbuf> d_bot, For a two-letter word, if I try to search in index 4, for example, it throws "Exception: Invalid_argument "Str.string_match".
<mbuf> d_bot, I need to give it the exact index for ".exe" for start position
<d_bot> <craigfe> So it does. `Str` is quite an odd API...
Serpent7776 has joined #ocaml
<mbuf> Let me try filtering out strings that are less than five characters, then I will not get the exception
<d_bot> <craigfe> Well, you can get around your problem by not trying to use intermediate `int` values
<d_bot> <craigfe> ```
<d_bot> <craigfe> let exe_found n =
<d_bot> <craigfe> try
<d_bot> <craigfe> let (_ : int) = Str.search_forward (Str.regexp "\\.exe$") n 0 in
<d_bot> <craigfe> true
<d_bot> <craigfe> with
<d_bot> <craigfe> Not_found -> false
<d_bot> <craigfe> ```
<mbuf> List.filter (fun x -> Str.string_match (Str.regexp "\\.exe$") x 5) s works, but, I have to filter out s, which is a string list, without strings less than 5 characters
<mbuf> d_bot, let me try that
<mbuf> d_bot, works, thanks!
<d_bot> <craigfe> ๐Ÿ™‚
strmpnk has quit [Read error: Connection reset by peer]
strmpnk has joined #ocaml
<Johann> mbuf: also, you might prefer using the Filename.check_suffix function instead of a regex (https://caml.inria.fr/pub/docs/manual-ocaml/libref/Filename.html#VALcheck_suffix)
malc_ has joined #ocaml
<mbuf> Johann, that simplifies things much better; thanks!
<mbuf> d_bot, what does the (_ : int) in the let statement mean?
malc_ has left #ocaml ["ERC (IRC client for Emacs 28.0.50)"]
strmpnk has quit [Read error: Connection reset by peer]
strmpnk has joined #ocaml
l1x has quit [Read error: Connection reset by peer]
l1x has joined #ocaml
mangoicedtea has joined #ocaml
cbarrett has quit [Read error: Connection reset by peer]
cbarrett has joined #ocaml
cbarrett has quit [Read error: Connection reset by peer]
copy has quit [Remote host closed the connection]
copy has joined #ocaml
Amaan_ has quit [Ping timeout: 260 seconds]
cbarrett has joined #ocaml
Amaan has joined #ocaml
ldbeth has joined #ocaml
<ldbeth> taritsu_n: I think CamlP4 shipped with OCaml is dropped in recent versions. and developers are encouraged to use CamlP5
strmpnk has quit [Read error: Connection reset by peer]
strmpnk has joined #ocaml
<d_bot> <craigfe> mbuf: it constrains the ignored value to have type int, to ensure that the code doesn't ignore a partially-applied function
ldbeth has quit [Ping timeout: 240 seconds]
motherfsck has quit [Ping timeout: 256 seconds]
companion_cube has quit [Quit: WeeChat 2.3]
ocabot has quit [Remote host closed the connection]
ocabot has joined #ocaml
companion_cube has joined #ocaml
motherfsck has joined #ocaml
FreeBirdLjj has joined #ocaml
motherfsck has quit [Ping timeout: 240 seconds]
metadave has quit []
metadave has joined #ocaml
mangoicedtea has quit [Remote host closed the connection]
motherfsck has joined #ocaml
motherfsck has quit [Ping timeout: 256 seconds]
motherfsck has joined #ocaml
Simerax has joined #ocaml
Simerax has quit [Quit: https://quassel-irc.org - Komfortabler Chat. รœberall.]
Simerax has joined #ocaml
Simerax has quit [Client Quit]
Simerax has joined #ocaml
Simerax has quit [Client Quit]
Hrundi_V_Bakshi has joined #ocaml
Simerax has joined #ocaml
mbuf has quit [Quit: Leaving]
reynir has quit [Ping timeout: 246 seconds]
reynir has joined #ocaml
<d_bot> <Bluddy> @zozozo @octachron Unfortunately it doesn't seem like matterbridge has any feature for handling code blocks differently. I'll post a feature request. Is there any standard site that IRC users tend to use for posting code blocks? Preferably one with a simple API.
<d_bot> <Bluddy> What I *can* do is disable editing updates on the IRC side if people prefer that. That would prevent re-sending of messages if they're edited on the discord side.
<d_bot> <Bluddy> (Of course, then IRC users don't get to see the updates, but we can get into the habit of correcting with new messages on #general )
Bluddy has joined #ocaml
<d_bot> <undu> I've usually seen https://paste.debian.net/ being used, but the interface is built n xml-rpc
waleee-cl has joined #ocaml
<octachron> Well, avoiding code block in the general channel in discord works too.
narimiran has joined #ocaml
<d_bot> <stab> Anybody know how you handle the precedence difference between a unary minus and a binary minus in menhir? So like obviously the standard precedence places minus at a lower precedence than multiplication, however the unary application (-10) should be considered a higher precedence. The best ive come up with is to indtroduce a fake token and use its precedence with a %prec annotation for the unary production
<d_bot> <stab> So basically i have like a new token UNARYMINUS, which is never produced by the lexer but is used to refer to the precedence by the production, is this the intended solution?
nullifidian has quit [Quit: Leaving]
<d_bot> <mseri> ldbeth afaik camlp5 is older than camlp4, was replaced by camlp4 in the compiler as you mentioned and now the recommendation is to use ppx. Both camlp4 and 5 are not officially supported but they have quite active community support
FreeBirdLjj has quit [Remote host closed the connection]
<Simerax> if i define a type like this: type t1 = SomeVariant of {f1: bool} and i create a variable like let x = SomeVariant{f1=true} why can i not access f1 with the dot notation like x.f1? it says unbound record field. My guess is that im somehow not accessing the record itself and just the Variant maybe im completely wrong. How would i go about accessing f1?
<companion_cube> if you only have one case, remove `SomeVariant` and you'll get a record
<Simerax> i know i just tried to keep the example simple
<companion_cube> if you have several cases, then you need to match because `f1` is only valid in a SomeVariant
<Simerax> okay
<Simerax> thanks
<Simerax> makes sense now that i think about it
zolk3ri has joined #ocaml
Bluddy has quit [Quit: Connection closed for inactivity]
<d_bot> <ggole> You can actually bind the inline-record to a variable and access its fields, but there are various restrictions on such records
<companion_cube> and only inside a match
<ggole> Well, in any pattern
sonologico_ has joined #ocaml
tane has joined #ocaml
sonologico_ has quit [Quit: Leaving]
Jesin has quit [Quit: Leaving]
<d_bot> <oleg_p> It's not exactly an Ocaml question because I haven't seen any writer monad in Ocaml yet but I'm reading LYAH book and the author defines the `Writer` constructor :
<d_bot> <oleg_p> ```haskell
<d_bot> <oleg_p> newtype Writer w a = Writer {runWriter :: (a, w)}
<d_bot> <oleg_p> ```
<d_bot> <oleg_p> What is the logic behind flipping the types `w` `a` , doesn't it add only more confusion ?
<d_bot> <oleg_p> It's not exactly an Ocaml question because I haven't seen any writer monad in Ocaml yet but I'm reading LYAH book and the author defines the `Writer` constructor :
<d_bot> <oleg_p> ```haskell
<d_bot> <oleg_p> newtype Writer w a = Writer {runWriter :: (a, w)}
<d_bot> <oleg_p> -- as opposed to newtype Writer w a = Writer {runWriter :: (w, a)}
<d_bot> <oleg_p> ```
<d_bot> <oleg_p> What is the logic behind flipping the types `w` `a` , doesn't it add only more confusion ? (edited)
<d_bot> <Bluddy> I don't think there's much logic there. It's just convention.
Jesin has joined #ocaml
<Simerax> how do ppl do pretty printing in tests? i just started using ounit and its standard output is far from optimal. Ive seen that i can supply a printer via the ~printer parameter to the assert_equal function. Do i need to implement a custom pretty print function for all my custom structures or is there some introspection mechanism in ocaml?
<Simerax> im guessing there is one since utop can print custom structures very well.
<d_bot> <ggole> They probably want the type `Writer w` to be a monad or something. That is, in the monad operations you have an applied type like `f a` and the `f` will be `Writer w`.
<d_bot> <oleg_p> @ggole indeed, but then also I would expect to have `newtype Writer w a = Writer {runWriter :: (w, a)}` (return type to also match the order of `w` `a`)
<d_bot> <ggole> Yeah, dunno
<d_bot> <ggole> Maybe there's something that lines up with that particular order
<d_bot> <oleg_p> @ggole indeed, but then also I would expect to have `newtype Writer w a = Writer {runWriter :: (w, a)}` (return type to also match the order of `w` `a`).
<d_bot> <oleg_p> (so with their definition when I write `Writer ([""], Sum 0)` its type would be `Writer (Sum Int) [[Char]]`) (edited)
<octachron> Simerax, you can use ppx_deriving to generate printer by adding an annotation to your structure. There is no introspection mechanism in OCaml in general. The REPL printer works because the REPL is essentially spying/controling the compilation process.
<Simerax> octachron: thanks i will look into ppx_deriving! :)
narimiran has quit [Ping timeout: 265 seconds]
<d_bot> <Et7f3> @Simerax try ppx_deriving with show annotations but the toplevel is a hack. While fb team has a package called reason-native/console that emulate generic console.log of js
<Simerax> yeah im currently trying to get derive.show to work but it says uninterpreted extension
<d_bot> <Et7f3> Add in your build system
<d_bot> <Et7f3> In dune you have pps field for your test
<Simerax> i did but only in the lib i guess i had to include it in test/dune as well :D
<octachron> Once your library contains the printer, you should not need the printer in the tests.
<Simerax> as soon as i remove the include in my test/dune it complains about uninterpreted extesion
<Simerax> maybe my whole project setup is wrong i dunno
<Simerax> i got it working now
<Simerax> btw
amiloradovsky has joined #ocaml
vicfred has quit [Quit: Leaving]
vicfred has joined #ocaml
ggole has quit [Quit: Leaving]
Haudegen has quit [Quit: No Ping reply in 180 seconds.]
nullcone has joined #ocaml
Haudegen has joined #ocaml
<d_bot> <Et7f3> how can I write `let g: type a. 'c * a list * 'b = 1, [], 3;;` for triplet not `g` but `(g, f, d)`
borne has joined #ocaml
reynir has quit [Ping timeout: 256 seconds]
<d_bot> <Et7f3> the workaroun I have is to destruct after
reynir has joined #ocaml
sagax has joined #ocaml
<defolos> I have a problem that I don't understand: I have a pattern match that matches a generic type, but when I try to apply it for a specialized type, then I get an error of the type: "this pattern matches values of type 'a filter or constraint, but a pattern was expected which matches values of type name * filter filter or constraint"
tane has quit [Quit: Leaving]
<defolos> and unfortunately I have no idea why a pattern match should work on `'a filter or constraint` but not on the specialized type
Tuplanolla has quit [Quit: Leaving.]
reynir has quit [Ping timeout: 264 seconds]
<zozozo> defolos: the "specialized type" as you call it appears to actually be a tuple of a "name" and the specialized type "filter filter or contraint", the problems might be the tuple rather than the specialization
mangoicedtea has joined #ocaml
reynir has joined #ocaml
reynir has quit [Ping timeout: 256 seconds]
Simerax has quit [Ping timeout: 246 seconds]
sonologico has quit [Remote host closed the connection]
Hrundi_V_Bakshi has quit [Ping timeout: 240 seconds]
reynir has joined #ocaml
Haudegen has quit [Ping timeout: 240 seconds]
zolk3ri has left #ocaml [#ocaml]
reynir has quit [Ping timeout: 240 seconds]
reynir has joined #ocaml
reynir has quit [Ping timeout: 240 seconds]
reynir has joined #ocaml
reynir has quit [Excess Flood]
reynir has joined #ocaml
reynir has quit [Ping timeout: 256 seconds]
reynir has joined #ocaml
rlr has joined #ocaml
motherfs1 has joined #ocaml
motherfsck has quit [Ping timeout: 240 seconds]