adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | Current MOOC: https://huit.re/ocamlmooc | OCaml 4.04.0 release notes: http://ocaml.org/releases/4.04.html | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
sh0t has quit [Remote host closed the connection]
psnively has joined #ocaml
smondet` has quit [Ping timeout: 256 seconds]
moei has quit [Quit: Leaving...]
psnively has quit [Client Quit]
Simn has quit [Quit: Leaving]
psnively has joined #ocaml
shinnya has joined #ocaml
jbrown has quit [Ping timeout: 255 seconds]
jbrown has joined #ocaml
nomicflux has joined #ocaml
nomicflux has quit [Quit: nomicflux]
moei has joined #ocaml
silver has quit [Read error: Connection reset by peer]
infinity0 is now known as Guest88032
infinity0 has joined #ocaml
infinity0 has joined #ocaml
Guest88032 has quit [Ping timeout: 240 seconds]
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
lopex has quit [Quit: Connection closed for inactivity]
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
psnively has quit [Quit: Textual IRC Client: www.textualapp.com]
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
morfeen has quit [Remote host closed the connection]
mengu has quit [Remote host closed the connection]
mengu has joined #ocaml
mengu has quit [Ping timeout: 240 seconds]
jbrown has quit [Ping timeout: 255 seconds]
FreeBirdLjj has joined #ocaml
mfp has quit [Ping timeout: 260 seconds]
noddy has joined #ocaml
jbrown has joined #ocaml
shinnya has quit [Ping timeout: 240 seconds]
pigeonv has quit [Ping timeout: 258 seconds]
mengu has joined #ocaml
mengu has quit [Ping timeout: 240 seconds]
mfp has joined #ocaml
ryanartecona has joined #ocaml
mfp has quit [Ping timeout: 255 seconds]
ygrek has quit [Ping timeout: 255 seconds]
govg has quit [Ping timeout: 245 seconds]
rgrinberg has joined #ocaml
tmtwd has joined #ocaml
jao has quit [Ping timeout: 264 seconds]
nomicflux has joined #ocaml
tmtwd has quit [Ping timeout: 260 seconds]
nomicflux has quit [Quit: nomicflux]
jbrown has quit [Ping timeout: 255 seconds]
tmtwd has joined #ocaml
jbrown has joined #ocaml
tmtwd has quit [Ping timeout: 276 seconds]
oschwald has quit [Quit: Leaving.]
FreeBirdLjj has quit [Remote host closed the connection]
govg has joined #ocaml
nomicflux has joined #ocaml
nomicflux has quit [Client Quit]
ryanartecona has quit [Quit: ryanartecona]
ryanartecona has joined #ocaml
gjaldon has joined #ocaml
FreeBirdLjj has joined #ocaml
MercurialAlchemi has joined #ocaml
<gjaldon> Why is building an OCaml package so manual/complicated? In Elixir/Clojure, there are only a few CLI commands I need to be aware of and configuration is much simpler. In Haskell, it seems simpler too(very little exposure) with stack
<gjaldon> comparing Elixir/Clojure which compile bytecode for their respective VMs may be unfair though... not sure
FreeBirdLjj has quit [Remote host closed the connection]
gjaldon has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
jbrown has quit [Ping timeout: 255 seconds]
infinity0 has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 248 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
jbrown has joined #ocaml
rgrinberg has quit [Ping timeout: 240 seconds]
justicef_ has joined #ocaml
william-s has quit [Quit: WeeChat 1.7]
noddy has quit [Ping timeout: 264 seconds]
<flux> some points on the subject on top of my head: ocaml can compile both byte and native (and usually you want both), ocaml has separate source&result files for interfaes, ocaml follows the "one tool does one thing" approach.
noddy has joined #ocaml
<flux> and I too would appreciate if things were simpler :), even if not for myself then just for newcomers for whom it must be daunting.
copy` has quit [Quit: Connection closed for inactivity]
<flux> it's not nobody has tried to make it simpler and succeeded in it. for example, opam and findlib are two great and successful tools that greatly enhance the user experience.
<flux> ..and how could I not mention merli! but merlin and ocp-indent are a bit more difficult to set up.
Guest82 has joined #ocaml
gjaldon__ has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
gjaldon has joined #ocaml
ryanartecona has joined #ocaml
Guest82 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
gjaldon has quit [Ping timeout: 240 seconds]
MercurialAlchemi has joined #ocaml
octachron has joined #ocaml
morfeen has joined #ocaml
philtor has quit [Ping timeout: 256 seconds]
tmtwd has joined #ocaml
tmtwd has quit [Ping timeout: 240 seconds]
morfeen has quit [Ping timeout: 240 seconds]
ygrek has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
jbrown has quit [Ping timeout: 255 seconds]
mcspud is now known as mcspaca
jbrown has joined #ocaml
alfredo has joined #ocaml
gjaldon has joined #ocaml
zpe has joined #ocaml
gjaldon has quit [Ping timeout: 255 seconds]
Simn has joined #ocaml
jnavila has joined #ocaml
mengu has joined #ocaml
mengu has quit [Remote host closed the connection]
mengu has joined #ocaml
Asmadeus has quit [Remote host closed the connection]
kakadu has joined #ocaml
pippijn has quit [Ping timeout: 260 seconds]
Asmadeus has joined #ocaml
pippijn has joined #ocaml
mcspaca is now known as mcspud
<chindy> flux: i think Opam is just fucking great... its the best package-manager out there
FreeBirdLjj has quit [Remote host closed the connection]
AltGr has joined #ocaml
zpe has quit [Remote host closed the connection]
binobi has quit [Quit: Connection closed for inactivity]
<companion_cube> gjaldon__: also, OCaml has a long history, not like elixir
<freehck> chindy: best is too loud. There's a lack of search support. f.e. I can't search by module name, I must know what package contains the module I need specifically before I install it. Well if you remember APT, it has apt-file tool which provide us with a possibility to look for files through all the packages in repos.
<companion_cube> this must require a huge DB‽
<freehck> yep
<companion_cube> then, meh :p
<companion_cube> I agree it would be nice to have a tighter integration between opam packages and the module system though
<companion_cube> and namespaces
<companion_cube> and a pony :/
<freehck> pony? :)
<Armael> I also want a pony :(
FreeBirdLjj has joined #ocaml
alfredo has quit [Ping timeout: 245 seconds]
FreeBirdLjj has quit [Ping timeout: 240 seconds]
mfp has joined #ocaml
ygrek has quit [Ping timeout: 260 seconds]
morfeen has joined #ocaml
FreeBirdLjj has joined #ocaml
Sim_n has joined #ocaml
unbalanced has joined #ocaml
<gjaldon__> companion_cube: just saying that things could be a lot better. packaging in other languages is more straightforward and I want to work towards having the same experience for OCaml
ChristopheT has joined #ocaml
ansiwen_ has joined #ocaml
def`_ has joined #ocaml
vbmithr_ has joined #ocaml
eagleflo_ has joined #ocaml
haesbaer1 has joined #ocaml
jstolare1 has joined #ocaml
Cypi_ has joined #ocaml
noplamodo has joined #ocaml
henrytill_ has joined #ocaml
Simn has quit [*.net *.split]
noplamodo_ has quit [*.net *.split]
zozozo has quit [*.net *.split]
cdidd has quit [*.net *.split]
ansiwen has quit [*.net *.split]
Armael has quit [*.net *.split]
Cypi has quit [*.net *.split]
vbmithr has quit [*.net *.split]
haesbaert has quit [*.net *.split]
unbalancedparen has quit [*.net *.split]
lyxia has quit [*.net *.split]
henrytill has quit [*.net *.split]
eagleflo has quit [*.net *.split]
def` has quit [*.net *.split]
jstolarek has quit [*.net *.split]
jbrown has quit [Ping timeout: 255 seconds]
<reynir> I think opam packages can make random modules at install time - so searching by module names would require heuristics, right?
<reynir> (not that I think it's ever useful to generate random modules)
frefity has quit [Ping timeout: 240 seconds]
Armael has joined #ocaml
lyxia has joined #ocaml
cdidd has joined #ocaml
zozozo has joined #ocaml
frefity has joined #ocaml
<companion_cube> CI could generate an index, though
<companion_cube> gjaldon__: yeah, the biggest issues are social, not technical
<companion_cube> e.g. nothing prevents us from having one nice, unified stdlib… except politics
jbrown has joined #ocaml
<gjaldon__> companion_cube: I’m fairly new to ocaml so I don’t really know why it doesn’t have a bigger/better stdlib
<companion_cube> the stdlib ships with teh compiler, and maintainers don't want to maintain a large stdlib on which they will have to promise retrocompatibility forever
<companion_cube> so there are several alternative stdlibs
<companion_cube> and people (including me) tend to rewrite their own stuff
FreeBirdLjj has quit [Remote host closed the connection]
Sim_n has quit [Ping timeout: 256 seconds]
<octachron> companion_cube, even the compiler itself tends to write its own extended standard library
morfeen has quit [Remote host closed the connection]
morfeen has joined #ocaml
morfeen_ has joined #ocaml
<companion_cube> yeah
<companion_cube> I find this particular part quite infuriating, tbh
morfeen has quit [Read error: Connection reset by peer]
justicef_ has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
larhat has joined #ocaml
morfeen_ has quit [Read error: Connection reset by peer]
morfeen has joined #ocaml
FreeBirdLjj has joined #ocaml
Sim_n has joined #ocaml
silver has joined #ocaml
morfeen has quit [Remote host closed the connection]
morfeen has joined #ocaml
mengu has quit [Quit: Leaving...]
snowcrshd has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
sz0 has joined #ocaml
jbrown has quit [Ping timeout: 255 seconds]
<freehck> companion_cube: btw, it seems sane that some modules can exist or not exist depending on build options.
<freehck> When I install some packages, I need to recompile some other ones, and it could provide me with some additional modules.
<freehck> So it's not a easy task to make an index.
FreeBirdLjj has joined #ocaml
<freehck> Well of course we could generate the index as a list of 3 columns: package, option and module.
<freehck> each line says: module <module> is in package <package> when option <option> is set.
<freehck> But to generate this list it seems we must build any package with all possible options.
<freehck> with all *combinations* of all possible options
<freehck> the more options the harder this work is
<freehck> and there're packages such as ocamlnet which have really huge amount of them
jbrown has joined #ocaml
<octachron> freehck, I would think that having upper and lower bounds for the modules installed by a given opam package would be a quite good first step
<def`_> I think just a plain approximation, like assuming any ml file is a module, with manual filtering of a few false positives, is good enough
<freehck> octachron: true. so... let's build'em with all options enabled. It's enough if we want to search.
<freehck> def`_: Well some modules can be autogenerated. Like mlpacks.
<freehck> Hm... And what will we do with nested modules?
<octachron> freehck, under the hypothesis that enabling option never decrease the number of generated modules
<freehck> Well yes, plain approximation is the easiest way.
<freehck> octachron: I think it must be true in 95% cases.
<freehck> octachron: it's practical imperative, not mathematics.
wizeman has joined #ocaml
wizeman has left #ocaml [#ocaml]
<def`_> freehck: then directly use content of mllib & mlpack files to approximate universe
<def`_> (I am talking about hacking up a shell script that can provide a first approximation with less than an hour of work :))]
<gjaldon__> flux:
<gjaldon__> flux: btw I just updated my https://github.com/gjaldon/simple-diff package to use a functor so that it becomes more generalized
<gjaldon__> thanks for the suggestion!
<flux> gjaldon__, pretty nice!
<flux> hmm, doesn't the standard library come with any comparable-like signature?
<gjaldon__> flux: glad you like it :) was happy to get a chance to use a functor
<flux> I wonder if a factor for doing a functorized version was that you used Map.. :-) but I don't mind, or perhaps even prefer this.
<flux> there is the Map.OrderedType. but I guess it doesn't matter, it's structural anyway.
<flux> (though perhaps reusing the same name would be more uniform)
<gjaldon__> flux: I wasn’t really sure whether to rely on Map.OrderedType or to just create a new type
<flux> creating a new module type is fine. it might be weird to depend on Map here.
<gjaldon__> so rename Comparable to OrderedType instead so that it’s understood that they’re the same thing
<gjaldon__> ?
<flux> yes
<flux> I mean it's more established vocabulary I think
<flux> (though I think Core maybe comes with Comparable and friends?)
<gjaldon__> I got Comparable from Real-World OCaml which mostly uses Core
<flux> I cannot claim it would be a bad name :)
<gjaldon__> I think OrderedType makes more sense though
ChristopheT has quit [Ping timeout: 255 seconds]
<gjaldon__> just to be consistent with StdLib
frefity has quit [Quit: Ex-Chat]
frefity has joined #ocaml
frefity has quit [Quit: Ex-Chat]
frefity has joined #ocaml
eagleflo_ is now known as eagleflo
pigeonv has joined #ocaml
<freehck> btw, can opam repository have resolve circular dependencies? It seems to be possible: f.e. package A depends on B, and then B decides to use some functionality of A and has been packaged and pushed into the opam repositoty.
<freehck> *oh, crap, my poor english*: can opam resolve circular dependencies?
<flux> it doesn't need to, because ocaml doesn't support circular dependencies
<infinity0> i'd hope not, it's not good software engineering to do that in the vast majority of cases
<flux> well, I suppose they could depend in only small parts so that compiling would be possible, but..
<freehck> flux: ocaml doesn't support circular dependencies, but package B's code can be dependent on some part of package A's code that does not depend on B. Just some other part of A depends on B.
<freehck> I mean package dependencies and module dependencies can not correlate.
<flux> freehck, I'm just going to say it's going to be very difficult to arrange
<flux> freehck, how do you compile the packages?
<freechips> hey guys it's still me. im trying to write a function that is able to evaluate strings as my language. my idea is to split the string on parenthesis and then match the names (i don't think ocaml type system will save me from writing a parser this time..)
<freechips> but this split function is not working
<freechips> let split s = let i = String.index s '(' and len = String.length s in
<freechips> String.sub s 0 i ^ " - " ^ String.sub s (i+1) len;;
<freechips> yet ocaml recognizes it as valid code. i get an exception Exception: Not_found.
<freechips> when trying to do split "hello";;
<freehck> freechips: parenthesis? is your language sexp-like?
<flux> freehck, compile your code with -g and set environment variable OCAMLRUNPARAM=b to get a backtrace
<flux> freechips, even
<freehck> if it is, try Sexp module
<freechips> freehck: yes it looks like lisp because i need to use ocaml constructors for parsing
govg has quit [Ping timeout: 258 seconds]
<freechips> why should the sexp module help me? i need to write this code myself btw so its a no go
<freehck> flux: I have no example. It was a hypotetical question.
<freechips> the weird this is that ocamls type system accepts my function
<freechips> maybe ill try later again
<flux> freehck, well, I would say it's outside the scope of opam. no such package exists either :).
<freehck> flux: so the in case of opam we have just an oriented graph without circular dependencies.
<freehck> right?
<flux> freehck, correct
<freehck> nice
<flux> it's still not easy due to version constraints
<reynir> String.index "hello" '(';;
<reynir> freechips: ^ this throws Not_found because it could not find '(' in "hello"
<reynir> So, you need to handle non'(' containing strings or make sure they're not passed
<freehck> freechips: I just noticed that there're sexp parsers in ocaml which are already done.
<reynir> You can use pattern matching: match String.index "hello" '(' with idx -> ... | exception Not_found -> ...
<companion_cube> I strongly recommend at least using ocamllex for lexing
<companion_cube> a Sexp parser is quite easy to write by hand
<companion_cube> a lexer is no fun
<companion_cube> https://github.com/c-cube/ocaml-containers/blob/prepare-1.0/src/sexp/CCSexp_lex.mll sth like that is really simple (and half the remaining complexity is for unquoting strings
<companion_cube> )
<freehck> btw, there's a sexp parser which do understand the difference between atom types (strings, symbols and numbers, etc). Its name is OCS.
<freehck> Ocs is not in opam, but you can find it in felix-lang repository on github.
morfeen has quit [Remote host closed the connection]
morfeen has joined #ocaml
rwmjones has quit [Ping timeout: 260 seconds]
govg has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
Denommus has joined #ocaml
nomicflux has joined #ocaml
handlex has joined #ocaml
jbrown has quit [Ping timeout: 255 seconds]
handlex has quit [Client Quit]
rwmjones has joined #ocaml
richou has joined #ocaml
<freechips> thanks for all the parsers, but like i said i need to do this (build something like python's eval) myself
jbrown has joined #ocaml
handlex has joined #ocaml
handlex has quit [Read error: Connection reset by peer]
<freechips> http://ix.io/1SPl why isn't is working for strings with a ( ?
<freechips> freehck: thanks ill take a look at it
<octachron> freechips, the second int argument of String.sub should be the length of the extracted substring
<freechips> oh
<freechips> im stupid
<freechips> thanks
def`_ is now known as def`
nomicflux has quit [Quit: nomicflux]
frefity has quit [Ping timeout: 240 seconds]
Redlook has joined #ocaml
<Denommus> did any of you try angstrom out?
oschwald has joined #ocaml
rks-_ is now known as rks
rks is now known as rks`
frefity has joined #ocaml
freyr has joined #ocaml
agarwal1975 has joined #ocaml
sz0 has quit [Quit: Connection closed for inactivity]
<richou> where should I send this so it's visible to whom it may concern? http://stackoverflow.com/questions/42110714/cores-list-init-in-pervasives/
lopex has joined #ocaml
morfeen has quit [Remote host closed the connection]
<freehck> btw, is it possible to make sexp print a concrete atom specifically as string, not a symbol?
<companion_cube> it prints into strings exactly when escaping requires it, I think
<freehck> companion_cube: I know. But I want a conversion (a "b") -> Sexp.t -> (a "b")
<companion_cube> ah, well, good luck with that
<freehck> Okay. So I must use Ocs for back conversion. :)
micro__ has joined #ocaml
<octachron> richou, it depends a lot on what you mean by "whom it may concern"
<richou> Hmm, I don't know exactly, but I think it should be fixed. Should I fork Pervasives, write the function down myself and send a pull request?
<companion_cube> good luck… if you want there are implementations lying around
<companion_cube> (I have one myself)
<Drup> richou: honestly ? Just use one of the stdlib extension (such as containers :p) and move on
<Drup> start learning the language, you'll have time to get involved in politics later :D
<richou> Drup: I know, I'm using `Core` on a daily basis, but hey, why not contribute where I can?
sh0t has joined #ocaml
rwmjones has quit [Ping timeout: 240 seconds]
rwmjones has joined #ocaml
<companion_cube> contributing to the stdlib is a game of patience :/
<freehck> richou: you can try, but i doubt they accept it.
<freehck> richou: just extend this module. Create module Ext which extends List f.e. in this way: `module List = struct include List let init = <...> end
<freehck> and then open this Ext in any other module.
<richou> Yeah, I see
shinnya has joined #ocaml
snowcrshd has quit [Ping timeout: 240 seconds]
al-damiri has joined #ocaml
rwmjones has quit [Ping timeout: 245 seconds]
rwmjones has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 240 seconds]
jbrown has quit [Ping timeout: 255 seconds]
snowcrshd has joined #ocaml
frefity has quit [Ping timeout: 264 seconds]
jbrown has joined #ocaml
frefity has joined #ocaml
jao has joined #ocaml
kalle_ has joined #ocaml
MercurialAlchemi has joined #ocaml
<kakadu> Folks, can I add to .merlin file path to local ppx extension? Something like
<kakadu> PPX _build/src/asdf.native
Redlook has left #ocaml [#ocaml]
frefity has quit [Ping timeout: 252 seconds]
pigeonv has quit [Ping timeout: 255 seconds]
rwmjones has quit [Ping timeout: 245 seconds]
rwmjones has joined #ocaml
<kakadu> def`: ^^
<kakadu> Current workaround that should work is to install extensions as local ocamlfind package and add ocamlfind path in .merlin
shinnya has quit [Ping timeout: 255 seconds]
morfeen has joined #ocaml
noddy has quit [Ping timeout: 264 seconds]
frefity has joined #ocaml
ryanartecona has joined #ocaml
copy` has joined #ocaml
madman12 has joined #ocaml
jbrown has quit [Ping timeout: 255 seconds]
jbrown has joined #ocaml
freyr has quit [Remote host closed the connection]
jnavila has quit [Ping timeout: 240 seconds]
nilof_ has joined #ocaml
madman12 has quit [Quit: rirc v0.1]
<freechips> hey guys could you help me understand something?
<freechips> i have my interpreted sexpr like language that is parsed thanks to pattern matching on ocaml type constructors
<freechips> so i have type expr and type value and i just pattern match expr constructors down to value types
<freechips> and this is all well and good if i pass my language as ocaml code inside the ocaml interpreter
<freechips> but what if i wanted to pass my language inside a string? then i'd basically have to parse it
<freechips> and parsing manually is painful
<freechips> is there an easier way to do this, maybe exploiting the fact that my language is made of ocaml types, so basically ocaml, such that i can directly transform the string into nested types?
<freechips> maybe by using other ocaml type constructors i can parse the string?
ChristopheT has joined #ocaml
<flux> there is really no way to go from data to any ocaml concept
<flux> in ocaml data and programs are two completely separate things
<flux> exception: what toplevel does with toplevel library
<flux> and I suppose the Dynlink module
<freechips> flux: no way at all? can i have a type constructor of particular strings maybe?
<freechips> all im interested in is the nesting
<freechips> i don't want to have to write a parser that starts splitting commas and parentheses and then also i have to start nesting
<flux> let's say you have the string "float". there is no way to go to type float from tha tstring.
<freechips> i'd go crazy
<freechips> damn
<flux> usually these kinds of issues are combated with code generation
<flux> so, metaprogramming. the current way to generate ocaml code is PPX.
<cojy> freechips: can you give an example?
<cojy> i feel like there's a misunderstanding here
slash^ has joined #ocaml
<freechips> Plus(Int(4),Int(5))
<freechips> i can go ahead and interpret this as long as that's ocaml code and i pass it directly to my eval
<freechips> but if i have to pretend that's a string "Plus(Int(4),Int(5))" the best i can currently come up with is to tokanize and then nest (parse)
<flux> that's exactly what you will do :)
<freechips> so maybe type token = Stuff of string | Parens | Comma
<flux> tokenizing and parsing is pretty easy, OCaml is basically made for it.
<freechips> and then i convert the string to a list of tokens
<freechips> and then the hard part
<freechips> cuz i can't just say match Stuff(s) -> match s with "Plus" -> Plus ( ?,?)
<flux> I mean you could use the ocaml Dynlink + ocaml compiler to convert that string into a short program that produces the value
<freechips> i basically need to go looking for the opening commas, and then the matching closing comma. it's a matching switcharoo
<freechips> how is ocaml made for this? is there a simple example i can learn from?
<flux> but that's probably more difficult to do in a robust manne than, well, doing it properly. not to mention it needs the compiler.
<freechips> well if you say ocaml was made for parsing then i guess i could try and make my own parser. i don't want to cheat here
<flux> well, there are some different approaches, the traditional way is described here: https://caml.inria.fr/pub/docs/manual-ocaml/lexyacc.html
<flux> then there are library-based solutions
<cojy> well if you want to use sexps you can use https://github.com/janestreet/ppx_sexp_conv
<freechips> are ocamlyacc and stuff part of the language? im not sure im allowed to use an external parser
<flux> ocamlyacc comes with the ocaml compiler, yes
<flux> and the link I gave is the official ocaml documentation
<flux> which is a great piece of documentation to read, btw ;)
<freechips> cojy: i appreciate that, but what if i wanted to do all of this by hand? parse directly in ocaml code no modules involved
<cojy> doing it by hand is good too, there shouldn't be anything getting in your way of doing that
<flux> often it can be beneficial to do going from text to data types with separate lexer and parsing
<flux> even if you do it by hand, you can still have those two phases
<freechips> flux: im thinking of going to datatypes by making the string become a token list
<flux> or, if you just want to write one first, you can use a pre-existing solution for the other one (ocamllex, ocamlyacc)
<freechips> and then im thinking of nesting the token list down into the original expr type that is my language
<flux> so going from the token list to your data type is parsing, and going from the string to token list is lexing
<freechips> yes
<freechips> so i basically want to lex and then parse
<flux> correct
<freechips> by hand. how hard is this? are there any pointers?
<freechips> i honestly think my teacher didnt think through this assignment, ill probably be contacting him soon...
<flux> it's not hard. I think internet should be full of code on how to do it :)
<flux> if not written in ocaml..
<freechips> alright. at least now i know there is no other shortcut. i waas hoping my teacher had envisioned some smart way of directly parsing the string down into ocaml types, but i guess theres no way around it
AltGr has left #ocaml [#ocaml]
<flux> I was going to say this site is made for you: http://plzoo.andrej.com/ - but they all seem to use ocamllex & yacc ;)
<flux> here's a compiler written without using those tools: http://troydm.github.io/blog/2014/03/29/writing-micro-compiler-in-ocaml/
<flux> yours is not going to be that big :)
kakadu has quit [Quit: Konversation terminated!]
fraggle_ has joined #ocaml
<gjaldon__> for anyone who has done metaprogramming with ppx, what resource did you find most useful to learn it? how did you learn it?
kolko has quit [Ping timeout: 252 seconds]
richou has quit [Ping timeout: 255 seconds]
Xadnem has joined #ocaml
jnavila has joined #ocaml
<Xadnem> Hello friends, I'm using Eclipse ide for ocaml programing, I have installed the ocaml plugin, but the ocamlide dosen't detect the syntax errors.
<Xadnem> Do you know what is wrong ?
morfeen has quit [Remote host closed the connection]
<Xadnem> May be something at the eclipse config ?
jbrown has quit [Ping timeout: 255 seconds]
kolko has joined #ocaml
philtor has joined #ocaml
tane has joined #ocaml
jbrown has joined #ocaml
ygrek has joined #ocaml
adi_____ has quit [Remote host closed the connection]
ggherdov has quit [Remote host closed the connection]
menasw has quit [Remote host closed the connection]
mankyKitty has quit [Remote host closed the connection]
vinoski has quit [Remote host closed the connection]
copy` has quit [Remote host closed the connection]
strmpnk has quit [Remote host closed the connection]
l1x has quit [Remote host closed the connection]
banjiewen has quit [Remote host closed the connection]
dch has quit [Remote host closed the connection]
myst|fon has quit [Remote host closed the connection]
al-damiri has quit [Remote host closed the connection]
MorTal1ty has quit [Remote host closed the connection]
agarwal1975 has quit [Ping timeout: 276 seconds]
mbrock has quit [Remote host closed the connection]
yunxing has quit [Remote host closed the connection]
cojy has quit [Remote host closed the connection]
rfv has quit [Remote host closed the connection]
jkni has quit [Remote host closed the connection]
mrallen1 has quit [Remote host closed the connection]
twold has quit [Remote host closed the connection]
jmct has quit [Remote host closed the connection]
ryanartecona has quit [Quit: ryanartecona]
agarwal1975 has joined #ocaml
pigeonv has joined #ocaml
kakadu has joined #ocaml
ryanartecona has joined #ocaml
mengu has joined #ocaml
justicefries has joined #ocaml
justicefries has quit [Client Quit]
<freechips> flux: thanks for all those resources, implementing a parser in pure ocaml could be fun. im having lots of fun..
<freechips> even though i see some caveats of using it
morfeen has joined #ocaml
<freechips> like i know haskell has type classes, ocaml could benefit from those. also type constructors would be easier to use if i could pass tuples instead of hardcoding values
<flux> freechips, can you clarify "pass tples instead of hardcoding values"?
Algebr has joined #ocaml
morfeen has quit [Ping timeout: 240 seconds]
<Xadnem> Hello friends, my eclipse ocamlide dosen't detect the syntax errors. Do you know what could be missing please ?
cojy has joined #ocaml
<n4323> Xadnem: i used eclipse for ocaml a few years ago -- it worked kind of ok. right now i do not know how well-maintained that is.
dch has joined #ocaml
<n4323> i would suggest to switch to something that supports merlin.
vinoski has joined #ocaml
l1x has joined #ocaml
<n4323> so: vim, emacs but also atom (i think)
<n4323> so you do not need vim/emacs necessarily to use merlin
strmpnk has joined #ocaml
snowcrshd has quit [Remote host closed the connection]
<octachron> freechips, Haskell's type classes would not mesh well with Ocaml module systems
<Xadnem> n4323 thank you very much. I have used eclipse for ocaml in windows and all was ok, but in Linux ( opensuse ) I don't know why it dosen't detect syntax errors
<Xadnem> What about Camelia, do you know it?
ggherdov has joined #ocaml
<n4323> i don't think i can help there - it seems certainly some config error. you would have to search down in the eclipse plugin config. don't remember much about that but i know i had it working on os x (maybe linux)
<n4323> don't know camelia, isn't that something mainly for teaching?
<octachron> freechips, modular implicits would be a more integrated answer to type classes
<Xadnem> Yes I think it is used at some universities, but I have't try it yet.
rfv has joined #ocaml
mankyKitty has joined #ocaml
mrallen1 has joined #ocaml
banjiewen has joined #ocaml
mbrock has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
adi_____ has joined #ocaml
jbrown has quit [Ping timeout: 255 seconds]
jkni has joined #ocaml
copy` has joined #ocaml
<freechips> flux: i realized while thinking of a parser that if i could use constructors without having to immediatly split the values things would be a little easier. so instead of Add(e1,e2) maybe Add(recursive f complexargument)
<freechips> octachron: im not sure what you're talking about. ive seen GADs and ive seen polymorphic variants, but still i'd like to have a more consistent and flexible syntax for handling types
menasw has joined #ocaml
<freechips> but im not really keen on having any of that for normal day-to-day use, im just talking about this interpreter im making
myst|fon has joined #ocaml
morfeen has joined #ocaml
jbrown has joined #ocaml
Xadnem has quit [Quit: leaving]
jmct has joined #ocaml
jao has quit [Ping timeout: 240 seconds]
mengu has quit [Remote host closed the connection]
yunxing has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
morfeen has quit [Remote host closed the connection]
mengu has joined #ocaml
MorTal1ty has joined #ocaml
al-damiri has joined #ocaml
_andre has quit [Quit: leaving]
<octachron> freechips, note that if you wish, you can use tuple as constructor argument, i.e define "type t = A of (int*float)" then "let x = (1, 1.) let a = A x" works
agarwal1975 has quit [Quit: agarwal1975]
<freechips> ah right i keep forgetting about that
<freechips> thanks
morfeen has joined #ocaml
morfeen has quit [Remote host closed the connection]
agarwal1975 has joined #ocaml
zpe has joined #ocaml
ChristopheT has quit [Ping timeout: 255 seconds]
morfeen has joined #ocaml
mengu has quit [Remote host closed the connection]
twold has joined #ocaml
obadz has quit [Ping timeout: 255 seconds]
jao has joined #ocaml
obadz has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
zpe has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Ping timeout: 252 seconds]
tane has quit [Ping timeout: 264 seconds]
zpe has joined #ocaml
zpe has quit [Remote host closed the connection]
jbrown has quit [Ping timeout: 255 seconds]
Denommus has quit [Ping timeout: 240 seconds]
zpe has joined #ocaml
larhat has quit [Quit: Leaving.]
jbrown has joined #ocaml
orbifx has joined #ocaml
<orbifx> is there a way to tell ocaml to hide a type, even though it's an alias, other than using a module?
<octachron> orbifx, you mean hide a type equality? If so, modules are the only way
<orbifx> yeah
<orbifx> thanks
yomimono has joined #ocaml
<orbifx> Am I right to be troubled by these series of types: https://github.com/orbifx/logarion/blob/master/src/logarion.ml#L5
<orbifx> I've started thinking that modulating them would be better than having them as parametric variants
<orbifx> seems like I should either go the polymorphic variant way, or just modulate those types
zpe has quit [Remote host closed the connection]
<octachron> orbifx, it might be possible to unify the *_t types as "type 'a t = { kind:'a; path:Fpath.t}"
MercurialAlchemi has quit [Ping timeout: 276 seconds]
<orbifx> octachron: thanks for looking into it; I thought about this, or even `type t = KindA of Fpath.t | KindB of Fpath.t ...`
<orbifx> but would either of these methods be the appropriate way to represent the various types of paths in the system and also build compiler validated compositions? For example I don't want someone to be able to create `KindB / KindA`
<Drup> type 'a t = { kind:'a; path:Fpath.t} constraint 'a = [< kinds ]
<Drup> type kinds = `Repodir | ...
<orbifx> the union you suggested can only do runtime checks (as far as I understand) and a paramatric variant type would not even be able to forbit compositions.
<orbifx> last message was for octachron
<octachron> orbifx, as Drup implied, it is possible to use the type parameter "'a" to implement this kind of restriction
<orbifx> Drup: first time I see "constrinct"..
<orbifx> even as function parameters?
<Drup> (or just make t abstract and provide your constructors)
<Drup> (then it's impossible, by abstraction, to make a `foo t`)
<orbifx> `let compose a:t b:t = .. where constraint 'a Kind.. , constraint 'b = ...`
<octachron> orbifx, you can then define function like "val (/) : [`Dir] t -> ([< `Dir | Filename] as 'a) t -> 'a t"
<orbifx> is there such an expression in OCaml?
jnavila has quit [Remote host closed the connection]
<orbifx> ok, this is new for me, although it make sense given polymorphic variants.
<Drup> (note that this is a bit of a rabbit hole, but it will be very educative :D)
<orbifx> In your experience, would that lead to a mode convoluted systen than using modules and abstraction?
<orbifx> Drup: heh, I was just asking that :P
<Drup> poly variant as phantom types allows to encode a lot of properties
kakadu has quit [Remote host closed the connection]
<orbifx> I understand polymorphic variants are good for allowing extensions without dependendancy, but that is not something needed here; would modules be more appropriate then?
<orbifx> although I'm tempted to try the poly. vars. just for fun
<Drup> the question should be reformulated: do you *really* need n-ary subtyping ?
<orbifx> pressuming what you mean by n-ary, I think not
<Drup> I would advise to try for educative purposes, yes
<octachron> orbifx, in fact here polymorphic variant are used more because they can implement some basic set algebra at the type level
<Drup> try to design it as a small property
<orbifx> I think there is a better part of the system to try that on, and that would be the meta fields supported by the file types.
<Drup> small library*
<orbifx> octachron: can you elaborate on your last comment?
<Drup> octachron: I have in my backpile of "shitty project I should try" to make a compiler from regex to type-level poly variants :D
<Drup> (yes, you can)
<orbifx> Drup: I think they would work well here: https://github.com/orbifx/logarion/blob/master/src/ymd.ml#L45
<Drup> orbifx: what he means (and what I meant by n-ary subtyping is, do you need to sometimes answer question of the form "is A B included in A B C D" where both sides contains more than one label
freehck has quit [Ping timeout: 260 seconds]
<Drup> (if you have only one label, then you can get away with polymorphism)
<Drup> you should only try this kind of stuff in domains where you have defined law that you want to enforce at compile time. If you need some sort of runtime operation, it's going to make your life miserable
<orbifx> I don't need any runtime abilities now
<orbifx> i want to have some compile time checks on operations over paths. There are going to be few types and rarely one might get added (as the project develops)
<Drup> well, try it, it would be amusing to see a TyFpath
<orbifx> Ty? :P
<Drup> Typed
<orbifx> I think it's mandatory for some applications, rather than amusing
<orbifx> so you think I should use polymorphic variants instead of modules, for demonstration purposes?
<octachron> Drup, a type level regexp recognizer sounds indeed particularly quaint
<Drup> octachron: there is a surprising significant body of literature about regular languages at the level of types
<Drup> surprisingly*
<octachron> (say the person that recently wondered if ocaml dependencies analyzers can play rubik's cube at the signature level)
<octachron> Drup, really? I may have a look at some point
<Drup> (in particular, https://www.cs.cmu.edu/~fp/ has several papers on "what happens if I do type theory+automaton theory)
<Drup> (well, he has lot's of other very cool stuff too, usually quite theoretic)
<orbifx> octachron: where can I read about constraining polymorphic variants in function parameters on the manual?
<Drup> octachron: also, session types are relevant
mengu has joined #ocaml
<octachron> orbifx, a (probably too) advanced example would be tyxml: https://github.com/ocsigen/tyxml
<Drup> yeah, trying to understand polyvars by looking at tyxml is not a good idea
<orbifx> yeah, I've used tyxml, which shows me that this approach might be far too expansive for what I need.. taking a wrecking ball to a nail :P
<orbifx> I need 3 subtypes of Fpath and a set of operations between them
<orbifx> which can be checked by the compiler
zpe has joined #ocaml
<octachron> which means that for n-ary functions, there are possibly 3^n variations of the function if you completely abstract each subtypes
<Drup> orbifx: no, the technique can be used at a small scale fine
zpe has quit [Ping timeout: 240 seconds]
<orbifx> Drup: that article is really interesting on phantom types. Haven't finished reading it, but I see that modules and polymorphic variants can overlap a bit in use.. how does one choose over the other?
<orbifx> I believe poly vars have some runtime cost at times, but what else?
<Drup> poly variants as used in tyxml or this blog post don't have any runtime cost
<orbifx> octachron: the functions would be binary in most cases I can think at this point and they only support a subset of the compinations, e.g. you can't append a parent to a child path
<Drup> (that's point of phantom types, they're phantoms)
<orbifx> ok, so what is the decisive factor between the two?
<Drup> not the same expressiveness/ease of use
<octachron> Drup, I would say that is the point of types in a statically typed language
<Drup> but ultimately, you should not try to choose between "feature X" and "feature Y". Aim to use the language to make the best library (which does *not* mean the most type-crazy one!)
<Drup> type abstraction is bread and butter in OCaml, you should always use it anyway
<orbifx> Drup: but at the moment I don't see why modules exist over polymorphic variants, are than their namespacing abilities
<Drup> they're really different though
<orbifx> s/are/other
<orbifx> how are they different (in their ability to abstract types)
<Drup> poly variants don't do anything for abstraction, modules do
<Drup> you are opposing two things that work really well together all the time, I don't really understand your point
ryanartecona has joined #ocaml
eimantas has joined #ocaml
<orbifx> yeah, it was incorrect to use the word abstraction
<orbifx> also I think I see the difference..
<orbifx> and what I misunderstood
<orbifx> so.. if I go the module way, I would have to use abstract types and functions operating over these abstract types to create my "algebra"
<eimantas> Hello there, sorry to disturb you all, but maybe someone had a problem while trying to install 32 bit version of ocaml through opam on ubuntu 16.04? When i run opam switch install 4.03.0+32bit (or 4.02.0+32bit) I get this: https://box.everhelper.me/attachment/759574/58d90cd7-6ce6-4158-b4e5-7361c9e7efc4/747320-mInfTHPn8mb4nACV/screen.png
<orbifx> if I used polym. variants I'd create commons function(s) which would change their operation depending on the variants provided
eimantas has quit [Quit: Page closed]
eimantas has joined #ocaml
<orbifx> and polym. variants would maybe take a bit less coding..?
kalle_ has quit [Ping timeout: 260 seconds]
<octachron> orbifx, not exactly, with polymorphic variant at the type level, you can write functions that are restricted over subsets of your type family
<orbifx> I think I'm getting this.. a bit late in the day for new concepts but I think I'm getting it.
<orbifx> and I think the key here was abstraction. Poly variants don't abstract.
<octachron> eimantas, this looks like gcc trobules, does gcc work?
<eimantas> octachron, yes, i have no troubles with 64 bit ocaml
<Drup> orbifx: I think you should just try things. Try to code all this and see how it plays out
<orbifx> Drup: ok will do. Wanted to get to release a beta some time soon, but .. what can you do :P
<orbifx> thanks Drup & octachron
<eimantas> I think i just solved my problem by sudo apt-get install gcc-multilib
vramana1 has joined #ocaml
vramana has quit [Ping timeout: 255 seconds]
vramana1 is now known as vramana
john51 has quit [Remote host closed the connection]
john51 has joined #ocaml
jbrown has quit [Ping timeout: 255 seconds]
Sim_n has quit [Quit: Leaving]
john51 has quit [Ping timeout: 240 seconds]
eimpec has joined #ocaml
noddy has joined #ocaml
jbrown has joined #ocaml
eimantas has quit [Quit: Page closed]
fre2 has quit [Ping timeout: 256 seconds]
pigeonv has quit [Ping timeout: 252 seconds]
john51 has joined #ocaml
yomimono has quit [Ping timeout: 256 seconds]
Algebr has quit [Ping timeout: 240 seconds]
yomimono has joined #ocaml
Algebr has joined #ocaml
Algebr is now known as Guest92001
orbifx has quit [Ping timeout: 264 seconds]
agarwal1975 has quit [Ping timeout: 255 seconds]
AlfredENeuman has quit [Ping timeout: 240 seconds]
Guest92001 has quit [Ping timeout: 255 seconds]
snhmib has quit [Quit: WeeChat 1.6]