adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.07.0 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.07/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml | Due to ongoing spam, you must register your nickname to talk on the channel
mfp has quit [Ping timeout: 240 seconds]
gtrak has quit [Ping timeout: 246 seconds]
jbrown has joined #ocaml
thomas_scrace has joined #ocaml
thomas_scrace has quit [Ping timeout: 245 seconds]
jao has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
moei has joined #ocaml
Fare has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 252 seconds]
igitoor has quit [Ping timeout: 252 seconds]
igitoor has joined #ocaml
igitoor has quit [Changing host]
igitoor has joined #ocaml
kakadu_ has joined #ocaml
kakadu has quit [Ping timeout: 252 seconds]
caltelt has joined #ocaml
jao has joined #ocaml
silver has quit [Read error: Connection reset by peer]
jao has quit [Ping timeout: 252 seconds]
tormen has joined #ocaml
tormen_ has quit [Ping timeout: 272 seconds]
thomas_scrace has joined #ocaml
pierpa has quit [Quit: Page closed]
thomas_scrace has quit [Ping timeout: 240 seconds]
dmiles has quit [Read error: Connection reset by peer]
lopex has quit [Quit: Connection closed for inactivity]
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
caw_________ has quit [Ping timeout: 260 seconds]
sspi__ has quit [Ping timeout: 260 seconds]
terrorjack has quit [Ping timeout: 260 seconds]
HDurer[m] has quit [Ping timeout: 260 seconds]
caltelt_ has joined #ocaml
sspi__ has joined #ocaml
caw_________ has joined #ocaml
terrorjack has joined #ocaml
Fare has quit [Ping timeout: 244 seconds]
dmiles has joined #ocaml
erkin has joined #ocaml
jbrown has quit [Ping timeout: 245 seconds]
HDurer[m] has joined #ocaml
Fare has joined #ocaml
nopf has quit [Ping timeout: 240 seconds]
caltelt has quit [Ping timeout: 244 seconds]
nopf has joined #ocaml
Leonidas has quit [Ping timeout: 252 seconds]
dmiles has quit [Ping timeout: 260 seconds]
Leonidas has joined #ocaml
<Fare> Is there a standard way to turn a function into an infix operator as in Haskell, e.g. a `plus` b ?
<ZirconiumX> You can define custom operators in parens
<ZirconiumX> Generally though we tend not to use that kind of thing
<Fare> if not, maybe an operator let (|>|) x f = f x ;; ?
<Fare> so that 1 |>| (+) 2 ===> 3
<ZirconiumX> That's (|>)
<ZirconiumX> Which is part of Pervasives I think
<Fare> So |> makes anything into an infix operator. Nice.
<Fare> Oh, no, because the priority is wrong.
<ZirconiumX> 1 |> plus 2 => 3
<Fare> I mean, precedence
<ZirconiumX> It's effectively left to right
<Fare> (1 |> plus) 2 is what I'm after.
<ZirconiumX> As in it gets executed visually from left to right
<Fare> except without the parents :-/
<ZirconiumX> Why do you need this, anyway?
<Fare> So I want a variant of |> that takes precedence over application on the right side.
<ZirconiumX> let (@@) f x = f x
<ZirconiumX> That's in Pervasives, too
<ZirconiumX> But generally it's more idiomatic to use |>
thomas_scrace has joined #ocaml
<Fare> And my solution is let (#>) = (|>)
<Fare> same thing, different precedence!
<ZirconiumX> Yeah, but you'll confuse people
<Fare> My problem is using Lwt.(>>=) in an infix style when within a monad Lwt_exn that combines Lwt with an error monad.
<ZirconiumX> Have to tried using let%lwt instead? I find (>>=) in Lwt to be pretty hard to read
thomas_scrace has quit [Ping timeout: 244 seconds]
henrytill has quit [Ping timeout: 268 seconds]
Guest77842 has quit [Ping timeout: 268 seconds]
henrytill has joined #ocaml
Guest77842 has joined #ocaml
dmiles has joined #ocaml
wildsebastian has quit [Ping timeout: 240 seconds]
rixed has quit [Ping timeout: 260 seconds]
sonologico has quit [Ping timeout: 260 seconds]
sonologico has joined #ocaml
rixed has joined #ocaml
kit_ty_kate has quit [Ping timeout: 240 seconds]
kit_ty_kate has joined #ocaml
eagleflo has quit [Ping timeout: 260 seconds]
eagleflo has joined #ocaml
wildsebastian has joined #ocaml
erkin has quit [Ping timeout: 240 seconds]
<Fare> ZirconiumX, most of the time I use other monads on top of Lwt.
<Fare> so let%lwt won't help
* ZirconiumX wonders at which point you have too many monads
<Fare> Plus, I truly, deeply, despise right-to-left evaluation in a language where function type arrows go from left to right.
<Fare> |> >> >>> >>= for the win!
<ZirconiumX> I still have to remind myself that >>= does not do left shift in OCaml
<Fare> Make FP Concatenative Again!
<ZirconiumX> So while I love the language, my upbringing betrays me just a bit
erkin has joined #ocaml
clownpriest has joined #ocaml
sagotch has joined #ocaml
Rosslaew has joined #ocaml
sagotch has quit [Ping timeout: 252 seconds]
thomas_scrace has joined #ocaml
sagotch has joined #ocaml
thomas_scrace has quit [Ping timeout: 246 seconds]
quarters has quit [Ping timeout: 250 seconds]
caltelt_ has quit [Ping timeout: 245 seconds]
JimmyRcom has joined #ocaml
JimmyRcom has quit [Max SendQ exceeded]
JimmyRcom has joined #ocaml
clownpriest has quit [Ping timeout: 252 seconds]
sagotch has quit [Quit: Leaving.]
JimmyRcom has quit [Quit: Leaving]
<Leonidas> ZirconiumX: with ligatures it doesn't look like shift at all anymore ;-)
<Leonidas> Fare: you could use let%bind, which is like let%lwt but configurable to different monads
<Leonidas> I find it very, very useful
Fare has quit [Ping timeout: 252 seconds]
<reynir> I imagine left shift assignment operator is one of the less used ones
* Leonidas :D
freyr69 has joined #ocaml
orbifx has joined #ocaml
AltGr has joined #ocaml
Haudegen has joined #ocaml
sagotch has joined #ocaml
quipa has joined #ocaml
Rosslaew has quit [Remote host closed the connection]
Rosslaew has joined #ocaml
mfp has joined #ocaml
Rosslaew has quit [Remote host closed the connection]
Rosslaew has joined #ocaml
ollehar has joined #ocaml
<flux[m]> btw, >> is shift right, not left.. :-)
Rosslaew has quit [Remote host closed the connection]
Rosslaew has joined #ocaml
<reynir> oops
dacid has joined #ocaml
orbifx has quit [Ping timeout: 244 seconds]
inr has joined #ocaml
kvda has joined #ocaml
gareppa has joined #ocaml
<ZirconiumX> Yeah, woops ^^;
quipa has quit [Ping timeout: 252 seconds]
thomas_scrace has joined #ocaml
lopex has joined #ocaml
artart78 has quit [Changing host]
artart78 has joined #ocaml
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kvda has joined #ocaml
steenuil has quit [Remote host closed the connection]
jaar has joined #ocaml
sagotch has quit [Quit: Leaving.]
steenuil has joined #ocaml
jao has joined #ocaml
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
kvda has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Haudegen has quit [Remote host closed the connection]
dacid has quit [Quit: WeeChat 1.4]
sagotch has joined #ocaml
ziyourenxiang has joined #ocaml
spew has joined #ocaml
Haudegen has joined #ocaml
thomas_scrace has quit [Ping timeout: 245 seconds]
thomas_scrace has joined #ocaml
steenuil has quit [Remote host closed the connection]
jao has quit [Ping timeout: 244 seconds]
steenuil has joined #ocaml
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
silver has joined #ocaml
gareppa has quit [Quit: Leaving]
Rosslaew has quit [Ping timeout: 252 seconds]
gtrak has joined #ocaml
gtrak has quit [Client Quit]
gtrak has joined #ocaml
<ruffy_> Can I match five booleans like this? For me I always reach the case where all are false, although one is set to true. What is my mistake?
<ruffy_> let decide_algebra = match !(flags.sum), !(flags.pol), !(flags.max), !(flags.msum), !(flags.mpol) with
<ruffy_> | true, false, false, false, false -> (module MakeWpoInstance(Sum) : WPO)
<ruffy_> | false, true, false, false, false -> (module MakeWpoInstance(Pol))
<ruffy_> | false, false, true, false, false -> (module MakeWpoInstance(Max))
<ruffy_> | false, false, false, true, false -> (module MakeWpoInstance(MSum))
<ruffy_> | false, false, false, false, true -> (module MakeWpoInstance(MPol))
<ruffy_> | false, false, false, false, false -> (module MakeWpoInstance(Sum))
<ruffy_> | _, _, _, _, _ -> failwith "You cannot specify two algebras"
<ruffy_> ;;
<Drup> This is begging for a sum type.
<ruffy_> But why do I always reach the case where all are false?
<ZirconiumX> ruffy_: please use a pastebin, it's basic etiquette
<reynir> Do you set the fields of flags?
<ruffy_> ZirconiumX: Sry, I will do that next time
<theblatte> and is this evaluated before you actually set the flags?
<ruffy_> reynir: I set them all to false in the beginning
<ruffy_> theblatte: Hmmm normally it is evaluated afterwards, but maybe I have something wrong there
<thizanne> ruffy_: to be clear, your code is correct. Your error is that none of them is actually set to true, but we can't know why without the rest of your code
<thizanne> (or maybe you don't actually reach the case where all are false ? The first one looks similar, are you sure you do indeed reach the last one ?)
<ruffy_> Hmmmm but I print one variable afterwards and it is set to true....
<ruffy_> Yes I am sure
<ruffy_> I will look, when the flags are set
<thizanne> print your variable before the match then
<thizanne> let decide_algebra = print_bool !flags.supposedtobetrue; match ...
<ruffy_> Okay I will do that
<ruffy_> btw, can I open a local module?
<thizanne> yes
<thizanne> let open M in ...
<thizanne> (it's a local open)
<ruffy_> thank you
<thizanne> ruffy_: if you could show a minimal example of why it doesn't work, we could help
<ruffy_> thizanne: I will try that with printing and if it does not help, then I use a pastebin with an example :)
<Armael> AltGr: does opam-file-format handle both opam1 and opam2 file formats?
Denommus has joined #ocaml
<ruffy_> thizanne: I have figured out the problem. I had my function on the top level, but called it local in a function afterwards. BUT my top level function has no arguments, so it was evaluated before the call in the function.
<ruffy_> And the flags were set in the function afterwards. Thank you for the help.
<thizanne> that's what I thought
<thizanne> I'm glad you figured that alone, I wasn't sure how to explain in an understandable way without seeing your code
<ruffy_> thanks again
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
clownpriest has joined #ocaml
al-damiri has joined #ocaml
freyr69 has quit [Remote host closed the connection]
lobo has quit [Quit: WeeChat 1.6]
sagotch has quit [Quit: Leaving.]
lobo has joined #ocaml
ollehar has quit [Ping timeout: 252 seconds]
jao has joined #ocaml
jbrown has joined #ocaml
Haudegen has quit [Remote host closed the connection]
Fare has joined #ocaml
gareppa has joined #ocaml
clownpriest has quit [Ping timeout: 252 seconds]
tokomak has joined #ocaml
jnavila has joined #ocaml
Fare has quit [Ping timeout: 245 seconds]
bartholin has joined #ocaml
thomas_scrace has quit [Ping timeout: 252 seconds]
Fare has joined #ocaml
clownpriest has joined #ocaml
Haudegen has joined #ocaml
steenuil_ has joined #ocaml
steenuil has quit [Ping timeout: 240 seconds]
Armael has quit [Ping timeout: 250 seconds]
jnavila has quit [Ping timeout: 252 seconds]
gikiam has quit [Ping timeout: 244 seconds]
Armael has joined #ocaml
gikiam has joined #ocaml
jnavila has joined #ocaml
<flux[m]> ruffy_: there's also the shortcut M.(expr) for short stuff
clownpri1 has joined #ocaml
clownpriest has quit [Ping timeout: 252 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
Fare has quit [Ping timeout: 240 seconds]
mcspud- has left #ocaml [#ocaml]
r3s1stanc3 has joined #ocaml
AltGr has quit [Quit: Konversation terminated!]
Fare has joined #ocaml
gareppa has quit [Quit: Leaving]
FreeBirdLjj has joined #ocaml
r3s1stanc3 has quit [Quit: ZNC 1.7.1 - https://znc.in]
r3s1stanc3 has joined #ocaml
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
clownpriest has joined #ocaml
clownpri1 has quit [Ping timeout: 250 seconds]
r3s1stanc3 has quit [Quit: ZNC 1.7.1 - https://znc.in]
r3s1stanc3 has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
sagotch has joined #ocaml
jaar has quit [Quit: Leaving]
tokomak has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
Fare has quit [Ping timeout: 244 seconds]
Fare has joined #ocaml
gareppa has joined #ocaml
Jesin has quit [Quit: Leaving]
xuanrui has joined #ocaml
kakadu_ has quit [Quit: Konversation terminated!]
mengu has joined #ocaml
xuanrui has quit [Remote host closed the connection]
Jesin has joined #ocaml
mengu has quit [Remote host closed the connection]
mengu has joined #ocaml
TheLemonMan has joined #ocaml
mengu has quit [Ping timeout: 252 seconds]
mengu has joined #ocaml
lobo has quit [Quit: WeeChat 1.6]
clownpri1 has joined #ocaml
clownpriest has quit [Ping timeout: 252 seconds]
Fare has quit [Ping timeout: 252 seconds]
Fare has joined #ocaml
lobo has joined #ocaml
clownpri1 has quit [Ping timeout: 252 seconds]
sagotch1 has joined #ocaml
jlongster has joined #ocaml
sagotch has quit [Ping timeout: 246 seconds]
jlongster has quit [Client Quit]
<_y> from https://caml.inria.fr/pub/docs/manual-ocaml/lex.html#infix-symbol i understand that ( | ) is a valid operator name, but “let ( | ) = …” is a syntax error
<_y> is it an error in the manual?
Jesin has quit [Quit: Leaving]
orbifx has joined #ocaml
clownpri1 has joined #ocaml
<octachron> yes
<_y> i hoped i could trust the manual for parsing ocaml’s grammar :-(
Haudegen has quit [Remote host closed the connection]
<_y> octachron, is it already known, or should i report it (or is it not worth the effort) ?
erkin has quit [Remote host closed the connection]
clownpri1 has quit [Ping timeout: 252 seconds]
<octachron> It would be nice to report it if you can, ( I am not totally sure where the error lies )
mengu has quit [Remote host closed the connection]
<discord> <Perry> things like |> are valid operators.
<discord> <Perry> and ||
<discord> <Perry> Is | alone invalid?
<_y> (btw most of the operators listed explicitely here https://caml.inria.fr/pub/docs/manual-ocaml/names.html#infix-op are subsumed by the grammar of infix-symbol)
mengu has joined #ocaml
<_y> Perry, yes
<_y> (how to highlight discord users from irc?)
clownpri1 has joined #ocaml
<ZirconiumX> I don't think you can
<discord> <Perry> Explaining that || is valid and | isn't would be interesting. I presume the grammar in the manual isn't quite valid...
<_y> Perry, my guess is that | should have the same status as # in infix-symbol (the first url i gave), that is, they must be followed by at least one operator-char
<discord> <Perry> Ah, I suppose it is covered by this rule: "The following character sequences are also keywords"
<discord> <Perry> and | is listed there.
<discord> <Perry> Perhaps text should be added saying that operators are sequences of those characters that are NOT in the set of keywords.
mengu has quit [Ping timeout: 252 seconds]
<_y> Perry, that is not true, ( & ), ( && ), ( != ), ( + ), ( - ) and so on, are valid operator names
sagotch1 has quit [Quit: Leaving.]
Jesin has joined #ocaml
<discord> <Perry> ah.
<discord> <Perry> Then I suppose I don't know what the rule is. 😦
clownpri1 has quit [Ping timeout: 252 seconds]
gareppa has quit [Quit: Leaving]
pierpa has joined #ocaml
TheRuralJuror has joined #ocaml
kakadu has joined #ocaml
clownpri1 has joined #ocaml
TheRuralJuror has quit [Read error: Connection reset by peer]
kotrcka has joined #ocaml
clownpriest has joined #ocaml
clownpri1 has quit [Ping timeout: 252 seconds]
clownpriest has quit [Ping timeout: 240 seconds]
clownpri1 has joined #ocaml
mengu has joined #ocaml
thomas_scrace has joined #ocaml
clownpriest has joined #ocaml
clownpriest has quit [Client Quit]
<discord> <Perry> I imagine (;) isn't valid either for example, but I don't know what's correct. _y, you should indeed file a bug report.
clownpri1 has quit [Ping timeout: 250 seconds]
clownpriest has joined #ocaml
clownpriest has quit [Client Quit]
clownpriest has joined #ocaml
mengu has quit [Quit: Leaving...]
clownpriest has quit [Client Quit]
clownpriest has joined #ocaml
erkin has joined #ocaml
bartholin has quit [Remote host closed the connection]
gareppa has joined #ocaml
clownpriest has quit [Client Quit]
erkin has quit [Read error: Connection reset by peer]
clownpriest has joined #ocaml
clownpriest has quit [Client Quit]
clownpriest has joined #ocaml
Fare has quit [Ping timeout: 272 seconds]
gareppa has quit [Quit: Leaving]
xuanrui has joined #ocaml
<orbifx> For binding to C, has there been anything better other than using OCaml's externs and writing stubs?
<orbifx> I recall something about defining the stubs from within OCaml.. ?
jnavila has quit [Ping timeout: 246 seconds]
erkin has joined #ocaml
<copy`> orbifx: I haven't used it, but there's ctypes
erkin has quit [Remote host closed the connection]
<Leonidas> yes, I think ctypes can also create stubs, but it is a bit tricky to get the whole setup to compile
clownpriest has quit [Ping timeout: 240 seconds]
<orbifx> I see, I remember Ctype as a package for defining C structures. It can also make the stubs?
spew has quit []
<Armael> yes it can
<orbifx> copy`, Leonidas anything else? (checking to see if anhything has changed since I looked into this about a year ago)
<orbifx> thanks Armael
<orbifx> I remeber there being a performance penalty for unpacking OCaml values from withing OCaml, is that the case?
<Armael> um, I'm not sure, but I think when using stub generation there should be no runtime penalty compared to manually written stubs
thomas_scrace has quit [Ping timeout: 245 seconds]
thomas_scrace has joined #ocaml
<orbifx> hmm that's surprising, pleasantly. Would have expected doing more work would lead to something more efficient. Armael
gtrak has quit [Ping timeout: 252 seconds]
kakadu has quit [Remote host closed the connection]
<Armael> I don't know if ctypes qualifies as "less work" actually, since the more complicated build setup also has its cost
<Armael> what you gain for sure is safety (and you lose some flexibility, which is fine for most use cases)
<Armael> (especially with stubs gen, where you have maximal safety and a maximally complicated build setup)
<orbifx> Cool, will give it a try :)
clownpriest has joined #ocaml
<Leonidas> I'm looking at https://github.com/prepor/ocaml-edn/blob/a76d045541d0fca9077c54de5c3b67707743539e/src/edn_read.mll#L13 and if I use dune to compile it it says that the first occurence of `v` is never used.
<Leonidas> But then it types `v` to be string option instead of string. What is happening there?
clownpri1 has joined #ocaml
<Leonidas> orbifx: not that I know of, sorry
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
clownpriest has quit [Ping timeout: 252 seconds]
clownpri1 is now known as clownpriest
<orbifx> Leonidas: not familiar with the operators of that library
<orbifx> something I noticed when compiling with dune is that when using using `xyz as a`, the xyz needs to be _xyz, if you are only using the a
<orbifx> maybe its a similar case Armael
<orbifx> laters all
orbifx has quit [Quit: WeeChat 2.1]
Denommus has quit [Remote host closed the connection]
<_y> on operator names again, i am not sure anymore than the thing we were discussing is an error in the manual
<_y> because -> and <- also match the grammar given but are not valid operator names
<_y> there is no negation in the grammar metalanguage
kvda has joined #ocaml
thomas_scrace has quit [Ping timeout: 240 seconds]
thomas_scrace has joined #ocaml
<discord> <Perry> _y: it is an error in the manual because it doesn't explain that these are not valid operator names.
jave has quit [Ping timeout: 240 seconds]
<discord> <Perry> at the very least, it should be mentioned. anything that confuses someone once may confuse others in the future.
thomas_scrace has quit [Ping timeout: 246 seconds]
jave has joined #ocaml
Jesin has quit [Ping timeout: 252 seconds]
xuanrui has quit [Read error: Connection reset by peer]
gtrak has joined #ocaml