ChanServ changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.02.1 announcement at http://ocaml.org/releases/4.02.html | Public channel logs at http://irclog.whitequark.org/ocaml
<Drup> link ?
<Drup> Algebr: it doesn't seem to be possible
<dmbaturin> hiptobecubic: No, it teaches you ocaml like it's python.
<Drup> how does that work , :D
TheLemonMan has quit [Quit: Lost terminal]
<dmbaturin> Because it's one to one translation of the python book (which worked for the java book, but won't work for a language built upon very different principles).
<hiptobecubic> i suspected as much
<hiptobecubic> so real world ocaml then?
Guest54001 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<hiptobecubic> and is real world ocaml sufficiently up to date? real world haskell is feeling its age a bit
<Drup> Algebr: yeah, it seems you can't change these parameters, they are purely terminal-dependent
<Drup> real world ocaml is up to date, yes
<hiptobecubic> thanks
<Algebr> bummer
<Drup> yeah :(
travisbrady has quit [Quit: travisbrady]
<dmbaturin> hiptobecubic: http://files.metaprl.org/doc/ocaml-book.pdf is quite good.
<Drup> (I got again the "alien exits by the right" thing, I think you have an issue with collision detection)
<hiptobecubic> are any of you using ocaml for paid work other than potentially at jane street?
<Algebr> Drup: probably right, will look
<companion_cube> some do, often in academia
ptc has joined #ocaml
<whitequark> hiptobecubic: yes
<whitequark> outside academia, too
ptc is now known as Guest64425
<hiptobecubic> surely some people are outside academia. academia kind of doesn't count, you have a lot of freedom to choose your tools there :)
<dmbaturin> As a potentially controversial note, I'm going to suggest that Harper's "Programming in StandardML" should be translated to ocaml. :)
<Drup> I'm not sure he would agree :D
<Drup> (and transforming SML code to OCaml is mostly a matter of sed)
<dmbaturin> Well, more of get an ocaml version. I'm not saying the SML version should not exist.
rgrinberg has joined #ocaml
<Drup> hum, nevermind, I mixed Harper with Harop
segmond has joined #ocaml
<hiptobecubic> Harop like that jerk wad that writes the flying frog blog? Hopefully not?
<Drup> ahah
<Drup> that why I said he wouldn't agree =')
<Drup> but forget it, just brain stroke
<hiptobecubic> have to head out, thanks for the book references
<hiptobecubic> I'm sure you'll see me again someday!
rgrinberg has quit [Ping timeout: 245 seconds]
<dmbaturin> hiptobecubic: Hold on. I'm trying to find another book I liked.
hiptobecubic has quit [Ping timeout: 250 seconds]
<Algebr> that awesome-ocaml github repo is a good resource
swgillespie has joined #ocaml
<dmbaturin> That was Harrison, "Introduction to Functional Programming", but he left and can't see it.
<apache2> if you can find an ebook, "an introduction to functional programming through lambda calculus" ?
travisbrady has joined #ocaml
segmond has quit [Ping timeout: 255 seconds]
AltGr has joined #ocaml
claudiuc has quit [Remote host closed the connection]
claudiuc has joined #ocaml
madroach has quit [Ping timeout: 264 seconds]
segmond has joined #ocaml
madroach has joined #ocaml
yminsky has joined #ocaml
nullcat has quit [Read error: Connection reset by peer]
lordkryss has quit [Quit: Connection closed for inactivity]
travisbrady has quit [Quit: travisbrady]
rgrinberg has joined #ocaml
segmond has quit [Ping timeout: 264 seconds]
ghostpl_ has joined #ocaml
rgrinberg has quit [Ping timeout: 245 seconds]
ghostpl_ has quit [Ping timeout: 250 seconds]
Algebr has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
yminsky has quit [Quit: yminsky]
segmond has joined #ocaml
vanila has quit [Quit: Leaving]
travisbrady has joined #ocaml
segmond has quit [Ping timeout: 272 seconds]
shinnya has quit [Ping timeout: 250 seconds]
yminsky has joined #ocaml
Guest90965 has joined #ocaml
dav_ has quit [Ping timeout: 246 seconds]
[boxed-pyon] has quit [Quit: I'm sorry but... I don't have any interest in three-dimensional girls.]
pyon has joined #ocaml
segmond has joined #ocaml
segmond has quit [Ping timeout: 256 seconds]
darkf has joined #ocaml
segmond has joined #ocaml
_5kg has joined #ocaml
travisbrady has quit [Quit: travisbrady]
BitPuffin has quit [Ping timeout: 245 seconds]
hiptobecubic has joined #ocaml
<hiptobecubic> # ["OCaml", "Perl", "C"];;
<hiptobecubic> - : (string * string * string) list = [("OCaml", "Perl", "C")]
<hiptobecubic> egad!
<nicoo> hiptobecubic: You want semi-colons
<nicoo> # ["OCaml"; "Perl"; "C"];;
<nicoo> - : string list = ["OCaml"; "Perl"; "C"]
<hiptobecubic> Yes, it would seem. I was just gasping at the thought of how often this is going to happen to me
<nicoo> Why?
<hiptobecubic> because every other language i've ever used separates sequence elements with commas when constructing them as literals
<hiptobecubic> except lisp i guess
<nicoo> ^^
rgrinberg has quit [Ping timeout: 264 seconds]
yminsky has quit [Quit: yminsky]
<hiptobecubic> why does one need to specify rec when defining a recursive function? Is the compiler unable to figure something out otherwise?
rgrinberg has joined #ocaml
segmond has quit [Ping timeout: 256 seconds]
<tokenrove> every time i start using ocaml after a delay, i make the semicolon/comma mistake in lists a few times, but it goes away pretty quickly. i used to consider it a wart, but it is handy being able to say [Foo, Bar; Baz, Quux]
<tokenrove> hiptobecubic: as for rec, it's nice to be able to built on top of an existing name. an example of a common pattern i just dealt with recently: http://erratique.ch/repos/tsdl/tree/src/tsdl.ml#n400
Guest64425 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<hiptobecubic> tokenrove, to me that syntax feels like it should define a 2d array
<nicoo> hiptobecubic: It's more a shadowing issue
<nicoo> let f x = x
<nicoo> let f x = f x +1
_whitelogger has joined #ocaml
myst has quit [Ping timeout: 265 seconds]
<tokenrove> that's right, 1D vectors and a shape operator were enough for APL...
ygrek has joined #ocaml
segmond has quit [Ping timeout: 264 seconds]
<hiptobecubic> nicoo, because they use them frequently?
_5kg has quit [Ping timeout: 256 seconds]
_5kg has joined #ocaml
segmond has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
segmond has quit [Ping timeout: 252 seconds]
maufred has quit [Ping timeout: 264 seconds]
_5kg has quit [Ping timeout: 264 seconds]
badkins has quit [Remote host closed the connection]
swgillespie has joined #ocaml
ptc has joined #ocaml
yminsky has joined #ocaml
ptc is now known as Guest57424
segmond has joined #ocaml
maufred has joined #ocaml
nullcat has joined #ocaml
pyon is now known as [boxed-pyon]
gasche has quit [Ping timeout: 250 seconds]
MrScout has quit [Ping timeout: 250 seconds]
gasche has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
segmond has quit [Ping timeout: 256 seconds]
segmond has joined #ocaml
segmond has quit [Max SendQ exceeded]
segmond has joined #ocaml
Guest57424 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
_5kg has joined #ocaml
maufred has quit [Ping timeout: 240 seconds]
yminsky has quit [Quit: yminsky]
maufred has joined #ocaml
segmond has quit [Ping timeout: 245 seconds]
ggole has joined #ocaml
WraithM has joined #ocaml
segmond has joined #ocaml
_5kg has quit [Ping timeout: 250 seconds]
ygrek has quit [Ping timeout: 240 seconds]
swgillespie has joined #ocaml
segmond has quit [Ping timeout: 246 seconds]
hiptobecubic has quit [Ping timeout: 256 seconds]
MrScout has joined #ocaml
struktured has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
swgillespie has joined #ocaml
segmond has joined #ocaml
badkins has joined #ocaml
segmond has quit [Ping timeout: 272 seconds]
badkins has quit [Ping timeout: 264 seconds]
ptc has joined #ocaml
ptc is now known as Guest25186
_5kg has joined #ocaml
Guest25186 has quit [Ping timeout: 246 seconds]
segmond has joined #ocaml
ptc_ has joined #ocaml
mcc has joined #ocaml
<mcc> Hello I am having an interesting situation where Merlin and ocaml cmdline behave differently and whitequark said a good thing to do would be ask about it in here
_5kg has quit [Ping timeout: 244 seconds]
<mcc> Here is some code (I am not the original author): https://gist.github.com/mcclure/ddcc1c99e741d0a67c06
<mcc> I have a comment affixed noting an error and also a warning which Merlin emits when analyzing this file
<mcc> However, ocaml just runs it. It prints "test". No errors, no warnings.
<mcc> is this surprising? should i do something about it?
<ggole> Hmm, I'm not seeing this
_5kg has joined #ocaml
<mcc> you are not seeing this in merlin?
<ggole> No
<ggole> Which version of merlin do you have?
<mcc> opam info merlin prints version 2.1.0, upstream-checksum 37a9bac836e3af270e61ac05b7e8256b
<mcc> opam upgrade says it is the most recent version
<mcc> wait, i did not opam update
<ggole> I have a version built from the repo at a random point a while ago, so many I shouldn't be comparing our installations...
<mcc> after an update it offers a merlin 2.1.1, i will see if this changes anything
<ggole> If not I'll see if I can reproduce it
<mcc> nope, 2.1.1 changes nothing
<ggole> OK, I'll see how the opam version behaves
<mcc> i also have another question, it is along the general lines of "i do not friggin understand gadts"
<ggole> That's perfectly normal :)
<ggole> Took me a lot of head-scratching to (mostly) understand them, they are a bit of a subtle topic
<mcc> i think my problem is i want to use them for ONE THING but they seem a little all or nothign
<ggole> Do you find yourself wanting to have an 'any value' which can be either type?
<mcc> right now i am just trying to understand the basic syntax.
<mcc> i added what seemed like one extra line, and suddenly ocaml treated it differently in a way which does not seem to follow.
<ggole> Ah, now I see your merlin error... hmm.
<mcc> There is an explanation in the comment
<mcc> The reason i am testing with this one thing: I have this one large sum type "value" here https://bitbucket.org/runhello/emily/src/unstable/src/value.ml and two of the items, Tablevalue and Objectvalue, I want to be able to have a method which takes only a value which matches TableValue or ObjectValue
_5kg has quit [Ping timeout: 252 seconds]
<mcc> I would like the type checker to know that only a TableValue or ObjectValue is welcome for that function, and therefore not require me to cover the other match types when I match
<ggole> Sec, I'm just farting around with merlin
<mcc> it seems like GADT can do *something* like that (cf the string example in the gist) but it seems to get upset when like… some of the component values in the sum types are GADT-style, and some are not
<mcc> oh, sure, sry
<mcc> let's say merlin is more important :)
<ggole> Sure looks like a bug in merlin
<ggole> So, gadts: the branch of the GADT which doesn't have an annotation is given an argument of 'a, (I think) existentially qualified
<ggole> That means that a Broken is not a stringvalue value, which is why you get that error message
<dmbaturin> mcc: Maybe make Brokn a unit value?
<dmbaturin> (I don't know what semantics you want it to have of course, I just checked that it does make the warning go away :)
<ggole> No, I mistyped that: Broken *can* be a stringvalue value
<ggole> So when you are matching against things that are strings, you have to handle Brokens (which can be strings)
ptc_ has quit [Ping timeout: 264 seconds]
<ggole> mcc: hmm, now that I think about it the warning message is quite misleading
<ggole> It suggests that the match should include things that it cannot given the typing
kapil___ has quit [Quit: Connection closed for inactivity]
mcc has quit [Quit: This computer has gone to sleep]
struktured has quit [Ping timeout: 256 seconds]
_5kg has joined #ocaml
MercurialAlchemi has joined #ocaml
_5kg has quit [Ping timeout: 240 seconds]
tnguyen has joined #ocaml
_5kg has joined #ocaml
MercurialAlchemi has quit [Remote host closed the connection]
MercurialAlchemi has joined #ocaml
laughing-octo-sh has joined #ocaml
Nahra has joined #ocaml
_5kg has quit [Ping timeout: 252 seconds]
<def`> ggole: merlin is broken
<def`> minor release today :|
reem has joined #ocaml
<def`> (only gadts)
marynate has joined #ocaml
laughing-octo-sh has quit [Ping timeout: 256 seconds]
johnf has quit [Ping timeout: 264 seconds]
<adrien> bad def`! spank spank!
<MercurialAlchemi> must be Niviane's fault
tane has joined #ocaml
marynate has quit [Quit: Leaving]
<def`> :-)
<ggole> def`: righto
<ggole> I sent a report about the exhaustiveness message thing, too
<ggole> So it should all get cleared up sooner or later
<def`> what's the problem?
segmond has quit [Ping timeout: 246 seconds]
reem has quit [Remote host closed the connection]
mort___ has joined #ocaml
<def`> ggole: ok (you effectively have to add Any : _ value to get the correct error message)
<ggole> Oh, hmm
<ggole> Now I see why I've never run into this before
<ggole> mcc has a talent for ferreting out these corner cases...
segmond has joined #ocaml
<ggole> def`: actually, it's still a bit shonky
<ggole> The error message suggests only Float _, but that's not the only legal message (nor is there any reason to think that the type should be float value)
<ggole> Er, legal pattern
<ggole> And if you reorder the constructors in the type, the message changes
<def`> "Here is an example of a value that is not matched:"
<def`> It's fine by this error message :)
<ggole> Hrm
<def`> conveniently vague :D
<ggole> Yeah, I guess that's defensible
MrScout has quit [Remote host closed the connection]
<ggole> So I'm sticking with "a bit shonky" :)
<def`> I don't see the problem ?
<ggole> It suggests String _, which will not type check.
<def`> It will
<ggole> It doesn't?
Haudegen has quit [Ping timeout: 256 seconds]
<ggole> Let me double check
<def`> You require the function to be polymorphic, string is a particularly good instance of 'a
<ggole> If I add a String _ -> () case, it fails to compile as expected.
<def`> Yep, you have to add all the (type a) machinery
<ggole> And String _ is *not* a polymorphic constructor, it has type string value
_5kg has joined #ocaml
<def`> Yes. But your function is polymorphic (look at it from the outside, given its type you can pass a value constructed from String)
<ggole> Er, no you can't?
<def`> it is polymorphic, so it has to handle the specific case where 'a is instantiated to string (and where the value can be constructed from either Any or String)
<ggole> String _ is not of type 'a . 'a value
<def`> 'a . 'a value is different from 'a . 'a value -> unit
<def`> Completely unrelated
Simn has joined #ocaml
<ggole> Completely incompatible, you mean
mort___ has quit [Quit: Leaving.]
<def`> val print_string_value : 'a value -> unit = <fun>
<def`> val hello : bytes value = String "hello"
<def`> I expected (print_string_value hello) to succeed
<ggole> ...
Haudegen has joined #ocaml
<ggole> That's true, but is quite beside the point
<def`> No it's not?!
<ggole> In the *implementation* of print_string_value, you can't add a String _ case
<ggole> And yet the message tells you to do exactly that!
<def`> Because you didn't provide enough type information.
<def`> The message tells you that you should handle it. It's up to you to provide the type information so that you both handle it and make it typecheck :P
<def`> (But the message could be better I agree)
<def`> And if we make the quantifier explicit, you wrote forall a, (a value -> unit)
<def`> not (forall a. a value) -> unit
<def`> (in which case, String _ wouldn't be possible, but at the same time this would be second rank polymorphism and you are no longer in OCaml :))
ned- has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<ggole> Hmm, lemme think about this a bit more
reem has joined #ocaml
<ggole> Oh, I see
<ggole> OK. You are correct.
<def`> :)
ontologiae_ has joined #ocaml
ned has quit [Ping timeout: 244 seconds]
carm has quit [Ping timeout: 250 seconds]
reem has quit [Remote host closed the connection]
octachron has joined #ocaml
carm has joined #ocaml
reem has joined #ocaml
nullcat has quit [Ping timeout: 255 seconds]
reem has quit [Remote host closed the connection]
mort___ has joined #ocaml
_5kg has quit [Ping timeout: 264 seconds]
nullcat has joined #ocaml
Submarine has quit [Quit: Leaving]
reem has joined #ocaml
_5kg has joined #ocaml
reem has quit [Remote host closed the connection]
dsheets_ has quit [Ping timeout: 245 seconds]
ontologiae_ has quit [Ping timeout: 252 seconds]
ebzzry_ has quit [Remote host closed the connection]
etehtsea has joined #ocaml
etehtsea has quit [Max SendQ exceeded]
mort___ has quit [Quit: Leaving.]
MooseAndCaml has joined #ocaml
<MooseAndCaml> Hi, I've been hacking away at a function all night an making no progress. If I comment out the third to last line it compiles - https://gist.github.com/caseybasichis/935ca5f3f36a19fecebd
_5kg has quit [Ping timeout: 256 seconds]
reem has joined #ocaml
<MercurialAlchemi> at a guess, you forgot to apply a parameter somewhere and you're using curried functions instead of their result
<MercurialAlchemi> add some type annotations to get a better idea of where you problem is located
<MercurialAlchemi> alternatively, if you use merlin, :TypeOf is your friend
<MercurialAlchemi> and if you don't user merlin, you should
<MooseAndCaml> i do use merlin though I haven't seen :TypeOf
reem has quit [Remote host closed the connection]
<MercurialAlchemi> you'll love :Errors, too
<MooseAndCaml> that is useful... it tells me that the type is an int - which I can't see. I think I'm returning acc which is a list
avsm has joined #ocaml
<MercurialAlchemi> you probably want to add more types and/or use records, though
<MercurialAlchemi> manipulating several values of the same type which mean different things is never a good idea
<MooseAndCaml> I quite know how you mean. what in particular pops out at you?
ned- has quit [Ping timeout: 244 seconds]
<MercurialAlchemi> you seem to have a fair amount of tuples
reem has joined #ocaml
<MooseAndCaml> oh yeah. I've been in a hell for the last four days of converting code making heavy use of tuples to records... it's been insanely frustrating
dav has joined #ocaml
rgrinberg has quit [Ping timeout: 245 seconds]
<MooseAndCaml> I can see that records are far more flexible when adding new values and structure
<MercurialAlchemi> you don't need to pattern match everything when you need a single value
Guest90965 has quit [Ping timeout: 264 seconds]
<MercurialAlchemi> and it's much easier to tell what is what
<MercurialAlchemi> another thing
<MercurialAlchemi> if you want to pattern match a list with a single element, I suggest to do | [x] -> ... rather than | x::[] -> ...
<MooseAndCaml> the second one makes sense, what do you mean by the first?
<MercurialAlchemi> they're equivalent
<MercurialAlchemi> the first one is more idiomatic
<MercurialAlchemi> eg
<MooseAndCaml> I mean, what does "you don't need to pattern match everything when you need a single value" refer to?
<MercurialAlchemi> oh
<MercurialAlchemi> I mean records let you do: 'let foo = record.foo' as opposed to 'pattern match to get the third value'
matason has joined #ocaml
<MooseAndCaml> oh, yes, exactly. I'm going to start rewriting without any tuples. Is there any reason why :TypeOf on tspcuts is just int? I'm hoping it will be resolved when rewriting but I don't at all understand why it doesn't work as all the other types seem correct
<octachron> another nice thing with record is field punning, if you only need the field foo, you can pattern match with just {foo;_ }
<MercurialAlchemi> MooseAndCaml: I don't know, don't you do use tspcuts as an int later in your code ?
reem has quit [Remote host closed the connection]
ghostpl_ has joined #ocaml
<MercurialAlchemi> otherwise, no, looks like it should be a list
<octachron> MooseAndCaml: You should try to add parenthesis around (-1)
<octachron> or use the unary minus ~-
<octachron> if I am not mistaken, grp 0 -1 is interpreted as (grp 0) - 1
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
reem has joined #ocaml
avsm has quit [Client Quit]
<MooseAndCaml> yep... that was it.. I keep getting burned - spending hours on problems like that
_5kg has joined #ocaml
<MercurialAlchemi> good catch
dsheets_ has joined #ocaml
reem_ has joined #ocaml
arj has joined #ocaml
reem has quit [Ping timeout: 265 seconds]
<MooseAndCaml> thank you for the help. I would have been at it all night
<MooseAndCaml> or all night and all morning anyway
reem_ has quit [Remote host closed the connection]
reem has joined #ocaml
reem has quit [Remote host closed the connection]
wwilly has joined #ocaml
nullcat has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
reem has joined #ocaml
zpe has joined #ocaml
rgrinberg has quit [Ping timeout: 256 seconds]
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
<AltGr> The manual you have been waiting for: https://github.com/OCamlPro/opam/blob/new-manual/doc/pages/Manual.md
<AltGr> (there will be an index of sections when it's published to opam.ocaml.org/doc)
avsm has joined #ocaml
reem has quit [Remote host closed the connection]
reem has joined #ocaml
<dsheets_> AltGr, nice work! Looks very useful!
<MercurialAlchemi> AltGr: there is a \end{itemize} which probably shouldn't be there
mort___ has joined #ocaml
ia0 has quit [Quit: leaving]
<AltGr> hu, probably not :)
<AltGr> the formatting may need some more work too
<AltGr> (btw, markdown ASCII tables aren't supported by omd are they ?)
TheLemonMan has joined #ocaml
ia0 has joined #ocaml
mort___ has left #ocaml [#ocaml]
avsm has quit [Quit: Leaving.]
<MercurialAlchemi> no idea
avsm has joined #ocaml
<MercurialAlchemi> (I can't really advise using markdown in any case)
avsm1 has joined #ocaml
avsm has quit [Read error: Connection reset by peer]
avsm1 has quit [Client Quit]
<Drup> AltGr: can we put a link somewhere on http://opam.ocaml.org/doc/Usage.html ?
<Drup> (in the "Documentation" dropdown, for example.
<AltGr> It will get there once the PR is merged and the midnight server update run.
<Drup> cool
reem has quit [Remote host closed the connection]
reem has joined #ocaml
yomimono has joined #ocaml
freling has joined #ocaml
<ousado> hi all. I have a compund accumulator with nested records, and I'd like to avoid nested with expressions like e.g. { acc with some_field = { acc.some_field with other_field = 123 }} - are there any established techniques/tricks/conventions how to do that?
MooseAndCaml has quit [Ping timeout: 246 seconds]
<companion_cube> well, lenses, basically (see for instance fieldslib for generating them)
<ousado> alright, thanks
<ousado> though I'm not sure I'll be allowed to add that dependency
<companion_cube> you can also define them by hand when needed
<ousado> yes, I think I'll do that - it's not that many fields in the outer record
<ousado> it just impedes readability
<ousado> (the nested withs, I mean)
swistak35 has joined #ocaml
<companion_cube> you might want to define functions update_some_field : outer_record -> f:(some_field -> some_field) -> outer_record
<companion_cube> kind of "map" functions for every field
<ousado> yes, I've toyed around with some options and wasn't too happy, but I guess there's no good way around that without code generation
reem has quit [Remote host closed the connection]
<ousado> if only ocamls and haxes feature sets would be merged :)
reem has joined #ocaml
swistak35 has quit [Quit: ZNC - http://znc.in]
swistak35 has joined #ocaml
tane has quit [Quit: Verlassend]
larhat has joined #ocaml
Haudegen has quit [Ping timeout: 252 seconds]
ygrek has joined #ocaml
Haudegen has joined #ocaml
<def`> ousado: which features of haxe are you thinking about?
<Drup> the metaprog story is much better in rust land
<ousado> def`: mainly metaprogramming
<Drup> haxe land*
<ousado> ..yes
<Drup> mostly because the architecture of the compiler is not as .. old, as the ocaml one
<ousado> easy access to the typed AST is a never ending source of joy :)
<def`> interesting
<ousado> also, abstracts
<Drup> def`: they already have the whole "type this expression, give me typedast", do things with it, untype it, type it again.
<MercurialAlchemi> abstracts?
<ousado> I have two solutions to the above issue one using abstracts and one generating lenses
<ousado> .. sec
<def`> Drup: are there any projects heading to that direction in ocaml?
<Drup> def`: me, on my free time ?
<def`> I don't know.
<Drup> well, you do know
<Drup> :D
<Drup> now*
<def`> :)
<Drup> def`: that's why I would like the merlin patches applied in ocaml
<Drup> that's also why I did the untypeast thing
reem has quit [Remote host closed the connection]
<ousado> here - it's not really pretty, but it shows two ways to deal with the above issue: https://gist.github.com/ousado/057b28157ed8a4330fed
<ousado> urgh, and the indentation is messed up
<ousado> in line 161 the abstract is used
<ousado> in line 147 the macro
<ousado> abstracts wrap other types and allow to define implicit conversions from and to other types
<ousado> they're compile-time only
<def`> like… types :D
<ousado> yes :)
<MercurialAlchemi> hmm, implicit conversions
<MercurialAlchemi> this can end up being fairly magical
<ousado> sure
<MercurialAlchemi> at least it's magic at compile-time, but still
Submarine has joined #ocaml
Submarine has joined #ocaml
<ousado> what I mean by compile-time only is that there's no physical wrapper at runtime, so you can make e.g. an abstract(Int) that doesn't unify with other integers, but still have a raw integer at runtime
waneck_ has quit [Remote host closed the connection]
ygrek has quit [Remote host closed the connection]
<companion_cube> kind of like private aliases in OCaml!
ygrek has joined #ocaml
gargaml has joined #ocaml
paradoja has joined #ocaml
rgrinberg has joined #ocaml
<ousado> I didn't know about them
<ousado> yes, looks quite close
<ousado> ".. declares a type that is distinct from its implementation type typexpr. However, coercions from the type to typexpr are permitted. .. "
ygrek has quit [Ping timeout: 246 seconds]
rgrinberg has quit [Ping timeout: 265 seconds]
tane has joined #ocaml
_andre has joined #ocaml
matason has quit [Quit: leaving]
matason has joined #ocaml
matason has quit [Quit: leaving]
matason has joined #ocaml
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
johnelse has quit [Ping timeout: 245 seconds]
<ousado> hm, merlin gives me a u'TODO'
<Drup> ousado: they are permited, but no implicit.
<Drup> and it's one way only
<ousado> really? the example has both of_int and to_int ?
<Drup> that's because the programmer provided them, private aliases don't change anything about that
<ousado> hm, then I don't understand something
badkins has joined #ocaml
rgrinberg has joined #ocaml
<ousado> doesn't the programmer always have to provide the coercion?
<ousado> and if , where is the difference between the two directions?
<ggole> Hmm? Isn't there only one direction for casts?
badkins has quit [Ping timeout: 256 seconds]
rgrinberg has quit [Ping timeout: 264 seconds]
yminsky has joined #ocaml
<def`> ousado: fixed in master, release planed today
<ousado> def`: what is?
yminsky has quit [Quit: yminsky]
<def`> ousado: your u'TODO'
<ousado> ah nice, what is it about?
<def`> wrong handling of malformed types
<def`> likely (a, b) instead of (a * b)
<ousado> ahh, right
yminsky has joined #ocaml
Submarine has quit [Remote host closed the connection]
yminsky has quit [Quit: yminsky]
<ousado> oh, I see.. the explicit coercion is via type annotation
<ousado> oh man merlin rocks the boat
<companion_cube> oh yeah
<def`> :D
<Drup> (but the current merlin logo is awesome enough, if not advertise as much as it should)
<Drup> advertised*
<MercurialAlchemi> this wikipedia article must have been written by one of their Russian fans :)
<Drup> ahah, I didn't actually read the article
<Drup> "This article's tone or style may not reflect the encyclopedic tone used on Wikipedia."
<tane> yeah.. "the drummer they dreamt of" :)
Haudegen has quit [Ping timeout: 246 seconds]
<def`> :D
<MercurialAlchemi> and the English is a bit awkward
<def`> hmm, merlin is not spotify
<def`> is not on* spotify
<MercurialAlchemi> the first version is also correct
<def`> yeah, but does not bring much information :)
ned- has joined #ocaml
freling has quit [Quit: Leaving.]
<MercurialAlchemi> :)
Haudegen has joined #ocaml
martintrojer has quit [Max SendQ exceeded]
johnelse has joined #ocaml
johnelse is now known as Guest41055
martintrojer has joined #ocaml
martintrojer has quit [Max SendQ exceeded]
martintrojer has joined #ocaml
martintrojer has quit [Max SendQ exceeded]
martintrojer has joined #ocaml
BitPuffin has joined #ocaml
cthuluh has quit [Ping timeout: 272 seconds]
cthuluh has joined #ocaml
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 255 seconds]
<TheLemonMan> damn it, RWO doesn't load at all due to a SSL error :<
<dsheets_> TheLemonMan, i think it's offline
AltGr has left #ocaml [#ocaml]
<dsheets_> hmm nevermind
`eeks has joined #ocaml
Guest41055 is now known as johnelse
<tokenrove> heh, i have Merlin's Brutal Constructor on CD. with album titles like "Brutal Constructor", clearly they should become a band about parsing OCaml source.
jbrown has quit [Remote host closed the connection]
shinnya has joined #ocaml
<MercurialAlchemi> indeed
<Drup> featuring the songs "Unto The Functor" "Destructuring The GADT" and "High Order Reification" :D
badkins has joined #ocaml
<Drup> (unfortunately, merlin doesn't seem to use death metal english)
<MercurialAlchemi> I'm looking forward to the next OCaml presentation
<MercurialAlchemi> with electric guitars and loud vocals
<companion_cube> well, :Destruct definitely is in the vein of death metal
<Drup> you can turn any technical term in death metal english, it's ridiculously easy :D
Algebr has joined #ocaml
badkins_ has joined #ocaml
badkins has quit [Ping timeout: 240 seconds]
ghostpl_ has quit [Remote host closed the connection]
<Algebr> What am I missing here.... Array.init some_int (fun i -> Random.int i). I keep getting Invalid_argument "Random.int", I did Random.self_init () previously.
<ned-> Drup for a second i thought those were names of papers, and i was going to ask for links to the pdfs haha
<Drup> ned-: succes ! \o/
<ggole> Algebr: Random.int 0 fails
rgrinberg has joined #ocaml
<ggole> Try i + 1
<Algebr> ah, its the 0
<ggole> Or if you just want some bits, Random.bits
<Algebr> Instead of having to do module Array = Batteries.Array and whatnot, is there some shortcut for replacing all the standard libaries with batteries?
<thizanne> open Batteries
<Drup> Algebr: you don't like BatArray ?
<companion_cube> enjoy the large pervasives
<Drup> *suddenly BatMap*
<companion_cube> suddenly BatInnerWeakTbl
<companion_cube> :(
<Drup> different kind of suddenly :(
rgrinberg has quit [Ping timeout: 256 seconds]
travisbrady has joined #ocaml
<Algebr> Is it anything bad to call Random.self_init repeatedly?
<adrien_znc> why do it?
<Algebr> in making a self contained function that produces an array of random ints
<flux> ..and?
<flux> I think you should expect the caller to initialize Random once and for all, if your purpose is not to regenerate same sequences
<Drup> companion_cube: what I had in mind for Result.t was that you could put it in a signature, without implicating any external library and without having the silly "Pervasive_result.t"
<companion_cube> but then you need to claim a part of the namespace for it
<Drup> nobody else is going to claim Result, ever
<Drup> (is this an argument that we should have real namespaces)
<companion_cube> I don't know
<companion_cube> it would be cool, but so many things would
<Drup> in this case, I really don't want to have things like "Pvem.t" or "CCError.t" in an interface, it forces people to know what this is. "Result.t" would be something standard, hence better
<Drup> and "Pervasive_Result.t" ... ~_~
JuggleTux has quit [Ping timeout: 255 seconds]
<TheLemonMan> woah, the compiler doesn't like utf8 symbols as function names
<Drup> nope, no utf8.
<flux> ocaml 4.0 would have been such a grand version increment to allow them.. ;-)
<Drup> flux: so many other issues ...
JuggleTux has joined #ocaml
<ousado> I don't like reading code with symbols I don't have a name for
<flux> but it could have broken backwards compatiblity (albeit in a minor way I think)
<ousado> like in scalaz
keen__________75 has quit [Read error: Connection reset by peer]
<flux> ousado, but who wouldn't like to have snowmen in their code?!
<ousado> heh
<TheLemonMan> to be honest (→) looks better than (|>)
keen__________75 has joined #ocaml
<flux> nah, it should replace -> instad
<flux> but of course, that's not an operator
<Drup> and you can perfectly do that at the editor level
<flux> and that's something editors could just choose to visualize ;)
<Drup> (broken in emacs, unfortunatly)
<TheLemonMan> (and vim)
<tane> vim with solarized replaced -> by → and . by the right symbol for function composition
<tane> in haskell though
<tane> :)
<ggole> Eh, after ten minutes you see the ascii as one thing anyway
<MercurialAlchemi> tane: uh, what does solarized has to do with anything?
<tane> MercurialAlchemi, that's a good question. still only using this exact colorscheme yields that behaviour for me
<tane> oh no, it doesn't
<flux> ggole, but it will still keep amazing people who visit your workstation!
<MercurialAlchemi> tane: uhm, I don't think so
<flux> for hours!
<tane> my mistake, solarized just colored it correctly :)
<Drup> yeah, nothing to do with the theme, everything to do with the mode :p
<tane> yeah, the other schemes just displayed the replacements in a commenty way :)
<MercurialAlchemi> there is a conceal feature in vim, though
<MercurialAlchemi> it can be used to display unicode symbols on lines you're not editing
<TheLemonMan> or just use digraphs
<MercurialAlchemi> it's all fun and games until you use X11 selection to copy-paste
<Drup> :x
<MercurialAlchemi> Drup: /q
<Drup> :<
<tane> is there work considered on lifting the sedlex restriction on latin1 encoded source files?
<MercurialAlchemi> awesome, I didn't know this was an actual vim command
<Drup> tane: oh, you meant *sedlex* ? what restriction ?
<tane> if you for example match the string "hello → world" it won't compile
<ousado> apropos colors, how can I prevent merlin from highlighting :TypeOf dark (and hence hiding the text) on a light background?
<Drup> tane: ah, not "sedlex" then, ok
<Drup> don't encode files in latin1.
<Drup> just ... don't.
<tane> well, i don'T
<tane> sedlex' github states: The OCaml source is assumed to be encoded in Latin1 (for string and character literals).
<Drup> interesting.
<MercurialAlchemi> sad.
<tane> yeah
<Drup> open a bug please, I will fix that when I got around
<tane> you can still match whatever you like, if you give the actual numbers
<tane> alright
<Algebr> given this, external ( |> ) : 'a -> ('a -> 'b) -> 'b = "%revapply" this means that its actually defined in C code? Also, what does the %revapply mean? that the function name is called revapply in the C code?
<flux> no, it means it is special magic to the compiler
<Drup> it's a compiler built in that is always inlined
<flux> if it said "revapply", then it would be C code
ontologiae_ has joined #ocaml
ebzzry has joined #ocaml
ebzzry has quit [Remote host closed the connection]
<rom1504> is it possible to implement a general cross product function in ocaml ? ie ('a list)*('b list)*...*('z list) -> ('a*'b*...*'z) list ?
<Muzer> I'm trying to compile http://www.cs.cmu.edu/~ecc/gyro.tar.gz on Gentoo. I have installed lablgl and have /usr/lib64/ocaml/lablGL/glPix.{cmi,cmx,ml,mli} but the build is failing with 'Error: Unbound module GlPix'
<Drup> rom1504: No
<Muzer> sorry, just got it, the Makefile was looking for lablgl in lower case, I just changed it to lablGL and it worked
bytbox has quit [Remote host closed the connection]
<Drup> well, actually, yes, it's possible, but the solution is a bit too convoluted to be usable
<rom1504> I mean with any number of 'a,'b,...
Submarine has joined #ocaml
<Drup> yes, I understood =)
<ggole> You could use the fold trick, but... don't
<rom1504> it's just out of curiosity, having it for pair and triple is often enough
<Drup> ggole: or the gadt trick :D
ghostpl_ has joined #ocaml
ebzzry has joined #ocaml
<rom1504> I don't even know how to type this function
<ggole> Variadic extensions seem like they would be possible
<ggole> But as is, there's nothing except hacks
<ggole> Or writing zip2, zip3, etc
ghostpl_ has quit [Remote host closed the connection]
ghostpl_ has joined #ocaml
<rom1504> ok
<Drup> generating zip_n for a set of n could be made easy with a tiny ppx
<rom1504> yeah seems it's in the "macro" level. I bet it might be doable with c++ variadic template stuff
<ned-> rom1504, it's definitably doable with c++ variadic tmpls
<Drup> ggole: do you have a reference for a decent type system with variadics ?
<ggole> Typed racket
[boxed-pyon] has quit [Quit: I'm sorry but... I don't have any interest in three-dimensional girls.]
<Drup> really should take the time to dwelve deeper into this one. I know the surface, but not much the details :p
<ggole> You'd have to extend pattern matching a bit, I think
<ggole> let rec zip = function | [].. -> [] | (x::xs).. -> x,,::zip xs | _ -> invalid_arg "zip"
<ggole> Where the parts inside a .. are variadic
<ggole> And ,, unpacks a variadic variable into a tuple
<Drup> ggole: any ref with the actual type system spelled out ?
<ggole> Um, maybe the papers? I haven't gone through them though.
<ggole> My interaction with typed racket has been limited to peering at it from a distance saying "ooh, that looks interesting..."
<Drup> same
<Drup> (I don't think I could ever like the prefix syntax)
<ggole> It's nicer to edit than to read
<ggole> It does make macros simpler though
<Drup> it's sort of the goal :p
larhat has quit [Quit: Leaving.]
pyon has joined #ocaml
arj has quit [Quit: Leaving.]
avsm has joined #ocaml
darkf has quit [Quit: Leaving]
badkins_ is now known as badkins
shinnya has quit [Ping timeout: 272 seconds]
MercurialAlchemi has quit [Remote host closed the connection]
MercurialAlchemi has joined #ocaml
segmond has quit [Ping timeout: 264 seconds]
patronus has quit [Read error: Connection reset by peer]
patronus has joined #ocaml
hiptobecubic has joined #ocaml
girrig has quit [Ping timeout: 250 seconds]
keen__________75 has quit [Ping timeout: 250 seconds]
bytbox has joined #ocaml
freling has joined #ocaml
girrig has joined #ocaml
rgrinberg has joined #ocaml
keen__________75 has joined #ocaml
struktured has joined #ocaml
rgrinberg has quit [Ping timeout: 245 seconds]
segmond has joined #ocaml
ghostpl_ has quit [Remote host closed the connection]
kc_srk has joined #ocaml
struk|work has quit [Ping timeout: 246 seconds]
segmond has quit [Ping timeout: 255 seconds]
rgrinberg has joined #ocaml
<Drup> haesbaert: I see you picked up cmdliner :D
ontologiae_ has quit [Ping timeout: 245 seconds]
ptc has joined #ocaml
ptc is now known as Guest13330
zpe has quit [Remote host closed the connection]
octachron has quit [Quit: Leaving]
avsm has quit [Quit: Leaving.]
lordkryss has joined #ocaml
Guest13330 has quit [Ping timeout: 246 seconds]
ghostpl_ has joined #ocaml
segmond has joined #ocaml
ptc_ has joined #ocaml
ptc_ has quit [Ping timeout: 264 seconds]
<haesbaert> Drup: indeed, and my native is <1mb now :P
<Drup> :)
bytbox has quit [Ping timeout: 264 seconds]
<haesbaert> code was easier too, this is more or less my first real attempt at FP
jbrown has joined #ocaml
<Drup> I still think you have a bit of a case of "put everything in one big function"
<haesbaert> you mean even by defining functions inside the one big function ?
<Drup> yes
<haesbaert> I mostly wanted the cmd lines to be global
<haesbaert> *cmd line options
<Drup> sure, that's normal
<haesbaert> is there a better way to do it than a huge function ?
<haesbaert> if you look at wcfiles
<haesbaert> is there a better way to define all those functions inside wcfiles and have the *flag arguments accessible still ?
slash^ has joined #ocaml
<Drup> :D
<haesbaert> come on, give me a better idiom :D
<Drup> not :)
<haesbaert> not super better come on
<Drup> compared to "foo = false" ?
<haesbaert> yeah
<haesbaert> I'm changing it anyway, not is clearly more economic
<Drup> yes, exactly :D
<haesbaert> but in regards to my previous question, is there a way to achieve that ?
<Drup> yeah, sure, put the flags in arguments
<Drup> Personally, considering you have so many flags and it's so easy to mix them
<Drup> I would make a record type "configuration" containing all the flags
<haesbaert> oh I don't have many flags, cat(1) has :D
<Drup> and pass it around
<haesbaert> that crossed my mind too
<Drup> well, it's pretty much the same
<Drup> and this way, you can pull the internal functions out
<haesbaert> but then it doesn't seem like a huge improvement, I still need to pass it down to almost every function
<haesbaert> true
<ggole> Is there a reason to match on List.length instead of the list?
<haesbaert> ggole: the inexperience of the author probably
<companion_cube> it's probably much less efficient
<companion_cube> haesbaert: if you have many arguments, consider defining a record
<Drup> it's not in the loop, it doesn't matter
<Drup> (but it's ugly regardless :D)
<haesbaert> it's a one time call
<haesbaert> how would it be without the lenght ?
<ousado> | [] -> | _ ->
<haesbaert> match with header and [] ?
<ggole> Just match on the list
<ggole> match files with [] -> ... | [single] -> ... | list -> ...
<haesbaert> ack
jbrown has quit [Ping timeout: 264 seconds]
<haesbaert> so far I'm getting the feel that big functions with many small functions inside are not cool
<haesbaert> they're quite hard to read too
<ggole> Yeah, try to split things up
<haesbaert> git diff owc.ml
<haesbaert> error: inflate: data stream error (incorrect header check)
<haesbaert> hoooray for git
jbrown has joined #ocaml
swgillespie has joined #ocaml
gal_bolle has joined #ocaml
freling has quit [Quit: Leaving.]
bytbox has joined #ocaml
jbrown has quit [Ping timeout: 264 seconds]
ned- has quit [Ping timeout: 244 seconds]
<haesbaert> question, is match always faster than an if ?
<haesbaert> even if the simple true|false case ?
<haesbaert> s/if/in
<Drup> no, it's the same
<Drup> if it's true/false
<haesbaert> great, and there isn't a more economical form of if ?
<haesbaert> foo = bla ? exp0 : exp1;
<haesbaert> something on those lines
<thizanne> foo = if bla then exp0 else exp1
<thizanne> it's not *that* expensive
<haesbaert> it's less typing than the match for sure
<Drup> no tri-graph non-sense in ocaml :)
<thizanne> my point is, the ternary condition is usually used in languages with blocks to get an expression out of an if-then-else
<thizanne> in OCaml, (if x then y else z) is already an expression
<thizanne> so no, you don't get the « only one character instead of three » sex, but it's still what you really want deep inside
travisbrady has quit [Quit: travisbrady]
travisbrady has joined #ocaml
<haesbaert> ack
<Algebr> do functions that have a suffix of i usually mean that they also give the index of the item? example String.iteri
tg has quit [Ping timeout: 246 seconds]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<Drup> yes, it's a rather common idiom
<Algebr> is there no generic enumerate function?
<Drup> what do you mean ?
<Drup> a function iter that would work on anything ?
<Algebr> like python's enumerate gives you back any the item's index and the item
<Drup> the closer you can get to that is the sequence and gen libraries
<Algebr> those are separate libaries right, not part of batteries?
<Drup> ah, you are in batteries, then it's Enum, even if I don't like it, for various reasons.
_2can has quit [Ping timeout: 265 seconds]
_2can has joined #ocaml
jwatzman|work has joined #ocaml
jbrown has joined #ocaml
yomimono has quit [Ping timeout: 252 seconds]
kc_srk has left #ocaml [#ocaml]
florent_ has joined #ocaml
gal_bolle has quit [Quit: Konversation terminated!]
Kakadu has quit [Quit: Page closed]
MrScout has joined #ocaml
mcclurmc has joined #ocaml
JuggleTux has quit [Remote host closed the connection]
mcclurmc_ has quit [Ping timeout: 250 seconds]
martintrojer has quit [Quit: ZNC - 1.6.0 - http://znc.in]
paradoja has quit [Ping timeout: 252 seconds]
rgrinberg has quit [Ping timeout: 256 seconds]
martintrojer has joined #ocaml
segmond has quit [Ping timeout: 256 seconds]
Algebr has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
psy has joined #ocaml
seangrove has quit [Remote host closed the connection]
seangrove has joined #ocaml
MrScout has quit [Remote host closed the connection]
ghostpl_ has quit [Remote host closed the connection]
MrScout has joined #ocaml
psy has quit [Disconnected by services]
psy_ has joined #ocaml
segmond has joined #ocaml
Anarchos has joined #ocaml
jbrown has quit [Ping timeout: 246 seconds]
tg has joined #ocaml
travisbrady has quit [Quit: travisbrady]
florent_ has quit [Ping timeout: 250 seconds]
ptc has joined #ocaml
ptc is now known as Guest21224
psy_ has quit [Ping timeout: 246 seconds]
florent_ has joined #ocaml
matason has quit [Quit: Leaving...]
Kakadu has joined #ocaml
olauzon has joined #ocaml
jwatzman|work has quit [Quit: jwatzman|work]
florent_ is now known as gal_bolle
Guest21224 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bytbox has quit [Ping timeout: 264 seconds]
pyon has quit [Ping timeout: 264 seconds]
[boxed-pyon] has joined #ocaml
segmond has quit [Ping timeout: 250 seconds]
JuggleTux has joined #ocaml
Nahra has quit [Remote host closed the connection]
nicoo_ has joined #ocaml
nicoo has quit [Ping timeout: 245 seconds]
ollehar1 has joined #ocaml
dsheets_ has quit [Ping timeout: 246 seconds]
mcclurmc has quit []
mcclurmc has joined #ocaml
segmond has joined #ocaml
ggole has quit []
larhat has joined #ocaml
travisbrady has joined #ocaml
bytbox has joined #ocaml
travisbrady has quit [Client Quit]
ollehar1 has quit [Ping timeout: 245 seconds]
Haudegen has quit [Ping timeout: 250 seconds]
segmond has quit [Ping timeout: 264 seconds]
[boxed-pyon] is now known as pyon
Haudegen has joined #ocaml
oriba has joined #ocaml
laughing-octo-sh has joined #ocaml
travisbrady has joined #ocaml
travisbrady has quit [Client Quit]
myyst is now known as myst
travisbrady has joined #ocaml
seangrove has quit [Ping timeout: 240 seconds]
dsheets_ has joined #ocaml
segmond has joined #ocaml
nicoo_ is now known as nicoo
jbalint has quit [Ping timeout: 264 seconds]
Denommus has joined #ocaml
travisbrady has quit [Quit: travisbrady]
MooseAndCaml has joined #ocaml
jbalint has joined #ocaml
jbalint has quit [Changing host]
jbalint has joined #ocaml
rgrinberg has quit [Ping timeout: 255 seconds]
<MooseAndCaml> hi, I have two record types both with an om field, but each with a unique initial field. I'm getting: Error: This expression has type pcut but an expression was expected of type tempo_transfer. Is there a way to specify which type I want?
<smondet> MooseAndCaml: put them in different modules
<MooseAndCaml> ok. thanks Ill try that.
<adrien> don't you have differentiation since some releases?
<adrien> based on context
travisbrady has joined #ocaml
<MooseAndCaml> do you tend to put types in modules without including functions in the module?
<smondet> adrien: yes with 4.02 you can “desambiguate” in some cases
<smondet> MooseAndCaml: "I"? yes, always `module Some_name = struct type t = ... end`
<MooseAndCaml> oh, what a wonderful world you have just opened... t...
<MooseAndCaml> Days have been peeling away as I've struggled with these issues.
hiptobecubic has quit [Ping timeout: 252 seconds]
rgrinberg has joined #ocaml
antkong has joined #ocaml
keen__________76 has joined #ocaml
<smondet> MooseAndCaml: (re-reading your question...) I meant I also put the funcitons in there
keen__________75 has quit [Ping timeout: 240 seconds]
slash^ has quit [Read error: Connection reset by peer]
<MooseAndCaml> I see... I was thinking it would be helpful to wrap every type in a module and if those also existed in a containing module with functions fine, but it would make the records explicit. Is there any advantage to the vague identity? They're not polymorphic right?
<smondet> what do you mean with "vague identity"?
ousado is now known as runtime
runtime is now known as ousado
<ousado> MooseAndCaml: if you want to know all about it read this and all the links: http://www.lexifi.com/blog/type-based-selection-label-and-constructors
hiptobecubic has joined #ocaml
jao` has joined #ocaml
paolooo has joined #ocaml
jao` has quit [Changing host]
jao` has joined #ocaml
Denommus has quit [Ping timeout: 264 seconds]
arj has joined #ocaml
jao has quit [Remote host closed the connection]
jao` has quit [Remote host closed the connection]
merry has joined #ocaml
AlexRussia has quit [Ping timeout: 265 seconds]
travisbrady has quit [Quit: travisbrady]
<MercurialAlchemi> MooseAndCaml: you can always add type annotations - let foo:your_type = { ... }
<MercurialAlchemi> will tell the compiler to make a record of type 'your_type'
<MooseAndCaml> I just finished reading the article, but I have to go back through it a bit. I've thinking I need to start working with annotations
<MercurialAlchemi> if I understand your problem
travisbrady has joined #ocaml
<mrvn> imslavko: via __attribute__
antkong has quit [Ping timeout: 264 seconds]
<mrvn> ups, ewin
_andre has quit [Quit: leaving]
myst has quit [Read error: Connection reset by peer]
travisbrady has quit [Quit: travisbrady]
Denommus has joined #ocaml
myst has joined #ocaml
segmond has quit [Ping timeout: 265 seconds]
travisbrady has joined #ocaml
alkoma has joined #ocaml
antkong has joined #ocaml
<MooseAndCaml> how do you handle extracting the type into a module in this kind of situation? I put it in a module and now I fifteen minutes into trying to get the code to work again. The last week I've made no forward progress, working all day every day to move from tuples to records, or from records outside modules now, to records inside... I feel like I'm missing something
<MercurialAlchemi> MooseAndCaml: well
<MercurialAlchemi> it depends on what your types are
<MercurialAlchemi> if they're manipulated by a small set of functions only, put these functions in the same module
<ousado> times of no apparent progress are often important when learning stuff
<MercurialAlchemi> this module "owns" the type, and you can enforce this by adding a signature and making the type abstract in this signature
<MercurialAlchemi> this way no other module can manipulate it
<MercurialAlchemi> on the other hand, sometimes you have types used throughout your application
<tane> well, the usual approaches of software engineering help there i'd say :)
<MercurialAlchemi> you could make a yourAppTypes.ml module, with your types in it, and open this module when you need it
<tane> coupling and binding
<MooseAndCaml> For instance I started with a small set of types and let foo = () functions. I started writing it expanded quite a bit. If I break them in to modules I have to recode everything. If I put them in submodules I have to recode everything. It would be fine if it wasn't the 8th reason I've had to recode everything for reasons having little apparent to do with the problem or algorithm
<MercurialAlchemi> it may also be that you're trying to do something too complex at the stage you are at :)
<MercurialAlchemi> You shouldn't have to "recode everything" if you're moving things around
<ousado> MooseAndCaml: you don't have to rewrite things to add a type annotation
<MooseAndCaml> I really understand the problemm, agorithm and approach inside and out. I can write OCaml code but my strategy for dealing with expansion leads me directly to ruin at every turn. I don't think it is a practice I should just get used to
arj has quit [Quit: Leaving.]
<MooseAndCaml> so for an annotation, does that use the types name, like let foo (x:t) = ... ?
nullcat_ has joined #ocaml
<ousado> yes
<ousado> let foo ( v : SomeModule.some_record_t ) = should be enough to disambiguate
segmond has joined #ocaml
<nullcat_> I am trying to build OCaml compiler on my OS X 10.10 with gcc 4.9. I simply tried "$ ./configure && make world" and it builds successfully. Then I tried " $ ./ocamlc" then get the warning "Fatal error: unknown C primitive `caml_add_debug_info'"
seangrove has joined #ocaml
<MooseAndCaml> how do I annotate the type of a record I'm constructing? Do I need to make a function to generate the record and annotate the parameters ?
AlexRussia has joined #ocaml
<ousado> I don't understand the question
<MooseAndCaml> sorry, I think I misunderstood something. Trying to get this function working with annotation
<mrvn> let (v : r) = ...
<mrvn> or ({ ...} : r)
<ousado> ah you can annotate every expression like this ( expr : t )
<ousado> .. what mrvn said
<MooseAndCaml> ok that makes sense
AlexRussia has quit [Ping timeout: 245 seconds]
segmond has quit [Ping timeout: 256 seconds]
<MooseAndCaml> Can you check this out. This function compile but the type seems to be interfering with a later function. The annotations I'm adding are not compiling
<MooseAndCaml> Its an absurdly simple function and I've spent about 8 hours on it
AlexRussia has joined #ocaml
<ousado> MooseAndCaml: and what's the error?
<MooseAndCaml> Error: This expression has type int but an expression was expected of type tempo_transfer
<ousado> that's for lines 8 and 9??
antkong has quit [Quit: antkong]
<MooseAndCaml> It doesn't say. Doesn't report line numbers and the character number are always way off
<MooseAndCaml> Emacs
<ousado> uhm, then compile from commandline?
<MooseAndCaml> ok
<ousado> how can you work at all without proper compiler errors..
<MooseAndCaml> with loathing
<MooseAndCaml> commenting things to see where bugs are
<ousado> ok where is the camera
<nullcat_> dumb mistake... i figured out
rgrinberg has quit [Ping timeout: 250 seconds]
<def`> :D
segmond has joined #ocaml
AlexRussia has quit [Ping timeout: 264 seconds]
<def`> whitequark: thx
<ousado> MooseAndCaml: also you should use merlin
<MercurialAlchemi> ocp-indent is your friend too
hiptobecubic has quit [Ping timeout: 240 seconds]
<MercurialAlchemi> especially if you want to avoid beginner mistakes like not having your effectful code in a nested match branch executed when you think it should
hiptobecubic has joined #ocaml
<Anarchos> what is the serial ata spec i should read to verify some magic numbers in our ahci protocol ?
* Anarchos wrong channel, sorry.
ontologiae_ has joined #ocaml
segmond has quit [Ping timeout: 255 seconds]
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
<MooseAndCaml> MercurialAlchemi: where am i doin the nested match?
<MercurialAlchemi> MooseAndCaml: I'm talking in general
<MercurialAlchemi> it's relatively easy to indent things wrongly and have things compile but behave incorrectly as a result
<MercurialAlchemi> ocp-indent doesn't indent wrongly
<MooseAndCaml> I do use merlin and it has been extremely helpful in getting started.
segmond has joined #ocaml
AlexRussia has joined #ocaml
Haudegen has quit [Ping timeout: 256 seconds]
<MercurialAlchemi> MooseAndCaml: there something deeply wrong in your gist, though
<MercurialAlchemi> (y.om : tempo_transfer)
<MercurialAlchemi> presumably, you mean that y is a tempo_transfer, not y.om
`eeks has quit [Quit: `eeks]
gal_bolle has quit [Ping timeout: 250 seconds]
<ousado> you should make sure it works properly, then
<MooseAndCaml> Merlin seems to be ok. It just top-level that seems to report the wrong line numbers
<MercurialAlchemi> it won't work with that type annotation, in any case
<ousado> so why do you comment stuff out to find errors instead of looking at the compiler message then?
<MooseAndCaml> I put together this - https://gist.github.com/caseybasichis/351d260c597af0211b41 - It kind of demonstrates an approach to planning with compilable code. Is there a way to do something like line 14?
<MooseAndCaml> i do look at the compiler message. It just it rarely highlights any code and the char position of the error is always wrong so it I don't know where the type error is occuring
Haudegen has joined #ocaml
<Denommus> why do JSers use npm and bower at the same time?
<Denommus> oh, wrong channel
<MooseAndCaml> i updated it a bit it compiles but the type isn;t what I expected val e_empty : ?w:d -> unit -> e = <fun> - Warning 16: this optional argument cannot be erased. val e_empty : ?w:d -> e = <fun>
rgrinberg has joined #ocaml
tane has quit [Quit: Verlassend]
<ousado> uhm.. no idea what you're doing now and how it relates to what ou were asking before..
<nullcat_> Can someone tell me the tradeoff in this pull request? Why compatibility problem will arise? Thanks https://github.com/ocaml/ocaml/pull/147
<ousado> depending on the editors settings it might count tabs as multiple colums instead of one, which is what the compiler does
nullcat_ has quit [Read error: Connection reset by peer]
antkong has joined #ocaml
antkong has quit [Read error: Connection reset by peer]
<ousado> which might be the issue with columns
MrScout_ has joined #ocaml
travisbrady has quit [Quit: travisbrady]
<MercurialAlchemi> MooseAndCaml: utop gives val e_empty : ?w:d -> unit -> e = <fun>
<MercurialAlchemi> what did you expect?
MrScout has quit [Ping timeout: 265 seconds]
<MooseAndCaml> unit -> e
<MooseAndCaml> is there any way to make empty/default records that contain other records in that way?
MrScout_ has quit [Ping timeout: 256 seconds]
<mrvn> MooseAndCaml: let r = { defaults with x = 17; }
reem has joined #ocaml
<MercurialAlchemi> MooseAndCaml: of course you're not going to have unit -> e only if you have an optional argument...
<MercurialAlchemi> it's not because it's optional that it's invisible
<MooseAndCaml> does that apply to the case in the gist where we are only creating one, not copying an existing record?
nullcat has joined #ocaml
<MooseAndCaml> oh
nullcat has quit [Remote host closed the connection]
segmond has quit [Ping timeout: 245 seconds]
<MooseAndCaml> ok, the option value is curried until the whole thing is resolved. The function seems to work. Is that over all approach something that is recommended / makes sense - wiring all the function together and then writing the code?
reem has quit [Remote host closed the connection]
rgrinberg has quit [Ping timeout: 256 seconds]
reem has joined #ocaml
<hiptobecubic> MooseAndCaml.... and Boris?
<MooseAndCaml> Squirrel
<hiptobecubic> Well yes, but caml has replaced squirrel
<hiptobecubic> I can't remember the woman's name... boris and... v? veronica?
<MooseAndCaml> natascha
<hiptobecubic> ah right!
<MooseAndCaml> natasha rather.. haven't seen it in years, but it was the first thing that came to mind.
reem has quit [Remote host closed the connection]
Denommus has quit [Ping timeout: 240 seconds]
segmond has joined #ocaml
rgrinberg has joined #ocaml
segmond has quit [Ping timeout: 252 seconds]
travisbrady has joined #ocaml
Simn has quit [Quit: Leaving]
MercurialAlchemi has quit [Ping timeout: 264 seconds]
Denommus` has joined #ocaml
JuggleTux has quit [Ping timeout: 252 seconds]
JuggleTux has joined #ocaml
reem has joined #ocaml
segmond has joined #ocaml
Algebr has joined #ocaml
travisbrady has quit [Quit: travisbrady]
Denommus` is now known as Denommus
antkong has joined #ocaml
segmond has quit [Ping timeout: 256 seconds]
hilquias has joined #ocaml
MrScout has joined #ocaml
kandu has quit [Remote host closed the connection]
segmond has joined #ocaml
laughing-octo-sh has quit [Ping timeout: 240 seconds]
MrScout has quit [Remote host closed the connection]
Kakadu has quit [Remote host closed the connection]
segmond has quit [Ping timeout: 256 seconds]
MrScout has joined #ocaml
Algebr has quit [Read error: Connection reset by peer]
Algebr has joined #ocaml
jcdyer has joined #ocaml
olauzon has quit [Quit: olauzon]
paolooo has quit [Ping timeout: 246 seconds]
<jcdyer> Does Core.Std have a concise way to grab the Ok value out of a Result analogous to Option.value? I've been using Option.value ~default:"x" (Result.ok thing), but it feels like there should be a more direct version.
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
segmond has joined #ocaml
dav has quit [Remote host closed the connection]
<Algebr> Where is log base 2 ?
dav has joined #ocaml
hilquias has quit [Read error: Connection reset by peer]
<Drup> jcdyer: match thing with Ok x -> x | _ -> "x"
<Drup> It's even shorter :p
<jcdyer> Drup: Now that you mention it, I suppose that is short.
<Drup> (but you are right, Core's Result module is surprisingly empty
<Drup> BatResult got the fonction "default" for that
<jcdyer> Algebr: If there's a log base anything you can let log2 x = (log x) /. (log 2)
segmond has quit [Ping timeout: 252 seconds]
<mrvn> log 2 or log 2.?
<Algebr> yea, I didn't want to do the change of base in ocaml, I thought it would be available in batteries or stdlib
<Algebr> but okay, thanks
<jcdyer> mrvn: Probably (log 2.).
dav has quit [Ping timeout: 264 seconds]
lordkryss has quit [Quit: Connection closed for inactivity]
rgrinberg1 has joined #ocaml
jbrown has joined #ocaml
rgrinberg has quit [Ping timeout: 256 seconds]
<Algebr> How come the code example for opengl on the ocaml wiki is able to give a native OS X window frame but gtk doesn't/can't?
shinnya has joined #ocaml
dav has joined #ocaml
segmond has joined #ocaml
hiptobecubic has left #ocaml ["00 PC LOAD LETTER"]
jcdyer has quit [Ping timeout: 256 seconds]
jcdyer has joined #ocaml
segmond has quit [Ping timeout: 264 seconds]
paolooo has joined #ocaml
paolooo has quit [Client Quit]