adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.06.0 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.06/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
haesbaert has joined #ocaml
barcabuona has quit [Ping timeout: 252 seconds]
atchoum has quit [Ping timeout: 248 seconds]
Haudegen has quit [Remote host closed the connection]
nullifidian has quit [Read error: Connection reset by peer]
nullifidian has joined #ocaml
shinnya has quit [Ping timeout: 256 seconds]
cbot has joined #ocaml
infinity0_ has joined #ocaml
infinity0_ has quit [Changing host]
infinity0 is now known as Guest86134
infinity0 has joined #ocaml
Guest86134 has quit [Killed (hobana.freenode.net (Nickname regained by services))]
FreeBirdLjj has joined #ocaml
spew has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 260 seconds]
<rntz> hi, I'm having trouble using ocamlbuild to generate toplevels from .mltop files
<rntz> in "a.ml" I have "let id x = x"; in "foo.mltop" I have the single line "A". if I run "ocamlbuild foo.top", it happily builds an executable "foo.top", but when I run it and try to do "A.id;;", it complains "Error: Unbound module A"
<rntz> I do not have this problem if I run ocamlc and ocamlmktop myself by hand
govg has quit [Ping timeout: 260 seconds]
<companion_cube> tbh I don't know who makes custom toplevels
<companion_cube> it's simpler to write a library and load it
<rntz> oh, weird! if I run foo.top from the _build directory it works
<rntz> but if I run it from elsewhere it doesn't
<rntz> what the hell?
<rntz> companion_cube: how do I make a library and load it?
<rntz> (and any idea why this toplevel stuff might depend on what directory I run the toplevel file from?)
<companion_cube> write a .mllib, install it (with opam, typically) and load it using #require
<companion_cube> I mean with the mllib you can ask ocamlbuild to make a library
<rntz> having to go through opam does not seem easier for my purposes.
spew has quit [Ping timeout: 248 seconds]
<companion_cube> well yeah, but custom toplevels seem painful
<rntz> what I'm really looking for is the equivalent of what in most other languages is just "load this file" (eg. "ghci MyFile.hs", or running C-c C-l in Emacs while visiting a .hs file; similarly for Python or Racket) - but in ocaml, files just silently have dependencies on other files, so everything involves a build system to figure out the dependencies... making a toplevel seemed the easiest way to make
<rntz> something that lets me open up a repl that has my files loaded.
<companion_cube> jbuilder utop src/foo/, but well, if you use ocamlbuild…
<rntz> ah, I should look into jbuilder
<companion_cube> (honestly, sorry I can't help, I just always stayed away from anything that would complicate build)
<rntz> no problem!
<rntz> oh, huh. "ocaml foo.cma" has exactly the same behavior as running "foo.top"
<rntz> namely, it works if I do it in the _build directory and otherwise not
<rntz> and it really is being in *that* directory that seems to matter, not just being in the same directory as the .cma file
ygrek has quit [Remote host closed the connection]
ygrek has joined #ocaml
<companion_cube> ah, you need the .cmi files
<companion_cube> either with `#directory "_build/";;`
<companion_cube> or with -I <dir>
<companion_cube> or by being in the directory
<companion_cube> (that's also why ocamlfind makes it easier: #require adds the directory to your path so that the .cmi files are loaded automatically)
ygrek has quit [Remote host closed the connection]
spew has joined #ocaml
objmagic_ has quit [Ping timeout: 264 seconds]
ygrek has joined #ocaml
spew has quit [Ping timeout: 256 seconds]
<rntz> ah, I see
zolk3ri has quit [Ping timeout: 256 seconds]
zolk3ri has joined #ocaml
zolk3ri has quit [Client Quit]
pierpa has quit [Quit: Page closed]
mfp has quit [Ping timeout: 255 seconds]
letoh has joined #ocaml
objmagic has joined #ocaml
jao has quit [Ping timeout: 256 seconds]
incdz has quit [Remote host closed the connection]
orbifx has quit [Ping timeout: 276 seconds]
nomicflux has joined #ocaml
nomicflux has quit [Quit: nomicflux]
cobreadmonster has joined #ocaml
nomicflux has joined #ocaml
spip has quit [Quit: Konversation terminated!]
spew has joined #ocaml
nomicflux has quit [Quit: nomicflux]
nomicflux has joined #ocaml
zeratul_ has joined #ocaml
zeratul_ has left #ocaml [#ocaml]
ygrek has quit [Ping timeout: 248 seconds]
govg has joined #ocaml
nomicflux has quit [Quit: nomicflux]
jmagnusj has joined #ocaml
Algebr has joined #ocaml
dtornabene has quit [Ping timeout: 268 seconds]
jack5638 has joined #ocaml
mbuf has joined #ocaml
BitPuffin has joined #ocaml
cheater has quit [Ping timeout: 248 seconds]
Algebr has quit [Remote host closed the connection]
TC01 has quit [Ping timeout: 264 seconds]
TC01 has joined #ocaml
spew has quit [Read error: Connection reset by peer]
rwmjones has quit [Ping timeout: 240 seconds]
rwmjones has joined #ocaml
gentauro has quit [Ping timeout: 248 seconds]
gentauro has joined #ocaml
MercurialAlchemi has joined #ocaml
cobreadmonster has quit [Quit: Connection closed for inactivity]
cbot has quit [Quit: Leaving]
bartholin has joined #ocaml
argent_smith has joined #ocaml
flodin has quit [Read error: Connection reset by peer]
flodin has joined #ocaml
orbifx has joined #ocaml
TarVanimelde has joined #ocaml
objmagic has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AltGr has joined #ocaml
atchoum has joined #ocaml
orbifx has quit [Ping timeout: 248 seconds]
zpe has joined #ocaml
maufred has quit [Ping timeout: 252 seconds]
atchoum has quit [Ping timeout: 260 seconds]
jimmyrcom has quit [Ping timeout: 252 seconds]
cuicui has joined #ocaml
<dinosaure> orbifx[m]: the e-mail parsing is out: https://github.com/dinosaure/emile.git
<orbifx[m]> dinosaure: thanks
TarVanimelde has quit [Quit: TarVanimelde]
<orbifx[m]> Will take a look soon :)
TarVanimelde has joined #ocaml
jimmyrcom has joined #ocaml
TarVanimelde has quit [Quit: TarVanimelde]
bartholin has quit [Quit: Leaving]
cuicui has quit [Quit: leaving]
cuicui has joined #ocaml
nullifidian_ has joined #ocaml
cuicui has quit [Client Quit]
cuicui has joined #ocaml
nullifidian has quit [Ping timeout: 240 seconds]
<reynir> With tyxml 4.2.0 I get »ocamlfind: Package `wikidoc' not found«
<reynir> Ok, installing without --build-doc fixed it
freyr has joined #ocaml
<Drup> reynir: even then, this message shouldn't cause a failure
<reynir> OK yes, I can see it also says »Error: Unbound module Ast_convenience« on stdout https://github.com/ocsigen/tyxml/issues/195
<reynir> saw your comment :)
zolk3ri has joined #ocaml
mfp has joined #ocaml
jimmyrcom has quit [Ping timeout: 260 seconds]
barcabuona has joined #ocaml
Haudegen has joined #ocaml
sapristi has joined #ocaml
dhil has joined #ocaml
mk9 has joined #ocaml
maufred has joined #ocaml
<ousado> anyone here using verdi?
mk9_ has joined #ocaml
mk9 has quit [Ping timeout: 256 seconds]
mk9_ is now known as mk9
maufred has quit [Ping timeout: 260 seconds]
maufred has joined #ocaml
<ousado> mfp: I was looking at your raft implementation - is that in active use somewhere?
mk9 has quit [Quit: mk9]
mk9 has joined #ocaml
govg has quit [Ping timeout: 256 seconds]
mk9_ has joined #ocaml
govg has joined #ocaml
mk9 has quit [Ping timeout: 252 seconds]
mk9_ is now known as mk9
_andre has joined #ocaml
kakadu has joined #ocaml
mk9 has quit [Quit: mk9]
mk9 has joined #ocaml
mk9 has quit [Ping timeout: 240 seconds]
<sapristi> hello
<sapristi> I have a problem with cyclic type dependancy
<sapristi> I need to have a type t0 = | T1 of t1 | T2 of t2
<sapristi> where t1 and t2 are records with a reference to elements of type t0
<sapristi> does anyone know how I could handle this ?
<Drup> type t0 = ... and t1 = ... and t2 = ...
<sapristi> hmm yes thanks Drup !
jao has joined #ocaml
mk9 has joined #ocaml
<sapristi> what about mixing it with a module then ?
<sapristi> that is, t1 and t2 contains a BatSet of elements t1 ?
<sapristi> I guess I can use polymorphic set
<Drup> then it's more complicated
<sapristi> well I'll do with polymorphic sets for now
mk9 has quit [Quit: mk9]
gentauro has quit [Ping timeout: 240 seconds]
jimmyrcom has joined #ocaml
gentauro has joined #ocaml
ziyourenxiang has joined #ocaml
lopex has quit []
lopex has joined #ocaml
JSharp has quit []
JSharp has joined #ocaml
ec is now known as purr
grandy_____ has quit []
grandy_____ has joined #ocaml
purr is now known as ec
barcabuona has quit [Ping timeout: 248 seconds]
mk9 has joined #ocaml
stephe has quit []
stephe has joined #ocaml
mk9 has quit [Quit: mk9]
mk9 has joined #ocaml
mk9 has quit [Client Quit]
silver has joined #ocaml
barcabuona has joined #ocaml
mk9 has joined #ocaml
Denommus has joined #ocaml
mk9 has quit [Remote host closed the connection]
webshinra has quit [Ping timeout: 256 seconds]
mk9 has joined #ocaml
mk9 has quit [Remote host closed the connection]
mk9 has joined #ocaml
mk9 has quit [Remote host closed the connection]
mk9 has joined #ocaml
webshinra has joined #ocaml
zolk3ri has quit [Ping timeout: 248 seconds]
liu has quit [Ping timeout: 260 seconds]
spew has joined #ocaml
zolk3ri has joined #ocaml
Haudegen has quit [Ping timeout: 240 seconds]
nomicflux has joined #ocaml
mbuf has quit [Quit: Leaving]
shinnya has joined #ocaml
dhil has quit [Ping timeout: 240 seconds]
jimmyrcom has quit [Ping timeout: 256 seconds]
dedgrant has quit [Ping timeout: 256 seconds]
govg has quit [Ping timeout: 268 seconds]
govg has joined #ocaml
govg is now known as Guest74213
dynrzk has joined #ocaml
Guest74213 has quit [Ping timeout: 240 seconds]
jao has quit [Ping timeout: 248 seconds]
FreeBirdLjj has joined #ocaml
nomicflux has quit [Quit: nomicflux]
dhil has joined #ocaml
shinnya has quit [Ping timeout: 252 seconds]
dynrzk has quit [Ping timeout: 260 seconds]
<theblatte> is there some idea of when opam2 will enter the freeze period?
<Drup> I don't think opam intends to respect any sort of freezing schedule
<Drup> why ?
<theblatte> to know when I need to panic and test whether infer works well with it ^^
<Drup> (I mean, in a way, it's already freezing: most of the new stuff in the last ~6 month has been polishing)
<theblatte> I'm putting this down as "soon"
<Drup> theblatte: are you doing weird opam stuff ?
<theblatte> we use opam-lock for releases, and there's some mini-opam-repo checked in for our CI
<theblatte> nothing too weird
<Drup> yeah, you probably won't have much to do.
<jpdeplaix> theblatte: if it's just bug fixes it should be straightforward anyway
<theblatte> coolcoolcool
<Drup> theblatte: opam-lock just hardcode all the exact versions of the dependencies in the opam file, right ?
<theblatte> yes
<theblatte> which sadly is not enough as opam packages are mutable
<theblatte> so our releases keep breaking
<Drup> yeah, so everything should be the same for opam 2
<companion_cube> do people often mutate packages?
<Drup> companion_cube: if only to add constraints, yes
<companion_cube> ok, that sounds reasonable though
<theblatte> yes usually they change their opam files
<theblatte> well, you might want to argue that this should be a "packaging version" bump
<theblatte> at the least
<companion_cube> well no, because it's a correction of a previously broken package
<companion_cube> whose constraints were not tight enough
<theblatte> still a change
<Drup> theblatte: you could add your infer releases to opam. CI can check reverse deps now. It would warn if things break at the sovler level quite quickly
jmiven_ is now known as jmiven
<theblatte> Drup: yes that's definitely something we should do
<companion_cube> theblatte: I'd say adding constraints is usually not a visible change, because the constraints only forbid states that would be broken anyway'
<jpdeplaix> theblatte: that would be ok if opam removed the broken package
<Drup> I'm personally very suspicious of the whole "lock files" idea, and think it just comes for a lack of appropriate tooling, so I can't really comment further
<theblatte> shipping via opam instead of tarballs on github would make it easier to fix these breakages, as often it's just a matter of fixing the opam file
<theblatte> but I do wonder if a more offline solution exists
<theblatte> there's always packaging a mini-opam-repo, complete with sources of dependencies, together with your project
<Drup> theblatte: the thing is, if someone ends up adding a constraint that make your lock invalid, then it means that something was broken, one way or the other
<Drup> so, your lack file was already invalid, you just didn't realized it by lack of testing all the various combinations
<Drup> lock*
<theblatte> well, local switches are a thing now, and even on opam1 you can create a new switch to build your project inside
<theblatte> I'm not saying lock files are perfect, but they are one of the only tools available to solve the issue of distributing OCaml code outside of opam
<Drup> that's independent, local switches still use the repository
<theblatte> that's not independent because presumably your local switch only has the packages used to build the project, so it removes the "lock file was already broken" phenomenon
<theblatte> but I welcome better tooling/ideas
<Drup> right, but if you assume close-wordness, wouldn't you be better off vendoring ?
<theblatte> what's vendoring?
<companion_cube> vendoring is super inconvenient
<companion_cube> why would you do that if you have proper lock files?
sapristi has quit [Quit: Leaving]
<Drup> companion_cube: because of the issues above ? :p
<theblatte> for lack of proper lock files :p
<theblatte> vendoring = packaging all the deps inside the tarball?
<companion_cube> Drup: that's a problem of lock files not correctly implemented, right?
<Drup> theblatte: yes
<Drup> companion_cube: my opinion is precisely there there is no right implementation :D
<Drup> the concept is flawed
<theblatte> you could record the github hash of opam-repository
<companion_cube> still don't see why
<theblatte> I don't see why the concept is flawed either
<companion_cube> you specify everything for a (theoretically) reproducible build
<companion_cube> across machines and between developers
<Drup> it assumes closed-wordlness to work
<companion_cube> what world closedness?
<companion_cube> it assumes packages don't mutate, but otherwise…
<theblatte> well, it assumes it's possible to reproduce some state of the world
<theblatte> barring tarballs being pulled off the net it's not unreasonable
<companion_cube> ^
letoh has quit [Ping timeout: 248 seconds]
<Drup> Well, apparently, it is ^^
letoh has joined #ocaml
<companion_cube> yeah, taht sucks
<theblatte> it doesn't look fundamental, though
sapristi has joined #ocaml
Denommus has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
govg has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 256 seconds]
freyr has quit [Quit: Lost terminal]
caw___ has quit []
caw___ has joined #ocaml
mengu has joined #ocaml
nullifidian_ has quit [Read error: Connection reset by peer]
nullifidian__ has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
sh0t has joined #ocaml
<andreas_> I think lock-files work really well in other ecosystems, and I'm not really sure what makes OCaml different..
rjungemann has quit []
rjungemann has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Ping timeout: 264 seconds]
pmetzger has joined #ocaml
pmetzger has quit []
nahra has joined #ocaml
dhil has quit [Read error: Connection timed out]
Algebr has joined #ocaml
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 248 seconds]
ziyourenxiang has quit [Ping timeout: 260 seconds]
nullifidian__ has quit [Remote host closed the connection]
cuicui has quit [Quit: leaving]
nullifidian has joined #ocaml
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 240 seconds]
<AltGr> In theory, it's possible for opam 2 to handle lock files with pinnings to specific git-hashes
<AltGr> you'd just need some more tooling to generate them.
AltGr has left #ocaml [#ocaml]
mk9 has quit [Ping timeout: 268 seconds]
objmagic has joined #ocaml
chaosite has joined #ocaml
objmagic has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
objmagic has joined #ocaml
objmagic has quit [Client Quit]
objmagic has joined #ocaml
Algebr has quit [Remote host closed the connection]
dedgrant has joined #ocaml
pmetzger has joined #ocaml
kakadu has quit [Quit: Konversation terminated!]
Haudegen has joined #ocaml
cbot has joined #ocaml
mengu has quit [Remote host closed the connection]
mengu has joined #ocaml
mk9 has joined #ocaml
mk9 has quit [Client Quit]
mk9 has joined #ocaml
jnavila has joined #ocaml
baboum has joined #ocaml
gentauro has quit [Ping timeout: 256 seconds]
gentauro has joined #ocaml
mk9 has quit [Read error: Connection reset by peer]
mk9 has joined #ocaml
afloat has joined #ocaml
objmagic has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jack5638 has quit [Ping timeout: 256 seconds]
objmagic has joined #ocaml
k1000 has quit [Quit: .]
bartholin has joined #ocaml
jimmyrcom has joined #ocaml
jack5638 has joined #ocaml
jnavila has quit [Ping timeout: 276 seconds]
mengu has quit [Quit: Leaving...]
demonimin has quit [Ping timeout: 240 seconds]
demonimin has joined #ocaml
kakadu has joined #ocaml
BitPuffin has quit [Remote host closed the connection]
jao has joined #ocaml
jack5638 has quit [Ping timeout: 256 seconds]
jack5638 has joined #ocaml
jnavila has joined #ocaml
orbifx has joined #ocaml
nore has quit [Ping timeout: 248 seconds]
atchoum has joined #ocaml
argent_smith has quit [Quit: Leaving.]
sapristi has quit [Remote host closed the connection]
sapristi has joined #ocaml
j0sh has joined #ocaml
argent_smith has joined #ocaml
Haudegen has quit [Ping timeout: 265 seconds]
kolko has joined #ocaml
jnavila has quit [Ping timeout: 240 seconds]
mk9 has quit [Ping timeout: 256 seconds]
Soni has quit [Ping timeout: 240 seconds]
tsani has quit [Quit: ZNC 1.6.5 - http://znc.in]
tsani has joined #ocaml
Soni has joined #ocaml
jnavila has joined #ocaml
objmagic has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
objmagic has joined #ocaml
baboum has quit [Ping timeout: 260 seconds]
afloat has quit [Quit: Connection closed for inactivity]
cbot has quit [Ping timeout: 248 seconds]
orbifx has left #ocaml [#ocaml]
pmetzger has quit []
argent_smith has quit [Quit: Leaving.]
<atchoum> I don't understand the trick with ;
<atchoum> I don't get the meaning of the operator actually. It makes me think of the return () That you find in Haskell's monad but I am not sure if this is really related. Scoping rules are still escaping me somehow.
<atchoum> Is there any analog to the :type command to know about the type of an operator in OCaml ?
<Fardale> trick ? in what ?
<Fardale> I don't think that ; is an operator
Haudegen has joined #ocaml
<octachron> atchoum, "x; y" means eval "x" then return "y"
<octachron> if it were an operator, its type would be " 'discarded -> 'type_of_y -> 'type_of_y "
<octachron> its Haskell's closest relative might be `seq`
<atchoum> ho yeah.
<atchoum> ok
<atchoum> what could it be used for ?
<Drup> Like haskell's seq: sequence side effects
<atchoum> they said it is used to enforce strictness on argument evaluation.
<Drup> yeah, well, Ocaml is strict anyway
<atchoum> so lets say you write a module. How do you structure your code ?
<atchoum> because I read that using ;; is not encouraged.
<octachron> and ";" has nothing to do with structuring code
<atchoum> but ocaml is not whitespace sensitive I believe.
<atchoum> octachron: yes, I understand but you know I have cognitive bias because I come from language such as C.
<atchoum> or Java
<atchoum> you know the drill.
<octachron> toplevel definitions are introduced by let: struct let x = 1 let y = 2 end
<atchoum> :)
<atchoum> first thing to notice, the ',' (comma) is only a a constructor for tuples, isn't it ?
<atchoum> It has no other purpose in ocaml's grammar ?
<atchoum> I didn't know that you could chain let like that
<atchoum> so usually in a module you separate let with end of lines I believe.ç
<atchoum> and you can chain let using parenthis to construct big expressions...
<Drup> atchoum: are you following a tutorial or anything ?
<atchoum> lesson 5 step 4
<atchoum> I am stuck.
<Drup> ah, that's not really intended to be self contained
tokomak has joined #ocaml
<atchoum> you mean the tutorial ?
<atchoum> Not really yeah.
<Drup> you can try https://realworldocaml.org/ or one of the other book recomended in https://ocaml.org/learn/
nahra has quit [Remote host closed the connection]
jnavila has quit [Remote host closed the connection]
<atchoum> allright
sapristi has quit [Quit: Leaving]
<atchoum> () is unit exactly like in Haskell.
webshinra has quit [Ping timeout: 256 seconds]
<kakadu> /me is reading a weird article where folks have indexed datatypes and a constructor doesn't have normal arguments and `take in formally an argument of type unit (denoted by 1)`
<kakadu> so () can be both unit and 1
tokomak has quit [Quit: No Ping reply in 180 seconds.]
al-damiri has joined #ocaml
<atchoum> it seems a lot of people into academics are using ocaml as a research language, but Haskell seems to be really top notch to this regard.
<atchoum> Anyway, if `;` is `seq` then let a=2;a;;
<atchoum> should be 2?
<atchoum> But I got unbound value.
tokomak has joined #ocaml
<kakadu> yes, if it compiles it will be 2
<kakadu> (joke)
<atchoum> ok
<atchoum> let a=2;let b=2;;
<atchoum> well it seems to me that ; is ok for having side-effect but you can't really do something useful with it ?
<kakadu> if you are beginner OCamler I can recommend you to try not to use ; at all
<companion_cube> meh
<atchoum> ok
<atchoum> I'll do that.
<kakadu> because `foo;...` cant be rewritten as `let () = foo in ...`
<atchoum> then I can use (;;) instead ?
<kakadu> only in the end of pharases in the toplevel.
<kakadu> If you will do `normal` programming via compilation of files you can forget about ;;
<atchoum> ok
<atchoum> but then -- let me ask it again. Ocaml is a functional language, so you never chain statement in an imperative style (that would require the use of some separators between instructions) but there is no such thing in Ocaml If I follow you. Just top level names and definitions ?
<atchoum> i'll stick with your advice anyway.
webshinra has joined #ocaml
<kakadu> well, there is a syntax and there is semantics that interpret that syntax
<octachron> atchoum, you should really an introduction to OCaml (or functional programming); otherwise you will spend a lot of time tripping over your imperative programming conditioning
spew has quit [Read error: Connection reset by peer]
<atchoum> nono I know kind of a little bit of functional programming from Haskell... But Ocaml is a different cat it seems...
<atchoum> I am trying to adapt to the language quickly so that I can read and write programs in it.
<dmbaturin> Note that 90's OCaml code is often disgustingly imperative for a modern reader. :)
<atchoum> by the way, when you do let a=2 and b=3, this is basically syntaxic sugar for let a=2 let b=3 ?
<octachron> no
<atchoum> octachron: ah yeah I suppose because of the scope
<dmbaturin> atchoum: let ... and allows mutually recursive bindings, while the normal let doesn't.
<kakadu> last question is definitely indicated a need of some book reading
<dmbaturin> As in (useless example) let a x = b x and b x = a x
<octachron> atchoum, you should read a proper introduction rather than try to guess a language semantic from the little bit you know of another language from the same paradigm
mk9 has joined #ocaml
<dmbaturin> ...there's no _syntax_ for chaining expressions in Haskell either (other than the do notation for monadic bind), the usual composition operators are all normal functions.
<lyxia> let rec ... and ... is mutually recursive
<kakadu> atchoum: understanding new language by writing something interesting is always a good way to understand that detail. .... I want World of Warcraft in OCaml for a long time, btw :)
<lyxia> without a rec the identifiers are not in scope in each other's definitions
<dmbaturin> atchoum: If you want composition, the OCaml functions you may be looking for are @@ : ('a -> 'b) -> 'a -> 'b and |> : 'a -> ('a -> 'b) -> 'b Monadic bind is provided by libraries that are monads.
webshinra has quit [Quit: Leaving]
mk9 has quit [Quit: mk9]
<atchoum> type 'a btree = Empty | Node of 'a * 'a btree * 'a btree;; <when I do that, I have a problem with Unbound value btree.
<atchoum> They don't say how to construct a Tree from this example.
<companion_cube> Node (1, Empty, Empty);;
<atchoum> ha ok.
<atchoum> 1 * 1 * 1;;
<atchoum> this is kind of a product set the '*';
<companion_cube> it's a cartesian product, yeah :)
webshinra has joined #ocaml
Algebr has joined #ocaml
<dmbaturin> I wonder if trying to make bindings for another language for an ocaml library is feasible or more trouble than it's worth.
<dmbaturin> Anyone knows if it has been done in practice so far, or it's really easier to get people to use ocaml? ;)
<Armael> you could write reverse bindings to expose a C api on top of ocaml code, but I'm not sure it's going to be very enjoyable
<companion_cube> or go full yolo on malfunction
<Drup> Armael: with ctypes, it's quite easy
<Armael> Drup: maybe, but you're still exposing a C-like api
<dmbaturin> Drup: ctypes can work in the other direction?
<Armael> yes
<dmbaturin> I've only used it for importing C functions into ocaml so far.
<companion_cube> you're going to have so much fun with the GC :]
<Drup> companion_cube: ctypes does quite a good amount of things for you, on that
<companion_cube> ah, cool
<companion_cube> does it do custom blocks and all?
<Armael> generally speaking, are there ways of interoperating between two "high-level" languages without going through C as a common denominator?
<Armael> (just curious)
<Drup> Armael: rarely
tokomak has quit [Quit: No Ping reply in 180 seconds.]
<companion_cube> json + rest API
<companion_cube> you're welcome
<Drup> Even between similar languages, the impedance mismatch between type systems and execution style is usually just too big.
<Drup> so, either you serialize, as companion_cube, or you drop to C, because that's pretty much portable assembly :p
<companion_cube> or just between runtime systems
<companion_cube> I was mostly joking, but serializing into msgpack/protobuf/… might be the easiest way, yeah
tokomak has joined #ocaml
<dmbaturin> Drup: Is there any example of how to make functions callable from C with ctypes?
<dmbaturin> I see an example of passing ocaml functions to C functions wrapped with ctypes, but it's not quite what is needed to make a binding, unless I'm missing something.
leah2 has quit [Ping timeout: 256 seconds]
<Armael> engil1 has some experience writing reverse bindings with ctypes
<dmbaturin> Drup: Thanks, let me see.
dangeranger has joined #ocaml
tokomak_ has joined #ocaml
tokomak has quit [Ping timeout: 240 seconds]
moei has quit [Quit: Leaving...]
cbot has joined #ocaml
ia0 has quit [Quit: leaving]
ia0 has joined #ocaml
tokomak_ has quit [Remote host closed the connection]
kakadu has quit [Remote host closed the connection]
ia0 has quit [Client Quit]
ia0 has joined #ocaml
leah2 has joined #ocaml
ia0 has quit [Client Quit]
ia0 has joined #ocaml
jimmyrcom has quit [Ping timeout: 276 seconds]
<dmbaturin> atchoum: By the way, I have a FAQ of sorts that you may find helpful: http://baturin.org/docs/ocaml-faq/
pknight has joined #ocaml