al-damiri has quit [Quit: Connection closed for inactivity]
nomicflux has joined #ocaml
vicfred has quit [Quit: Leaving]
jbrown has quit [Ping timeout: 255 seconds]
nomicflux has quit [Quit: nomicflux]
agarwal1975 has quit [Ping timeout: 264 seconds]
Simn has quit [Quit: Leaving]
jbrown has joined #ocaml
nomicflux has joined #ocaml
sh0t has quit [Remote host closed the connection]
noddy has joined #ocaml
pigeonv has quit [Ping timeout: 260 seconds]
nomicflux has quit [Quit: nomicflux]
philtor has quit [Ping timeout: 240 seconds]
philtor has joined #ocaml
mengu has quit [Remote host closed the connection]
nomicflux has joined #ocaml
jao has joined #ocaml
parataxis has joined #ocaml
S11001001 has joined #ocaml
chindy has joined #ocaml
chindy has quit [Remote host closed the connection]
annoymouse has joined #ocaml
infinity0_ has joined #ocaml
infinity0 is now known as Guest74054
infinity0_ has joined #ocaml
infinity0_ is now known as infinity0
Guest74054 has quit [Killed (cherryh.freenode.net (Nickname regained by services))]
chindy has joined #ocaml
infinity0 has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
chindy has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
infinity0_ has joined #ocaml
infinity0_ has quit [Changing host]
infinity0 has joined #ocaml
jeffmo has joined #ocaml
infinity0 has quit [Remote host closed the connection]
jeffmo has quit [Client Quit]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
chindy has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 276 seconds]
Guest16166 has joined #ocaml
<Guest16166>
.
Guest16166 has quit [Client Quit]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
nicoo has quit [Ping timeout: 240 seconds]
nicoo has joined #ocaml
infinity0 has joined #ocaml
silver has quit [Read error: Connection reset by peer]
shinnya has joined #ocaml
snhmib has quit [Ping timeout: 240 seconds]
snhmib has joined #ocaml
jbrown has quit [Ping timeout: 255 seconds]
FreeBirdLjj has joined #ocaml
shinnya has quit [Ping timeout: 240 seconds]
jbrown has joined #ocaml
morfeen has joined #ocaml
govg has quit [Ping timeout: 260 seconds]
morfeen has quit [Ping timeout: 260 seconds]
fre2 has quit [Ping timeout: 258 seconds]
mfp has quit [Ping timeout: 245 seconds]
ryanartecona has joined #ocaml
agarwal1975 has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
mengu has joined #ocaml
mengu has quit [Remote host closed the connection]
gjaldon has joined #ocaml
<lapinot>
wc
lapinot has left #ocaml [#ocaml]
fre2 has joined #ocaml
gjaldon has quit [Remote host closed the connection]
gjaldon has joined #ocaml
govg has joined #ocaml
gjaldon has quit [Remote host closed the connection]
gjaldon has joined #ocaml
gjaldon has quit [Ping timeout: 248 seconds]
nomicflux has quit [Quit: nomicflux]
nomicflux has joined #ocaml
jbrown has quit [Ping timeout: 255 seconds]
jao has quit [Ping timeout: 240 seconds]
ygrek has quit [Ping timeout: 252 seconds]
nomicflux has quit [Quit: nomicflux]
copy` has quit [Quit: Connection closed for inactivity]
jbrown has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
gjaldon has joined #ocaml
oschwald has quit [Quit: Leaving.]
govg has quit [Ping timeout: 260 seconds]
mengu has joined #ocaml
mengu has quit [Ping timeout: 255 seconds]
govg has joined #ocaml
annoymouse has quit [Quit: Connection closed for inactivity]
MercurialAlchemi has joined #ocaml
FreeBirdLjj has joined #ocaml
gjaldon has quit []
ryanartecona has joined #ocaml
larhat has joined #ocaml
philtor has quit [Ping timeout: 240 seconds]
jbrown has quit [Ping timeout: 255 seconds]
larhat has quit [Quit: Leaving.]
jbrown has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
rgrinberg has quit [Ping timeout: 248 seconds]
MercurialAlchemi has quit [Ping timeout: 245 seconds]
jrslepak has quit [Ping timeout: 258 seconds]
milodavis has quit [Ping timeout: 245 seconds]
FreeBirdLjj has joined #ocaml
noddy has quit [Ping timeout: 240 seconds]
<flux>
my current candidate for crashes is stack overflow (that might not handled decently on Raspberry native binaries?)
ryanartecona has quit [Quit: ryanartecona]
ygrek has joined #ocaml
morfeen has joined #ocaml
MercurialAlchemi has joined #ocaml
morfeen has quit [Ping timeout: 240 seconds]
morfeen has joined #ocaml
<flux>
so I got this idea how pgocaml(ppx) could incorporate macros. let%pgsql Macro = "ORDER BY ASC" and later on [%pgsql "select blahblah" ^ Macro]
<flux>
in addition, [%psql "select blahblah" ^ if a then Macro else Bacro] would be translated into if a then [%psqql "select blahblah" ^ Macro] else ..
<flux>
bonus points for supporting any expression that could be lifted that way in the place of Macro (ie. let in, match)
<flux>
that would pretty much cover most of my dynamic query needs. the type system would ensure different branches of the 'if' would return fields of the same type.
morfeen_ has joined #ocaml
<flux>
of course then there's the combinatoric explosion, but in practice I hope there are only a few customization points in a query..
morfeen has quit [Ping timeout: 248 seconds]
<flux>
on the other side _all_ query combinations would be checked at compile time, which would be good
jbrown has quit [Ping timeout: 255 seconds]
average has joined #ocaml
morfeen_ has quit [Remote host closed the connection]
jbrown has joined #ocaml
randomA has joined #ocaml
<randomA>
0113[::-1]
<randomA>
'0113'[::=1]
<randomA>
LOl
jnavila has joined #ocaml
<flux>
ok
<randomA>
dont judge fam
<flux>
cool, I reproduced my issue on X86 "Fatal error: out of memory." with nothing but the RTM support
<flux>
wish I had enabled backtraces ;-)
<randomA>
how do i become a programmer????
<randomA>
i want be a programmer
morfeen has joined #ocaml
<flux>
randoma, what do you want to achieve? it helps to have a concrete goal.
<randomA>
you right.
<randomA>
I want to make a fuzzer that does machine learning
<randomA>
i low key dont know shit about machine learning though
<randomA>
ive noticed that most of the things i know, i learned from copy+paste examples
<randomA>
that's probably why im bad at school
<randomA>
i didnt take linear algebra yet actually
<randomA>
is that going to be a problem>
<randomA>
i mean, i read the linear algebra textbook halfway
<flux>
I did that machine learning course before it was on coursera, but I don't remember how linear algebra heavy it is
<randomA>
it looks stressful
<flux>
actually I think it does do matrix*vector and vector*matrix operations, perhaps matrix*matrix as well
<flux>
maybe some oneline course on linear algebra then first, perhaps from coursera?-)
<randomA>
yea i know that much
<randomA>
i know up to like vector spaces
djellemah_ has joined #ocaml
<flux>
that's already beyong what that course needs I think
djellemah__ has joined #ocaml
<randomA>
ok. the other thing i want do is to write a protocol
<randomA>
not like write one, but implement a protocol
<randomA>
would that be difficult
<flux>
not that difficult, I witnessed a guy who had never done any tcp networking whip one simple up between python and matlab in a week or so.
<flux>
(might have been an hour after you know what to do..)
<randomA>
right like i know how stuff works but my problem is that i'm really indecisive and making high level decisions is a nightmare
djellemah has quit [Ping timeout: 260 seconds]
<flux>
then just pick any solution and don't be afraid to redo if it turns out to be bad
<randomA>
so like all these design patterns and method stubs
djellemah_ has quit [Ping timeout: 248 seconds]
<randomA>
yea i guess i could do that. its not for school anyway
kakadu has joined #ocaml
AltGr has joined #ocaml
Simn has joined #ocaml
ygrek has quit [Ping timeout: 240 seconds]
jbrown has quit [Ping timeout: 255 seconds]
ocp has joined #ocaml
jbrown has joined #ocaml
pigeonv has joined #ocaml
pigeonv has quit [Ping timeout: 260 seconds]
jrslepak has joined #ocaml
larhat has joined #ocaml
milodavis has joined #ocaml
mengu has joined #ocaml
mengu has quit [Ping timeout: 255 seconds]
<mcspud>
Ignore design patterns
<mcspud>
If anyone comes to me saying that I just laugh in their face and move on
<randomA>
why
alfredo has joined #ocaml
sspi has joined #ocaml
<sspi>
Hi all, I'm currently diving into ocamldebug and was wondering if it's possible to change values during time travelling - maybe with using dynlink?
pigeonv has joined #ocaml
gjaldon has joined #ocaml
<gjaldon>
I just published an opam package which installs fine with opam. However, ocamlfind can't seem to find the package. Could the problem be in the way it's packaged? https://github.com/gjaldon/simple-diff/blob/master/opam
<gjaldon>
would appreciate any help/ideas. since it can't be found by ocamlfind, I can't require it from within utop or use it from within another project
<randomA>
tht cool
<flux>
gjaldon, ocamlfind uses META files for finding packages
<flux>
gjaldon, just find any META files from the place where you install your package do, there are plenty of examples. and of course the official documentation :)
<gjaldon>
flux: how come utop can't find the package but seems to find every other package I installed via opam?
<flux>
gjaldon, also I'm not at all experienced with opam files, but is the 'install' phase somehow automatically determined with your opam file? or is it simply skipped?-)
<flux>
gjaldon, because every other package installs a META file..
<flux>
utop uses ocamlfind (aka findlib) to find the packages
<flux>
ocamlfind is configured with META files
<flux>
as simple as that :)
<flux>
gjaldon, cool library!
<gjaldon>
flux: ahh it seems you're right. thanks a lot! will try that out and let you know how it goes :)
<flux>
gjaldon, btw, why does it require input as strings?
<gjaldon>
flux: thanks! it's my first ocaml lib :D
<gjaldon>
flux: In the project where I'm using it, I'll mainly be passing arrays of strings
<gjaldon>
I could make it more liberal in the types it can accept though so it would become more generic
<flux>
good excuse ;). I think thoguh if it accepted a comparison function and an 'a array, it would be more generally applicaple.
<flux>
("applicable", for some reason that word is difficult to me..)
<gjaldon>
flux: that sounds like a great approach to make it more generic. I'll add an issue for it so I don't forget :D
FreeBirdLjj has quit [Remote host closed the connection]
morfeen has quit [Remote host closed the connection]
morfeen has joined #ocaml
jnavila has quit [Quit: It was time]
dx has quit [Ping timeout: 240 seconds]
randomA has quit [Quit: Leaving...]
morfeen has quit [Ping timeout: 264 seconds]
_andre has joined #ocaml
mfp has joined #ocaml
silver has joined #ocaml
FreeBirdLjj has joined #ocaml
jbrown has quit [Ping timeout: 255 seconds]
pigeonv has quit [Ping timeout: 248 seconds]
jbrown has joined #ocaml
jnavila has joined #ocaml
<freehck>
There were some build stuff to make ocamlbuild to treat modules in subdirectories as submodules of module with the name of the containing them dir. I mean if I have dir/a.ml and dir/b.ml than I want to treat them as module dir with 2 nested modules a and b. Can someone remember the name of this stuff?
Leo` has quit [Read error: Connection reset by peer]
TheAuGingembre has quit [Read error: Connection reset by peer]
<flux>
I remember it existed :)
<flux>
perhaps it was announced on the ocaml mailing list
<freehck>
I remember I saw the link here. Is there some archive of this channel?
<companion_cube>
freehck: there's a notion of "pack"
FreeBirdLjj has quit [Remote host closed the connection]
<freehck>
companion_cube: seems to be the right thing. Well I have a question. If I use pack, and if I define f.e. Kernel/System.ml to pack it into module Kernel; can I then create another module System in another directory? Will dependencies be solved properly?
FreeBirdLjj has joined #ocaml
snowcrshd has joined #ocaml
<freusque>
Hello. are there some opam+NixOS users here
<snowcrshd>
freusque: not me. Just out of curiosity, how is ocaml dev in NixOS treating you? I've been curious about NixOS but haven't got around to trying it yet.
edwin has joined #ocaml
ziyourenxiang has joined #ocaml
<freusque>
it's treating me very well.
<freusque>
I do not use opam2nix
<freusque>
so I install everything through opam.
<freusque>
occasionally an opam dependency looks in /usr/local/include
<freusque>
and I have to make a dirty symlink
<freusque>
but overall it's really okay. I ran through a strange issue rencently where the shell that ocaml uses by default does not have all the builtins
<freusque>
notably "type" is missing there. again, making a small shell script available in the user path solves such issues
<freusque>
the real solution being an opam2nix variant, I'm not pushing such changes upstream with too much force. :-)
<freusque>
You should definitely try nixos.. I can not possibly see my life back on debian.
<freehck>
companion_cube: yes, "pack" works! thank you very much. My life became simpler! :)
<companion_cube>
^^
freechips has joined #ocaml
<freechips>
hey guys im having a bit of an issue with static inference
<freechips>
it says im giving it a pattern 'a*'b but that makes no sense as Plus of expr*expr
<companion_cube>
looks like you should have `let rec sem`, at the end, also
lapinot has joined #ocaml
lapinot has left #ocaml [#ocaml]
<companion_cube>
freechips: also, `Plus (e1,e2)`
<companion_cube>
you need some ()
<freehck>
Plus (e1,e2)
<freechips>
companion_cube: ah thanks right its recursive
<freehck>
oh, I'm late again :)
chindy has quit [Remote host closed the connection]
<companion_cube>
it's both
<freechips>
Why do i need parentheses? i though , by itself identified a tuple
<companion_cube>
but here it's not a tuple :)
<companion_cube>
it's 2 arguments to a constructor
<companion_cube>
in general, a constructor application looks like A(x,y,z)
chindy has joined #ocaml
<freehck>
freechips: because (Plus a,b) is ((Plus a),b)
<freechips>
hm
<freechips>
by constructor you mean match?
<freechips>
i mean i know plus is defined as a tuple of expr
<freechips>
and tuples are ,
<freechips>
and i am matching with a Plus a,b
<freechips>
i still dont get it
<companion_cube>
`Plus a,b` means: `((Plus a),b)`
<companion_cube>
whereas you need `Plus (a,b)`
<freechips>
right i get it. because Plus is special it expects one argument, as it is not a type?
<companion_cube>
no, Plus expects 2 arguments
<companion_cube>
… | Plus of expr * expr | … defines Plus as a binary constructor
<companion_cube>
application of a binary constructor is written `Plus (x,y)`
<companion_cube>
that is all
<freehck>
freechips: shortly you can't omit parentheses in type constructor that uses a tuple
<freechips>
so not a tuple?
<companion_cube>
not a tuple
<companion_cube>
a constructor
<freechips>
so basically it looks like a tuple but it is in truth 2 arguments because Plus is a constructor
<freechips>
so counterintuitive tho
<twold>
seems a bit misleading to say it's a binary constructor when the behaviour is that you always pass one argument (whether it's a product or not)
<companion_cube>
freechips: that's it, 2 arguments for a binary constructor
dx has joined #ocaml
<freehck>
companion_cube: `Plus of expr * expr` is the `Plus: expr -> expr -> expr`?
<companion_cube>
twold: that's what it is though
<companion_cube>
freehck: yes
<freechips>
twold: but in fact i thought it was simply a tuple of expr not a constructor of 2 expr
<companion_cube>
although in OCaml, constructors are not curried
<companion_cube>
(it's a bit sad, I know(
<companion_cube>
)
<freehck>
companion_cube: cool, didn't know
<freechips>
interesting
<freechips>
so this is the only case in ocaml where a parentheses doesn't isolate a single argument, because plus is not a function but a constructor?
<freechips>
wait no now im confused
<twold>
It's not sad, I'm just still confused. I'll have to play around in the repl for a bit :)
<freechips>
if plus expr -> expr -> expr i could just say Plus e1 e2
<twold>
exactly, that's what just confused me ;)
<freechips>
and that would return an e1*e2
<twold>
what companion_cube said previously implied that it's not curried but what you are saying now is that it is. so which one is it? :)
<companion_cube>
freechips: it's a bit ugly, really
<freechips>
so it's not a function? but it still has types
<companion_cube>
constructors are not functions; they must ALWAYS be applied
<companion_cube>
and application is not curried (since there is no partial application for cstors anyway)
<freechips>
so the syntax is different from a function
<freechips>
it is more like a function in an imperative language?
<companion_cube>
not even
<companion_cube>
it's a constructor
chattered has joined #ocaml
jbrown has joined #ocaml
<companion_cube>
it can only be fully applied, and then it's a value
<companion_cube>
it's more similar to a struct (or record)
<freechips>
but apart from currying, you say i have to use 2 arguments. then i can do Plus e1 e2
<companion_cube>
just a way to write some values
<freehck>
companion_cube: it's easy to wrap constructors into same-name-bindings to make them curried.
<companion_cube>
freechips: that's not the syntax
<freechips>
but if i cannot then it is exactly an imperative function
<companion_cube>
the syntax is : Plus (e1,e2)
<freehck>
let plus a b = Plus (a,b)
<freechips>
ok so different syntax
<companion_cube>
freehck: then you're defining a function that applies the cstor
chindy has quit [Remote host closed the connection]
<companion_cube>
it works, it's fine, indeed
<freehck>
yep
<chattered>
Hey. I'm trying to do something pretty loopy with recursive modules, but I can't get a functor application to typecheck, and Ocaml isn't being too helpful with the reasons.
<freehck>
hm... is there some macro to to it, companion_cube?
<freehck>
no, I'm using 4.01.0, there's no ppx in this version. :/
<freechips>
so it is a function like ocaml, it cannot be curried, and it has a different syntax. why the different syntax?
<companion_cube>
freechips: then no macro
<companion_cube>
sorry :p
<freechips>
ah
toolslive has joined #ocaml
<companion_cube>
freechips: it's because constructors are not implemented as functions
<freechips>
interesting
<companion_cube>
(I mean, the runtime behavior is not at all the same)
<companion_cube>
Plus(e1,e2) will allocate a new block, put the tag "Plus" and fields e1 and e2
danieli has quit [Ping timeout: 256 seconds]
<companion_cube>
functions can do arbitrarily complicated stuff
<freehck>
companion_cube: well I think it's possible to write such ocmalp4 extension even for 4.01.0.
<companion_cube>
(and you need stack frames, etc.)
<companion_cube>
freehck: eeek
<chattered>
The thing I don't understand is that I can get this to work so long as I change the type definition for foo in the signature of the recursive S so that it doesn't mention F(S)
<companion_cube>
maybe so, but why‽
<freehck>
I'll look in my holiday how to do it.
<companion_cube>
investing in camlp4 now is… weird
<freehck>
you think?
<freehck>
are ppx so impressive?
<twold>
it's all a bit weird but essentially, Plus : expr * expr -> expr (and not, as was previously claimed Plus : expr -> expr -> expr)
<freehck>
twold: how have you got the type of Plus?
<twold>
The only confusing thing is the error messages really, since you're used to not have to bracket the arguments
<freechips>
though i dislike it because i defined Plus with a tuple but in the end i use it like a macro (constructor). but if it gives me a tuple it should look like a tuple when im "recognizing" it with match
<freechips>
is there any difference between using Plus (e1,e2) and just using e1,e2?
<freechips>
or does the constructor allow me to differentiate between 2 different tuples?
<freehck>
Plus (e1,e2) matches type expr. (e1,e2) matches some tuple.
<twold>
well, the type is inferred from what I observed in utop. the only thing that works is to treat the constructor as a function of one argument that takes a tuple
<twold>
I don't follow freehck, sorry
<companion_cube>
freehck: it's just that everyone is moving to ppx
<companion_cube>
which is more lightweight, composable, and easy on tooling
<companion_cube>
freechips: Plus(e1,e2) is useful because you can have other cases
<twold>
I kind of like doing `let plus (x, y) = Plus (x, y)`, which makes the type obvious
<companion_cube>
like Int(v)
<twold>
and I'm probably glad that the constructors are not conflated with functions (like they are in Haskell). they are really totally different beasts, type-theoretically, so it's good the language reflects that
<freechips>
hm
<freechips>
ok thanks for the input. i guess i need to learn a bit more on handling types and creating new ones with ocaml
<freehck>
Hm... btw, this is the reason why we can't match with `Plus x` assuming x to be some typle.
<freehck>
Plus is a type constructor of 2 arguments, not 1 tuple.
<companion_cube>
twold: well I'd still like the syntax to be more consistent, tbh
<twold>
freehck: you're right. the type I proposed does not really exist, but it helps me understand what's going on. and it's also consistent with how you'd write the constructor with GADTs
<freehck>
twold: it's not me, it's companion_cube ;)
<freehck>
I just listened. :)
<twold>
companion_cube: perhaps. it's certainly convenient to have curried constructors in some cases. but even in Haskell when you want to use some type seriously, you tend to define smart constructors for it and essentially end up doing stuff the ocaml way (but you do get currying there for free, which is nice)
<twold>
sorry, freehck, I confused the free.* nicks :)
chindy has quit [Remote host closed the connection]
<companion_cube>
twold: yeah, in a sense
chindy has joined #ocaml
<companion_cube>
still, would be nice to write `Plus e1 e2`
<companion_cube>
and to have `list α` instead of `α list`
sepp2k has joined #ocaml
<freechips>
hey guys how can i express subtypes? i want to be able to write Int(4) and have it be recognized as an expression, but at the same time i need it to be a different type because i want the sem function to have an expr as an input and an eval as an output
octachron has joined #ocaml
<freechips>
coming from the oop world, this would be expressed maybe as inheritance of a class
<Drup>
for that specific example, the typical answer is gadt
<kakadu>
polymorphic variants
<Drup>
kakadu: not for writing an eval function, no
<companion_cube>
GADTs are a bit advanced :3
FreeBirdLjj has quit [Remote host closed the connection]
<kakadu>
maybe
<kakadu>
I'm not sure that I parsed well after "the sem..."
<freehck>
People, could you help me with this compilation error?
<kakadu>
ah, then gadt probably
<freechips>
ah ok
<freechips>
dont know what gadt is
<freechips>
if only the documentation was a bit easier to find
<companion_cube>
freechips: for now, you should keep things like this, imho
<companion_cube>
don't get to the more elaborate tricks right now
<freehck>
all was fine but then I have added "let y = A.x" in B.ml
<freehck>
Can't understand what the problem with mlpack.
chindy has quit [Remote host closed the connection]
chindy has joined #ocaml
<kakadu>
Are you sure that packs are required?
<kakadu>
Btw, folks, is platform@lists.ocaml.org a decent maillist to send opam-related questions?
<freehck>
kakadu: I want for B module in xpack call A module specifically from xpack.
<freechips>
companion_cube: i know but that would mean that my interpreter can't accept Int(3) but only Val(Int(3)). i mean i could move the evals inside sem but that would fuck up the whole inheritance thing because i need sem to always output evaluated expressions
<freechips>
*move the evals inside sem => move Int of int inside expr. sorry
<freechips>
also it makes expr ugly because if i want to have 2 string types that will make thing problematic in the future i guess
<freechips>
*string types -> Variable type represented by string and string type which is really and eval type
<thizanne>
freechips: you could have your interpreter output expr
nomicflux has joined #ocaml
<freechips>
thizanne: i kinda dislike that. it would nullify the power of type handling in ocaml. i would have to rely on my capability to discind Plus from Int within expressions in sem
<freechips>
instead if i had 2 types i could have ocaml use static typing
<Drup>
freechips: what's so bad in having to write "Val (Int 3)" ?
<freechips>
i guess i could try polymorphic types? only thing is im not yet going for polymorphic but rather Int of int
<Drup>
you'll have a parser anyway
<freechips>
Drup: that's not the language im trying to write
<thizanne>
freechips: you could also have two distinct types
<thizanne>
type expr = Int of int | Add of expr * expr | ...;; type evaluated = ValInt of int | ...
<freechips>
thizanne: yeah i thought about that too...
<thizanne>
that doesn't seem too bad
<Drup>
depends how large is your language :p
<freechips>
Drup: actually it depends on how my teacher wants his language done XD
<freechips>
only thing is my teacher doesnt really teach
<freechips>
thizanne: ill try with the double type method. can anybody point me in the right direction in case i later want to refine it by having eval be a subtype of of expr?
averell has joined #ocaml
<freechips>
gadp or polymorphic inheritance? can't find mch on ocaml.org
<Drup>
type expr = Val of value | ...
<Drup>
sometime, the right answer is the simple one :)
<octachron>
freehck, if you want to have a module A both outside and inside the pack X and use ocamlbuild, I fear that the easiest option would be to build X as a separate library
<freehck>
octachron: So I must rename A.ml to Kernel_A, and create X.ml and define there module A = Kernel_A. Ah...
<freehck>
The think I was looking for is the way to remove this "Kernel_" prefix. :)
<freehck>
*thing
<freehck>
octachron: the problem is that in my project I do have more than two modules A and B. And in every module I do "module M = Kernel_M".
<freehck>
Well, is there something more powerful than ocamlbuild/corebuild?
<octachron>
freehck, an option would be to have an atlas module that defines all the short name and then open this atlat module when needed
<freehck>
octachron: with main.ml there's only one problem. If I want to access NAME__a from NAME__b, I can't use the short name from Main because of circular dependency.
<freehck>
Well this is the approach I currently use.
<freehck>
octachron: namespaces seem to be the link I saw here some time ago and I was looking for. I'll try it now.
<freehck>
ah... I need 4.02.0 for namescpaces. :(
<freehck>
Okay. Upgrade time.
<octachron>
freehck, in fact with the "-no-alias-deps" compiler option there is no circular dependency, but this is not yet well handled by tools
noddy has joined #ocaml
<octachron>
(that is one of the problems that codept sould fix once published )
<freehck>
octachron: it's not handled specifically by ocamlbuild?
<octachron>
freehck: only partially, because ocamldep support for delayed alias dependencies is quite … contrived
<freehck>
Well I don't know why I do use ocamlbuild. I could write my Makefile with ocamlc build rules. All the problems I have now concerns my build tool. What kind of work build tools like ocamlbuild makes easier?
<freehck>
s/makes/make/
djellemah__ is now known as djellemah
oo6 has quit [Quit: Leaving]
<octachron>
freehck, having compilation units with the same name will create difficulties with most build system
agarwal1975 has joined #ocaml
oschwald has joined #ocaml
<octachron>
even the compiler more or less assumes that there is an one-to-one mapping between toplevel module names and file names
freechips has quit [Quit: WeeChat 1.7]
<kakadu>
Folks, let's say we have this two types:
<kakadu>
type flam = (string fancy, flam) glam fancy
<kakadu>
type flam2 = (string fancy, flam fancy) glam
<kakadu>
should compile be able to deduce that type `flam ` is the same as `flam2 fancy`?
<kakadu>
where type 'a fancy is abstract
<kakadu>
and type ('a,'b) glam is declared above
<kakadu>
and we use rectypes switch
<thizanne>
flam2 fancy is (string fancy, flam fancy) glam fancy
<thizanne>
unless type 'a fancy = 'a, that doesn't seem to be equal to flam
<octachron>
kakadu, if 'a fancy is abstract the compiler can not deduce that flam and flam2 are different
<kakadu>
the my problems seems that compiler can't deduce that htey are the same
ziyourenxiang has quit [Quit: Leaving]
<Drup>
to see that they are the same, you would need to properly take the fixpoint, I doubt the compiler will do that
sz0 has joined #ocaml
jbrown has quit [Ping timeout: 255 seconds]
<kakadu>
Well, the problem was not in that place
<kakadu>
fixed that.
<kakadu>
Btw, does anybody remember the motivation to add rectypes switch?
<kakadu>
I kindof tried to ask in the platform maillist if opam can count packages that use -rectypes but no asnwer (yet)
<Drup>
kakadu: download all the sources using "opam source" and grep each one ?
snowcrshd has quit [Ping timeout: 248 seconds]
silver_ has joined #ocaml
silver has quit [Ping timeout: 240 seconds]
<kakadu>
weird that it didn't come up on my mind....
morfeen has joined #ocaml
<Drup>
that because you asked "how to retrieve the compiler flag used in a package", which is much much harder to answer
<Drup>
flags*
jbrown has joined #ocaml
<Drup>
(oh, and the answer is going to be "almost no one", btw)
<kakadu>
by bash is already started on letter 'b' :)
inr_ is now known as inr
ciniglio has left #ocaml ["Killed buffer"]
ciniglio has joined #ocaml
ryanartecona has joined #ocaml
silver_ is now known as silver
fre has joined #ocaml
freusque has quit [Ping timeout: 258 seconds]
<freehck>
octachron: could you explain -no-alias-deps? If X provides aliases for A and B as X.A and X.B, and B depends on A then I can just substitute A.<f> in B with X.A.<f> and then add -no-alias-deps to ocamlc flags?
<zozozo>
what do you usually do when you have a module T : sig type 'a t val hash : 'a t -> int (...) end, and you want to 'specialize' it to a specific type in order to instantiate a functor ?
<freehck>
zozozo: but := is a type substitutuin, and = is type specifying.
<octachron>
freehck, basically with -no-alias-deps, module aliases generate dependencies when they are used, not when they are defined.
mengu has quit [Ping timeout: 248 seconds]
<zozozo>
freehck: I don't see where the solution to my problem is in the code you pasted
<octachron>
freehck, in other words, with X.ml: "module A = Long__A module B = Long__B open B", X only has a dependency on Long_B (due to the "open B"), not on Long__A
mengu has joined #ocaml
<freehck>
octachron: So in module Long_B I still can't use short name A instead of Long_A.
morfeen has quit [Remote host closed the connection]
<octachron>
freehck, right. This is why it is more efficient to have an atlas module that only defines module aliases and does nothing else
shinnya has joined #ocaml
<freehck>
octachron: If I create atlas module X with "module A = Long_A module B = Long_B" I'll get a circular dependency error if I try to use X.A.<f> in the module Long_B.
<freehck>
Can I avoid it?
ryanartecona has quit [Quit: ryanartecona]
MercurialAlchemi has quit [Ping timeout: 245 seconds]
<freehck>
or you suggest me to make module aliases a preambula to all my modules?
ryanartecona has joined #ocaml
<octachron>
freehck, the subtlety here, is that the strict dependency with "-no-alias-deps" will be A → {X}, B → {A,X}, X → {}
<freehck>
zozozo: Maybe it would be easier to answer if you posted a snippet
obadz has quit [Ping timeout: 276 seconds]
noddy has quit [Ping timeout: 240 seconds]
<thizanne>
freehck: module M = struct type 'a t = 'a list let compare = compare end
<octachron>
however, the dependencies inferred by ocamldep/ocamlbuild will be "A → {X}, B → {A,X}, X → {A,B}"
<thizanne>
how do you instantiate Maps with this module if you only want maps from int lists
<freehck>
octachron: even despite I have set -cflag -no-alias-deps?
<octachron>
freehck, yes, the additional X → {A,B} dependency is a blind spot in current tools
obadz has joined #ocaml
<freehck>
octachron: but if I write a Makefile using ocamlc only, I will be able to use this option properly, did I get you right?
<octachron>
freehck, yes, this an option. However, *I* would deem that a quite complicated option compared to the independent libray option using oasis
vramana has quit [Remote host closed the connection]
<octachron>
zozozo, I think you can do this using an auxilary type type 'a only_a_int_really = int and substituting with this auxiliary type rather than int directly
gjaldon has quit [Remote host closed the connection]
<mengu>
Drup: i thought so
<Drup>
notty is good if you want full screen diagrams/visualisation, it's not a TUI toolkit
<Drup>
in this case, lambda-term will give you panels, modals, auto-completion, etc
<mengu>
let me check notty too but all i need is some panels, reading and printing
<zozozo>
freehck: except in your code, you have to define a different implementation for each specilized type, which is really not what I want
<snowcrshd>
mengu: I don't think notty has built-in widgets. You'd probably have to code your panels from scratch
rgrinberg has joined #ocaml
<freehck>
zozozo: but u can do it in-place
<zozozo>
freehck: I don't get what you mean, plus in the code you pasted, you lose the ability to create/compare ids for different type in the same module
<octachron>
Drup, ah yes, it seems that I would have to at least interject for a short "links are nice" review
govg has joined #ocaml
<Drup>
there is another one too, which is linked at the end
agarwal1975 has quit [Quit: agarwal1975]
agarwal1975 has joined #ocaml
slash^ has joined #ocaml
jao has joined #ocaml
shinnya has quit [Ping timeout: 240 seconds]
paroneay` is now known as paroneayea
jbrown has quit [Ping timeout: 255 seconds]
toolslive has quit [Remote host closed the connection]
<kakadu>
Drup: I found some uses of rectypes, for example in BatFingerTree. It seems it is useful sometimes
sz0 has quit [Quit: Connection closed for inactivity]
kakadu has quit [Quit: Konversation terminated!]
jbrown has joined #ocaml
jnavila has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
ygrek has joined #ocaml
ryanartecona has joined #ocaml
ocp has quit [Ping timeout: 258 seconds]
chindy has quit [Remote host closed the connection]
chindy has joined #ocaml
jnavila has quit [Ping timeout: 252 seconds]
rgrinberg has quit [Ping timeout: 240 seconds]
ollehar1 has joined #ocaml
hunteriam has joined #ocaml
morfeen has quit [Remote host closed the connection]
morfeen has joined #ocaml
morfeen has quit [Ping timeout: 240 seconds]
<flux>
ok, so I have a mystery. command line ocamlfind ocaml -linkpkg -package x -package y -package mtime.os test.ml -o test.byte works fine
<flux>
ok, so I have a mystery. command line ocamlfind ocaml -linkpkg -package x -package y -package mtime.os -package fftw3 test.ml -o test.byte fails with a linker error /tmp/cc6ADGb5.o:(.data.rel+0xde0): undefined reference to `ocaml_mtime_elapsed_ns', which is defined in mtime
<flux>
oops, editing fail, I hope you got the gist ;-)
<flux>
in other words, adding a package to the end makes it not find a symbol? the symbol is not used or depended upon by fftw3
<companion_cube>
well clearly mtime.os needs this C function
<companion_cube>
but the function is not present at link time, for some reason
<flux>
how can it come un-present by adding a new package?
<companion_cube>
I mean that you add a package, which requires this symbol
<flux>
but it doesn't
<flux>
I can compile fftw3 without mtime just fine
<companion_cube>
mtimes does not require this symbol?
<companion_cube>
then why do you -package mtime.os?
<flux>
because my code requires is
<flux>
well, actually it's -package slacko that requires it, and it does also mention mtime.os in its meta file as a depdenency
<flux>
also, with ocamlopt everything works fine
<companion_cube>
what if you put -package mtime.os first?
<companion_cube>
ah, weird that
<flux>
doesn't seem to affect regardless
<flux>
but what I not notice with ocamlfind ocamlc -verbose is that if I have -package fftw3, the final stage of linking is performed with cc
<flux>
but without it it uses ocamlc.opt
<flux>
so I think the problem is either in the making of mtime.cma or fftw3.cma :)
<flux>
when I look at the mtime.cma with ocamlobjinfo, it says Extra dynamically-loaded libraries: -lmtime_stubs, but with fftw3 it says Extra dynamically-loaded libraries: dllfftw3_stubs.so
<flux>
..probably only one of them is the correct way? also fftw3 has Extra C object files: -lfftw3_stubs -lm -lfftw3 -lfftw3f, but mtime has Extra C object files: -lrt
sz0 has joined #ocaml
ollehar1 has quit [Quit: ollehar1]
<flux>
so with a popularity vote on my installed packages, I deem that the way fftw3 does it is correct
<flux>
oh jolly, I get to see how to fix mtime's myocamlbuild.ml
KV has joined #ocaml
KV has quit [Client Quit]
justicefries has joined #ocaml
kakadu has joined #ocaml
jnavila has joined #ocaml
gjaldon has quit []
<flux>
cool, now it works
slash^ has quit [Read error: Connection reset by peer]
ryanartecona has quit [Quit: ryanartecona]
jbrown has quit [Ping timeout: 255 seconds]
snowcrshd has quit [Remote host closed the connection]
pigeonv has joined #ocaml
ocp has joined #ocaml
jnavila has quit [Ping timeout: 240 seconds]
ocp has quit [Client Quit]
fraggle_ has quit [Ping timeout: 255 seconds]
morfeen has joined #ocaml
jbrown has joined #ocaml
copy` has joined #ocaml
ryanartecona has joined #ocaml
chindy has quit [Remote host closed the connection]
chindy has joined #ocaml
chindy has quit [Remote host closed the connection]
justicefries has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
chindy has joined #ocaml
chindy has quit [Remote host closed the connection]
chindy has joined #ocaml
TheLemonMan has joined #ocaml
wolfcore has quit [Ping timeout: 245 seconds]
wolfcore has joined #ocaml
justicefries has joined #ocaml
noddy has joined #ocaml
justicefries has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
morfeen has quit [Remote host closed the connection]
morfeen has joined #ocaml
mengu has quit [Remote host closed the connection]
morfeen has quit [Ping timeout: 240 seconds]
larhat has quit [Quit: Leaving.]
octachron has quit [Quit: Leaving]
ryanartecona has quit [Quit: ryanartecona]
noplamodo_ has joined #ocaml
noplamodo has quit [Read error: No route to host]
<freechips>
hey guys i managed to get my interpreter up and running with the 2 type systems: http://ix.io/1SLp
<freechips>
but im very unsatisfied with it
<freechips>
ideally i would want to have the interpreter (sem) to simply distinguish between Variables, Values and Operations
<freechips>
but instead of something like Int of int id like Val v -> v
<freechips>
but if i do this i have to change expr and expr is like my parser so i wouldn't be able to use Int 4 in my language anymore
<freechips>
also i wouldnt want to have a 2 type system with output "4 EInt", i would want just "4" as output, but if i did this then i couldn't have the output for sem (the parser) be of type value because it could be both boolean or int
<freechips>
i feel like having a parametric type might help, but im not sure how to use it
<freechips>
from an engineering standpoint i dislike having all of my languages basetypes int expr, id like to round them up in value or something but still retain the ability to use them in input (which is of type expr). so i really need like for value to be a subtype of expr or something
<freechips>
i cant just figure this out!
MercurialAlchemi has quit [Ping timeout: 258 seconds]
<lyxia>
freechips: You can wrap your constructors in functions: int x = Val (EInt x)
mengu has joined #ocaml
<lyxia>
freechips: I didn't understand your issue about sem having an output of type both boolean or int
<lyxia>
freechips: you can have value as a subtype of expr with polymorphic variants. type value = [`Int of int | `Bool of bool];; type expr = [value | `Var of string | `Plus of expr * expr];;
<lyxia>
There should probably be some > or < in here.
jbrown has quit [Ping timeout: 255 seconds]
<freechips>
http://ix.io/1SLt this is more or less how i would like for it to be
<freechips>
even though i plan to add dynamic typing in the future (but not yet)
<freechips>
(im not sure if that makes things easier)
<freechips>
also like i said i would like for the output to be pure, like "4" and not "Int 4" and definitely not "EInt 4". but to do that i would have to have a type value = int|bool|... which is not possible because of ocaml static typing
<freechips>
lyxia: Int x = Val (EInt x) is very interesting!!
<freechips>
well at least it solves the fact that expr is redundant if i have a 2-type system. but that still leaves me with a 2-type system: Int and EInt....
<lyxia>
freechips: you can use GADTs to have a more flexible typing of expressions. This allows you to have a type 'a expr of expressions of type 'a, and a type-safe way of writing an interpreter 'a expr -> 'a.
<lyxia>
The downside is that the allowed types become rather limited.
<lyxia>
freechips: what did you mean "that still leaves me with a 2-type system: Int and EInt"? Isn't the point is that using a Val constructor, you don't need Int?
<freechips>
lyxia: i checked Generalized Algebraic Datatypes and they seem a little daunting to an ocaml novice. Ill try maybe, but i guess for now im stuck with this 2type system?
<freechips>
also i cant get let Int x = Val(EInt(x)) to work
<thizanne>
freechips: you cant because Int starts with an uppercae
<freechips>
damn but if i do let int x that means i can't have a user type Int 4?
jbrown has joined #ocaml
<freechips>
maybe im better off just putting all my data types inside expr...
<thizanne>
identifiers starting with an uppercase letter are reserved for constructors and module [types]
<freechips>
maybe when i make an interpreter with dynamic typing it'll be easier?
<thizanne>
so you can do `let int x = Val (EInt x)`
<lyxia>
the user will type int 4 instead
<freechips>
hmmm
<freechips>
alright very interesting it works. if i pass "int 4" i get as a result "EInt 4"
Denommus has quit [Ping timeout: 255 seconds]
<freechips>
so i guess its not possible to have "Int 4" -> "Int 4" without generalized datatypes?
<freechips>
what about maybe "Int 4" -> "4"?
<freechips>
*not "Int 4" but "int" since i don't want to put my types in expr. i like to keep it clean.
<freechips>
id still like for the input type and the output (internal) type to have the same name (not upper+lowercase like now) or to just have the output with no name at all. but to have no name at all id need type value = int|bool
etc has joined #ocaml
<etc>
Hi! I've noticed that when I compile a file with `ocamlc -a mylib.cma myfile.ml -o myfile.cma` and then include that library with another file like `ocamlc myfile.cma executable.ml`, I end up with the Mylib module exposed directly to executable.ml. Is there a way to compile this dependency such that it's only available to myfile.ml?
sz0 has quit [Quit: Connection closed for inactivity]
morfeen has joined #ocaml
<freechips>
ok so maybe i get it. if i want "Int 4" (expression)=>"Int 4" (value) i need polymorphic variants. if i want "Int 4" -> "4" i need GenericAlgebraicDatatypes. if i want dynamic typing who knows not of concern right now
<freechips>
input -> output
AltGr has left #ocaml [#ocaml]
morfeen has quit [Ping timeout: 276 seconds]
<freechips>
maybe for dynamic typing i would also need for value to be polymorphic...
noddy has quit [Ping timeout: 240 seconds]
<thizanne>
what are you actually trying to do ?
<freechips>
well im trying to write the most basic form of an interpreter by myself since our teacher has given us basically nothing to work on
<freechips>
so id like to have an interpreter with a single static scope for now
<freechips>
and it's a functional kind of language so everything is a single expression i guess
<freechips>
so the interpreter is like this: let interpreter expression static_environment = ....
<freechips>
ive learned that ocaml can provide me with a parser by using the type constructor. So if i pass as an expression Int 4 then i will be able to manipulate it as if my language had a type system
<freechips>
and of course the interpreter is like this: expression -> (variable_name -> value) -> value
kakadu has quit [Remote host closed the connection]
<freechips>
so the body of the interpreter should just match the expression constructors thus giving me a type for my language. also expressions can be operations on types or just variables
<freechips>
also im so sorry if im flooding ur chat
<freechips>
http://ix.io/1SLJ this is self-explanatory of everything im doing. it's working like this now
<freechips>
companion_cube: that is very interesting...also kinda difficult for me XD. but i like it a lot. there is one issue...i've now basically lost the ability to have an "Add" function in my language that can add up both integers and float. i had that previously, i just needed to type match the output of eval
<freechips>
and i would output a value type right back.
<companion_cube>
you could have `Add : 'a expr * 'a expr -> 'a expr`
<freechips>
but i guess this is the only way to have something like this "Int 4 -> 4" work
<companion_cube>
but there is no way of restricting it to int/float
<freechips>
i see
<freechips>
could i apply the restriction inside the implementation of eval?
<companion_cube>
or: `type 'a add_marker = Add_int : int add_marker | Add_float : float add_marker`
<freechips>
like with a matching
<companion_cube>
Add : 'a add_marker * 'a expr * 'a expr -> 'a expr
<freechips>
hmm
<companion_cube>
no, cannot match on types
<freechips>
thats clever
<companion_cube>
but then you don't gain much compared to just having Add_int | Add_float :-)
<freechips>
right
<freechips>
i think i might just play it safe and keep to the value type
<freechips>
but your implementation is next level stuff. i just dont have the ocaml knowledge to maintain it
<freechips>
(when i make changes in the future and complicate the interpreter)
<companion_cube>
keep it in the back of your mind so you can come back to it if you want to :-)
<freechips>
i also am kind of scared about the polymorphic variant i was given earlier to have value be a subtype of expr, but it looked like just what i was looking for..
<freechips>
companion_cube: i definitely will. i plan to actually keep using ocaml after im done with this assignment
<companion_cube>
nice!
orbifx has joined #ocaml
hunteriam has quit [Quit: Connection closed for inactivity]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
jbrown has quit [Ping timeout: 255 seconds]
jbrown has joined #ocaml
<chindy>
are there some nice python based tutorials on Monads?
<pigeonv>
maybe have a look at P. Wadler's article about it