nicoo has quit [Remote host closed the connection]
nicoo has joined #ocaml
zv has quit [Ping timeout: 268 seconds]
<indicator>
What's a good library to parse dates and do date arithmetic on them? I tried ptime, but it seems it's strictly for timestamps, no way to parse a simple ISO date
<d_bot>
<hcarty> indicator: https://github.com/ocaml-community/calendar works well for that. It has parsing, printing and arithmetic functions. I think there's also a separate iso date parsing library on opam. And I think the Jane Street libraries have something for this
tane has quit [Quit: Leaving]
amiloradovsky has quit [Ping timeout: 268 seconds]
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
Tuplanolla has quit [Quit: Leaving.]
vicfred has quit [Quit: Leaving]
vicfred has joined #ocaml
mfp has quit [Ping timeout: 240 seconds]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 264 seconds]
Haudegen has quit [Ping timeout: 260 seconds]
<d_bot>
<darrenldl> indicator: if you need good time zone support, Drup and I are working on Timere, which has good (or at least I claim so) time zone support for date times https://github.com/daypack-dev/timere
<d_bot>
<darrenldl> I am still adding ISO8601 date parsing and printing. As for support of arithmetic on date times of individual fields, I'll have to think about it a bit more - always felt a bit dodgy to me
steenuil has quit [Read error: Connection reset by peer]
<d_bot>
<darrenldl> (Timere provides a Duration module, but only handles up to days, and doesn't support "year" or "month" as a unit)
madroach has joined #ocaml
madroach_ has quit [Ping timeout: 256 seconds]
mxns has joined #ocaml
waleee-cl has quit [Quit: Connection closed for inactivity]
<d_bot>
<jayylmao> does anybody here know how to use zed? I'm trying to just append a character to the end of a line. The way I've done this by creating a context with a new cursor is using `Zed_edit.goto_eot` (there's only one line actually) to seek to the end of the data, then using `Zed_edit.insert_char` After doing this, `Zed_edit.get_data` simply returns the original data I put into the engine. Do I need to explicitly run/apply my context o
nicoo has quit [Remote host closed the connection]
nicoo has joined #ocaml
mxns has joined #ocaml
mxns has quit [Ping timeout: 264 seconds]
<indicator>
Thanks, I'll try Core.Date -- by arithmetic I just mean adding days to dates (and maybe adding days/hours/minutes etc. to times)
dborisog has joined #ocaml
<d_bot>
<darrenldl> indicator: that would be well defined for timestamp, but not necessarily for date times in general (cause DST), but i will add that to timere in some shape or form
mxns has joined #ocaml
mxns has quit [Ping timeout: 240 seconds]
Tuplanolla has joined #ocaml
bartholin has joined #ocaml
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
leah2 has quit [Ping timeout: 264 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 264 seconds]
leah2 has joined #ocaml
<d_bot>
<octachron> @EduardoRFS , the infinite recursion seems quite orthogonal to the recursive module? One option would be to only make instances as needed. This might require to change the encoding argument of `case` to a thunk or a lazy value.
mxns has joined #ocaml
mfp has joined #ocaml
mxns has quit [Ping timeout: 260 seconds]
nicoo has quit [Remote host closed the connection]
nicoo has joined #ocaml
mxns has joined #ocaml
mxns has quit [Ping timeout: 264 seconds]
Haudegen has joined #ocaml
jnavila has joined #ocaml
steenuil has joined #ocaml
delysin has joined #ocaml
olle_ has joined #ocaml
olle_ has quit [Ping timeout: 256 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 258 seconds]
webshinra has quit [Remote host closed the connection]
webshinra has joined #ocaml
artymort has quit [Ping timeout: 256 seconds]
zebrag has quit [Quit: Konversation terminated!]
FreeBirdLjj has joined #ocaml
zebrag has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 260 seconds]
troydm has quit [Quit: What is Hope? That all of your wishes and all of your dreams come true? To turn back time because things were not supposed to happen like that (C) Rau Le Creuset]
troydm has joined #ocaml
nicoo has quit [Ping timeout: 240 seconds]
andreas303 has quit [Ping timeout: 240 seconds]
cantstanya has quit [Remote host closed the connection]
tryte has quit [Ping timeout: 240 seconds]
cantstanya has joined #ocaml
nicoo has joined #ocaml
tryte has joined #ocaml
toppler has quit [Quit: ERC (IRC client for Emacs 26.3)]
<thizanne>
but maybe what you actually want to do is have these "common" functions in another module?
<confoo>
so I have a player type in player.ml which among other things consists of a {mode: int}, and based on the mode i want to call different functions in modeA.ml and modeB.ml
<confoo>
but I also want to pass in the player in the modeA and modeB functions
<confoo>
so in modeA i will have some signature like "let run (player:Player.player) = ... "
<confoo>
but in player i will have something like "if player.mode = 1 then run player ... "
<confoo>
could you suggest a good organization for this?
<confoo>
let me know if that makes sense? thizanne
<thizanne>
confoo: that's a bit too few info to design an optimal organization
<confoo>
Hum, what else would you need/
<qwr>
not sure I followed correctly, but if it's about Player datatype, put it into separate module interface used by both...
<qwr>
or actually, by all 3 (Player, ModeA, ModeB) using PlayerType
<thizanne>
confoo: a general advice would be that you need to decouple things, because obviously you have too many interdependencies
<thizanne>
do you really need to have `mode` as part of the player datatype? Do you really need to take a player in modeA and modeB?
<thizanne>
eg., if players have a mode inside them, then does it really make sense for modeA and modeB functions that manipulate players to have that mode information?
<confoo>
the reason i wanted to do that is because i have a function CollectReward which iterates through all the players, and gives a different reward based on the mode of the player
<confoo>
qwr what do you mean by module interface? apologies i have never heard of this, i am beginner
<qwr>
.mli - can have only types and optionally function signatures, needs corresponding .ml unless there are only types
<thizanne>
confoo: only give to functions the minimal amount of information that they need
<thizanne>
you could try removing the mode from the player type, and give a player and a mode to functions that need it
<thizanne>
that may or may not be the right solution, depending on a lot more things on your program
<qwr>
confoo: do other player functions use this CollectReward?
<confoo>
yeah, they do
mxns has joined #ocaml
<qwr>
the general answer is that if you _actually_ need recursive call graph between different module _files_, then a function value has to be passed as argument, but it might be better to try organize the code in a way to avoid such coupling
<qwr>
i think the passing could be also done using module functors, in which case it happens compile time
<qwr>
though using functors might be overengineering for your case
<confoo>
:o
<confoo>
can you please elaborate on the purpose of mli files? up until now in our class we haven't needed to use them
<confoo>
is it kind of like .h file in C programming?
<qwr>
kind of, but they represent module signature, which can be represented also inside another module and can also be inferred from module definition (which is why you don't need to write .mli for each .ml)
<qwr>
and also modules can be nested, files obviously not
<qwr>
if you could imagine language where each source code file is implicitly a function it might help to understand ocaml modules in the sense, that they are separate concept from source files, but each source file is always implicitly module or module signature
dborisog has quit [Ping timeout: 272 seconds]
<confoo>
i see, that makes sense
sm2n has joined #ocaml
tane has joined #ocaml
<confoo>
so is there no way to only import like a record type declaration from one class and not form a circular dependency problem?
<confoo>
one file, sorry
<confoo>
since the only thing i really need is the "type player"
sm2n_ has quit [Ping timeout: 256 seconds]
<qwr>
then put type player into separate playerType.mli and use it from each of the other modules
<confoo>
oh, didn't know you could do this
<confoo>
and how is the linking done?
<confoo>
playerType.player?
<confoo>
or do i need to "open playerType"?
<qwr>
open PlayerType is simpler, though PlayerType.player works equally well
<qwr>
open just imports the module namespace
<confoo>
do I need a playerType.ml then?
<qwr>
no, the .ml isn't required in this case, you don't have functions to implement
<confoo>
weird, i am getting some compilation error
<qwr>
what error?
mxns has joined #ocaml
<companion_cube>
qwr: mli only modules are not worth it
<qwr>
companion_cube: the type in his case could be put in .ml also, but there is no difference imho
foohalah has quit [Remote host closed the connection]
<d_bot>
<ulrikstrid> Where can I read the docs for the .ocamlformat file?
<companion_cube>
qwr: the difference is that a .ml file will build without question