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
AltGr has joined #ocaml
ollehar1 has quit [Read error: Connection reset by peer]
nullcat has joined #ocaml
ollehar has joined #ocaml
leafac has quit [Quit: Leaving.]
keen___________3 has quit [Read error: Connection reset by peer]
keen___________3 has joined #ocaml
seanmcl has joined #ocaml
seanmcl has quit [Max SendQ exceeded]
amnn has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
rgrinberg has quit [Ping timeout: 256 seconds]
Anarchos1 has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
kdef has quit [Quit: Leaving]
seanmcl has joined #ocaml
JuggleTux has quit [Remote host closed the connection]
jwatzman|work has quit [Quit: jwatzman|work]
<darryn> anyone use irssi, here?
<def`> darryn: yes
<def`> nullcat: atd-gen is a preprocessor to derive code from data definitions
<nullcat> i see.
<nullcat> i am using ppx_deriving now, seems not much difference for me at least now
<dmbaturin> darryn: I do.
tinhead has quit [Remote host closed the connection]
shinnya has quit [Ping timeout: 258 seconds]
<darryn> How do I switch between open channels?
<dmbaturin> darryn: /window $num , or Alt-[0-9]
<darryn> the /window works, not alt though
<darryn> mayber i3 messes with it
<dmbaturin> Some terminal emulators or window managers may either use Alt-something for their own needs or simply not pass it correctly.
nullcat has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
sc30317 has quit [Quit: Leaving]
<darryn> So, I am having a rough time deciding between haskell and ocaml.
<blech_> darryn, why decide?
<blech_> or did you mean for a specific project
rgrinberg has joined #ocaml
<darryn> No, just to learn in general. I know about the whole "expand your mind" but I just want a new general purpose language so I can stop using c++
<blech_> TBH if I was going to replace C++ as a whole I'd probably jump to rust
<blech_> not to dissuade you from learning OCaml
<blech_> but there are specializations to every language
rgrinberg has quit [Ping timeout: 240 seconds]
<darryn> I will still use c++... I want a functional language
<blech_> ah
<dmbaturin> For a C++ replacement, you may want to look into Ada. That's where C++ authors got the idea of generics from. :)
ericbmerritt has quit [Read error: Connection reset by peer]
emmanueloga has quit [Read error: Connection reset by peer]
bobpoekert has quit [Ping timeout: 272 seconds]
ggherdov has quit [Ping timeout: 272 seconds]
strmpnk has quit [Read error: Connection reset by peer]
yminsky has quit [Read error: Connection reset by peer]
andreypopp has quit [Read error: Connection reset by peer]
Sorella has quit [Read error: Connection reset by peer]
jcloud has quit [Read error: Connection reset by peer]
<Drup> dmbaturin: that's a joke right ?
<dmbaturin> darryn: Learning ocaml for immediate use should be faster than haskell due to imperative features (you can easily resort to mutability if it works best for the task or you don't feel like searching for a purely functional solution).
<Drup> (please tell me it's a joke)
<darryn> Well, I was choosing between haskell, Ocaml, and Lisp (Common or Racket). I just decided I will learn lisp no matter what, since I know a bit of emacslisp.
<darryn> So I am left with haskell vs Ocaml.
<darryn> haskell is apealing, but it seems more focused on academics. I want practical too.
<dmbaturin> Drup: Why? For embedded stuff, it's pretty much the only typesafe option (unless Rust targets anything but x86 now).
<darryn> But haskell also has a larger following, thus more resources and libraries.
bobpoekert has joined #ocaml
ericbmerritt has joined #ocaml
<bitemyapp> darryn: there are a lot of reasons not to use Haskell, being too academic isn't one of them.
<bitemyapp> apologies #ocaml, but this is a meme that needs to die.
<darryn> Explain?
emmanueloga has joined #ocaml
<bitemyapp> darryn: it's perfectly practical. Uses more structures unfamiliar to your typical programmer than other languages, but that doesn't make it academic.
<bitemyapp> I think the investment in learning new things pays for itself, others would disagree - and that's okay.
<Drup> dmbaturin: except that's not what you said at all
<darryn> How can a pure language not have an academic bias?
jcloud has joined #ocaml
<bitemyapp> There are rational, reasonable reasons not to use Haskell, being too academic isn't one of them.
<Drup> 1) advertising Ada by saying that the most terrible part of C++ was inspired by it is terrible
<bitemyapp> darryn: that's a weird premise to begin with.
<darryn> what are the reasons not to?
andreypopp has joined #ocaml
<def`> As for academics… It's their job to design a language so they might know better than the next random guy? :P
<bitemyapp> darryn: there are pure langs like PureScript which are basically focused exclusively on being a nice language to compile to JS from, so mostly frontend with some nodejs in the future.
<Drup> 2) most use of C++ are basically applications, and there are better languages than Ada for that
<bitemyapp> darryn: for another thing, there are no "academics" driving the design of Haskell for all intents and purposes. It's an open community of mostly working programmers. Even the original authors of GHC and the Haskell Report were trying to converge on a nice to use non-strict FP language.
Sorella has joined #ocaml
blandflakes_ has joined #ocaml
<Drup> (also, doubt that rust only targets X86, being based on llvm and already having a bare metal implementation ...)
blandflakes has quit [Disconnected by services]
<bitemyapp> darryn: the structures that Haskell is famous for, functor/applicative/monad/etc., are only possible because somebody saw something practical that they wanted in their Haskell-alike implementation (Gofer) and so they wrote it.
blandflakes_ is now known as blandflakes
<darryn> So should I consider Haskell over OCaml? I mean, if haskell is just as practical, then I don't see why not.
<bitemyapp> lets not have that conversation.
strmpnk has joined #ocaml
<bitemyapp> you should gather as much information as you think is necessary to make an informed decision and decide for yourself.
<darryn> I have been, which is why I am asking.
<bitemyapp> I'm not here for advocacy. I like to poke around with Modules occasionally myself and they *are* a compelling feature of OCaml.
<bitemyapp> but in my 9-5, I'm 100% Haskell.
<darryn> How is the job market in Haskell?
<bitemyapp> Not great.
<dmbaturin> Drup: I wouldn't advocate using C++ for applications (like for anything else). Anyway, I agree in that wording it probably wasn't a very practical advice.
<Drup> bitemyapp: tbf though, I found haskell rather inpractical as a language, but I agree with the academic point :)
<def`> darryn: OCaml is more practical. Laziness is not something desireable in practice (it's not natural for the machine, OCaml execution model maps well to hardware)
<pleiosaur> bitemyapp: I agree that haskell the language is fairly pragmatic, but the community is ardently academic
<blech_> darryn, to be entirely honest you're probably going to end up learning both. The question isn't which one you learn, the question is which one you learn first
<Drup> pleiosaur: not more than ocaml
<dmbaturin> But, in any case I think Ada is worth learning to see what a properly designed imperative language can look like. ;)
<bitemyapp> pleiosaur: you wouldn't know that from the justifications made for Modules over Typeclasses. In that department, ML seems to be wearing the hairshirt ;P
<pleiosaur> Drup bitemyapp: I'm not making any relative comparisons to ocaml :)
<darryn> blech_: This has been what it was seeming like
<bitemyapp> practical isn't really a sensible evaluation criteria.
<bernardofpc> darryn: it will be probably easy to know both of them
<Drup> can we describe what "academic" means ?
<bitemyapp> it's an attempt to synthesize different criteria into a general impression and it's really easy to get fooled.
<bitemyapp> can we not use academic as a criteria either please?
<bernardofpc> I mean, I learnt OCaml and I can read Haskell with very little difficulty
<blech_> darryn, the comparison between the two happens often enough that you just learn the differences while being immersed in the community
<bitemyapp> it sounds weird and anti-intellectual to begin with. Poisonous.
<Drup> if it means "most user/contributors are currently in academia" then it's certainly false
<Drup> if it means "most constributers have a phd", then yeah, it's probably true :>
<def`> bitemyapp: that's the point of 99% of discussions on the internet, even more when it comes to programming luanges \o_
<blech_> TBH I don't feel like anyone in this chat has ground to stand on if they criticize Haskell for being academic given OCaml's history
<bitemyapp> I really dislike comparative theology though.
<def`> languages*
<bernardofpc> bitemyapp: it does not have to be theology
<bitemyapp> I poke fun at OCamlers sometimes, but I'd really rather most languages were like ML *or* Haskell. The alternatives are too terrible to contemplate.
<dmbaturin> Drup, bitemyapp: Why not define it as "designed with attention to theoretical properties"?
<bernardofpc> (but it's very hard that the debate does not fall into theology)
<Drup> dmbaturin: if that's it, then I don't want any non academic language.
<bitemyapp> bernardofpc: it's rarely a rational conversation. Look at how strongly people want to make it about nonsensical, immeasurable aesthetic impressions rather than real facilities/infacilities of the language or tooling.
<dmbaturin> Drup: Neither do I. :)
<Drup> haskell's tooling is not very good, if you want to go this way :D
<blech_> dmbaturin, I don't think the issue is attention to theoretical properties. The piece that people get annoyed at is a lack of attention paid to anything that isn't required in proof solving etc.
<darryn> Will I miss out on anything if I choose one or the other...?
<bernardofpc> bitemyapp: should tooling be considered when deciding to learn a language (for the enlightening pov of finding FP for example) ? even should the stdlib ?
smondet has quit [Ping timeout: 272 seconds]
<bitemyapp> bernardofpc: depends on what you'll use it for.
<bitemyapp> bernardofpc: if I am evaluating proof assistants, I probably don't care. Some people don't even use the stdlib in Agda.
<Drup> darryn: not in the long run
<darryn> Scripting, general college programs, hobby programs.
<bernardofpc> darryn: you'll miss typeclasses in OCaml and Modules in Haskell
<bitemyapp> bernardofpc: for my 9-5? tools, stdlib, community, third party libraries absolutely matter.
<bitemyapp> darryn: bernardofpc is right about missing (modules | typeclasses)
<blech_> bernardofpc, isn't the haskell answer to polymorphic variants some dynamically applied typeclass magic?
<Drup> darryn: really, once you are knowledgable in one, it's not very hard to switch to the other
<bitemyapp> dynamically applied has a weird sound to it given that in ML you can't statically inline modules anyway.
<bernardofpc> magic is rarely something good on a language :D
<Drup> I would argue that ocaml has an easier learning curve
<darryn> I am working on creating a chess tournament organizer for a local high school, I am almost done it C++, I want to reimplement it
<darryn> in either haskell or ocaml
<bitemyapp> so once existential encodings or higher rank polymorphism are involved with typeclasses, the operational situation has merely reverted to being what it was with modules.
<Drup> (the flip of the coin is that enlightening is less striking)
<bernardofpc> darryn: honestly, pick one and do it
<blech_> so darryn this is my general opinion on internet arguments. When there's a big conversation about the merits of one thing vs. another this really tells you two things. One, it tells you that there are reasons to use one or the other. Two, it tells you that you'll honestly be fine whichever option you choose.
<bernardofpc> anyone would probably be mostly ok
<bitemyapp> darryn: you'll be fine with either choice.
<blech_> if there's really a big conversation to be had about something what that actually means is that either option is sufficient
<darryn> Initially, I chose OCaml over haskell, because 1. I speak french 2. Camels are cool 3. I don't know anything to judge either.
<bitemyapp> darryn: it wouldn't hurt you to learn both, but try to focus on one at a time, especially for a project.
<bernardofpc> if you're doing ocaml, you'll probably wish some bigger stdlib (batteries, core, containers)
<bernardofpc> and you'll probably want to install opam + merlin
<blech_> I will say this
<bitemyapp> yep. opam is nice.
<blech_> utop is pretty bitchin
<bernardofpc> right, utop
<bitemyapp> darryn: Re: #1 - https://github.com/bitemyapp/learnhaskell/blob/master/guide-fr.md (admittedly, all the links are to English resources)
yminsky has joined #ocaml
<bitemyapp> sorry for disrupting y'all, that's the last from me.
<darryn> Which has more support? Haskell I am guessing, seems less devided (batteries vs core, etc)
<bernardofpc> I can't say for Haskell, and probably if you choose .hs, then go ask people there what are the "must have" tools
<bitemyapp> darryn: people are mostly happy with base/prelude, some people will use alternate preludes but it doesn't break anything or create an alternate universe.
<bernardofpc> and divisions are abundant in free software, and my advice is not to be afraid
<Drup> darryn: "support" ?
yminsky has quit [Client Quit]
<bitemyapp> bernardofpc: must have tools?
<dmbaturin> darryn: I don't know if this is universal, but chances are you won't look at learning languages the same way after learning ocaml or haskell. A side effect is that they teach you to think about semantics first.
<bernardofpc> (utop, merlin, opam, ...)
<bitemyapp> bernardofpc: oh, no, there's similar in Haskell.
<blech_> Lol. I'm entertained by the idea of minsky entering the channel, seeing another haskell vs. ocaml discussion, and NOPE-ing out of there.
<Drup> dmbaturin: I'm so annoyed by language tutorials no
<Drup> "Give me godamn semantic, you idiot"
<bernardofpc> anyway, good night yall
<bitemyapp> haskell-mode has inferior haskell (REPL), ghcid gives you a nice near-instantaneous auto-reloading "check for warnings/errors", there's similar stuff for vim, ide-backend is coming along, etc.
<bitemyapp> but you don't *have* to use any particular tools to get started.
ggherdov has joined #ocaml
<bitemyapp> just get GHC/ghci/cabal installed which will come together as a package usually.
<blech_> Drup I feel you. I asked my compilers professor if there was a site with just listings of the operational semantics of popular languages
<darryn> Haskell seems to have more resources and a larger following... but do they have camels?... checkmate haskellers.
<blech_> apparently not so much
<bitemyapp> darryn: devoid of camels, sadly.
<dmbaturin> darryn: Yes, and you will be annoyed by most language tutorials. Whether this side effect is positive or negative is debatable. :)
swgillespie has joined #ocaml
<Drup> darryn: to compensate, "Learn You A Haskell" as the prettiest drawing ever
<Drup> has*
<darryn> maybe I should haskell, then switch to OCaml?
<darryn> I really don't care...
<blech_> darryn, neither do we :P
<darryn> I am so new to functional programming, everything is new
<blech_> that's not meant to be a mean thing that's a if you want to learn ocaml first and then explore haskell awesome
<bitemyapp> Drup: I don't recommend LYAH for learning Haskell.
<blech_> if you want to learn haskell first and then come back, also awesome
<Drup> bitemyapp: you are the first one saying that I ever encountered
<blech_> darryn, personally I find OCaml code more aesthetically pleasing
<blech_> take that as you will
<bitemyapp> Drup: I have taught a lot of people Haskell and I am writing a book for learning Haskell.
<dmbaturin> Well, as I said, having an easy way to retreat to imperative style can make things easier.
<bitemyapp> Drup: it's pretty bad.
<dmbaturin> Drup: I also didn't like LYAH.
<Drup> bitemyapp: what don't you like in LYAH ?
<darryn> Screw it, OCaml it is, because camels
<bitemyapp> I go into a fair amount of excruciating detail in the blog post
<bitemyapp> and each resource gets its own block and listing
<bitemyapp> but the biggie is: no exercises.
<Drup> I personally don't have any opinion on the book, I was far too familiar with FP when I learned haskell to get anything from it
<bitemyapp> it's also pretty breezy and doesn't really *explain* the language
<bitemyapp> it just talks about the language and shows you some REPL output.
<dmbaturin> I was about to cite bitemyapp's post, but then I realized that bitemyapp is the author of that post.
<bitemyapp> dmbaturin: I'm honored you'd cite it :)
<Drup> isn't that what people not from a FP background except from a tutorial ?
<darryn> maybe i should ask this question in #haskell
<bitemyapp> Drup: er, regardless of your background, you have to actually *learn* Haskell.
<bitemyapp> Drup: now, you don't need a perfect or complete understanding, but if you're not 1. Being told what the actual semantics are 2. And doing exercises - you're being robbed.
rgrinberg has joined #ocaml
<bitemyapp> Drup: my coauthor on our book never programmed before learning Haskell. She hated LYAH too.
<blech_> Drup, I think I agree with you but honestly the space of "books on a language for people who can already program" is so thin that I'm no longer surprised or upset when books cater to new peeps
<bitemyapp> Drup: her 10 year old is learning Haskell from our book as of a month ago.
<bitemyapp> blech_: it doesn't matter.
<darryn> blech_: it's really frustrating
<bitemyapp> blech_: nothing written for learning Haskell was written for people who couldn't code.
<bitemyapp> blech_: further, writing for people who can already code *doesn't change the material*
<bitemyapp> it changes almost *nothing*, at least when it comes to Haskell.
<Drup> that is not exactly true
<bitemyapp> Partly because it's pure, partly because there's so much that is unfamiliar.
<bitemyapp> you have to reboot in terms of, "it's just application and abstraction" whether they've programmed before or not.
<Drup> I was personally very annoyed by preciselly all the haskell tutorial/books for haskell
<bitemyapp> so am I, that's why I'm writign a book
<bitemyapp> if I were satisfied with the existing books and tutorials I wouldn't need to write one.
<blech_> bitemyapp, do you have drafts available? I'd be interested in reading
<dmbaturin> My memories about learning FP are still somewhat fresh, what I wanted from tutorials is to see how particular problems map to the language and what exactly the code means.
<bitemyapp> There's a free sample here - http://haskellbook.com/ it's not exhaustive in demonstrating our approach to teaching Haskell but it gives the flavor of some of the more trivial bits.
<dmbaturin> (Now that I think of it, this is probably what I would want if I couldn't code already)
<Drup> bitemyapp: I think my issue was different. I had already a good knowledge of OCaml
<bitemyapp> Drup: that's not my experience at all.
<bitemyapp> Drup: the same things trip up Java users, OCaml users, etc.
<Drup> http://blog.ezyang.com/2010/10/ocaml-for-haskellers/ that is decent, but it was written after
<Drup> arg no, wrong link
<Drup> this one is useless
<bitemyapp> it being a pure calculus is new to people. Parameterized structure with typeclass-driven interfaces are unfamiliar. Non-strictness is unfamiliar to OCaml and Java users alike.
<bitemyapp> Really, very little changes unless you want to draw disingenuous comparisons between modules and typeclasses.
<blech_> bitemyapp, can you define what you mean by non-strictness?
ousado has quit [Ping timeout: 276 seconds]
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
darkf has joined #ocaml
<bitemyapp> blech_: Haskell is call-by-need.
<dmbaturin> Laziness by default I guess.
seanmcl has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<bitemyapp> well, it is by default yes, but I'm using the term "non-strict" because lazy implies memoization.
<bitemyapp> (traditionally)
<bitemyapp> call-by-need, no memo -> non-strict
<blech_> ah. That use of strictness is new to me
<blech_> thanks
<Drup> bitemyapp: the thing is, a book would not have teached me anything about all that except telling it to me. I just wanted some guide giving me pointer to bootstrap and get going. I would have discovered the rest by practice
<dmbaturin> On a side note, I mostly hated Erik Meijer's edX course, but the part about the evaluation model and outermost vs innermost reduction was one of the most interesting moments in learning haskell for me.
sdothum has joined #ocaml
<bitemyapp> dmbaturin: ditto, and yes, he covered that part well.
sdothum has quit [Remote host closed the connection]
<Drup> It's not by reading that it's call by need that I would build a performance mental model for haskell
<dmbaturin> What I find odd is that few haskell tutorials mention it.
<bitemyapp> Drup: that's why our book is exercise-driven.
blandflakes has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
<bitemyapp> Drup: we show you things that work. We show you things that don't work. We explain why they don't work. We ask you to fix broken things. We ask you to synthesize new things. We ask you to form hypotheses and test them.
<bitemyapp> Drup: there's a very careful and thoughtful pedagogy here and we're going to the trouble so there's at least one solid all-round introduction to Haskell.
<bitemyapp> because the alternative is to...what? Read SPJ's book from the 1980s on implementing non-strict functional languages to understand the operational semantics of call-by-need?
<blech_> bitemyapp, so if I'm going to sum it up it sounds like you're saying most haskell books are Great-Ones(TM) speaking from the mountaintop and you're trying to invite them to climb up?
<bitemyapp> Bird and Hutton had some good stuff on the eval strategy (non-strict), but there are other problems.
<rgrinberg> bitemyapp: i cannot stand text books without problem sets :)
<bitemyapp> blech_: that's a pretty good way of putting it.
blandflakes has joined #ocaml
<Drup> bitemyapp: my personal was to just start the thing I wanted to write
<Drup> +solution
<dmbaturin> rgrinberg: I still want a measure theory book with a problem set.
<bitemyapp> rgrinberg: me either :)
<Drup> (with mostly no tutorial)
manizzle has quit [Ping timeout: 246 seconds]
<bitemyapp> Drup: that's fine, but I'm working on a "big vehicle" for Haskell.
sdothum has joined #ocaml
blandflakes has quit [Client Quit]
<Drup> not really fine, no, I didn't know the idioms
blandflakes has joined #ocaml
<bitemyapp> Not everybody has the resources or time to learn Haskell the hard way. I'm trying to make it so there's at least one reasonable alternative to reading 1,001 blog posts, white papers, etc.
<bitemyapp> at least for the basics plus some intermediate necessities for using Haskell in anger.
cdidd_ is now known as cdidd
jabesed has quit [Ping timeout: 244 seconds]
sdothum has quit [Client Quit]
<Drup> especially the things like the bazillions ghc extensions, how to structure your code to avoid type class dependencies loop, and so on
ousado has joined #ocaml
<bitemyapp> What's the general impression of RWO here? It seemed pretty good to me but I haven't taught OCaml so I wouldn't really know.
<bitemyapp> Drup: the only really common GHC Extension for me is overloaded strings...I've never had a problem with that latter bit :P
<Drup> well, at least RWO tell you how to do the basic setup :D
<Drup> there is http://dev.stephendiehl.com/hask/ now, though
<bitemyapp> my guide tells people how to get rolling as well.
<rgrinberg> bitemyapp: RWO is excellent. Especially the later parts that describe the runtime. You almost always have to learn that kind of information from little snippets from mailing lists or reading the source
sdothum has joined #ocaml
<bitemyapp> Cf. http://haskellbook.com/
<bitemyapp> rgrinberg: good good :)
<bitemyapp> rgrinberg: yeah it's traditionally been like that in Haskell as well, although Marlow did cover some of the runtime/operational stuff in his (very good) book on parallelism & concurrency.
<blech_> bitemyapp, I wish it would have spent more time on type inference
<Drup> the biggest hiccup I heard about RWO is the introduction to module/functors
<bitemyapp> In fact, there are some things I don't *have* to talk about because Marlow's has it covered.
<Drup> I heard it was .. a bit rough
<bitemyapp> Drup: difficult? imprecise? unclear?
<Drup> difficult
<bitemyapp> Gotcha
<Drup> rgrinberg: I should extend the list I made about functors in practice
<Drup> with examples of idioms
<bitemyapp> anyway, I'll stop spamming here. If anybody has questions about the book or wants to talk about learning/teaching please ping me or see in #haskell/#haskell-beginners :)
<blech_> for someone brand new to static implicit languages H-M type inference is this mystical fae creature. I feel like there could have been more than a subsection
struktured has joined #ocaml
<bitemyapp> spamming about Haskell that is.
sgnb has quit [Read error: Connection reset by peer]
<bitemyapp> Drup: are there any introductions to Modules you're fond of?
<Drup> (want to buy time ;___,)
sgnb has joined #ocaml
<Drup> bitemyapp: haven't read enough books about ocaml to know
Reventlov has quit [Ping timeout: 240 seconds]
thegameg has quit [Ping timeout: 240 seconds]
Reventlov has joined #ocaml
<bitemyapp> Drup: fair enough.
<Drup> (and really ,it's very hard for me to judge, I don't even like to follow book to learn programming stuff =')
<dmbaturin> Drup: I think RWOs explanation of abstract types could be more detailed/friendly.
<dmbaturin> I can confirm I found the chapters about modules a bit confusing back then.
thegameg has joined #ocaml
<rgrinberg> Drup: do the same for OO. Functors are more intuitive
<blech_> Drup, how did you feel about "the module language" page?
<rgrinberg> bitemyapp: what happened to that haskell snap book? it was pretty promising
<dmbaturin> bitemyapp: By the way, did you read Harper's Programming in StandardML?
<Drup> rgrinberg: functors are much more useful though. And considering how confused are people about ocamlgraph, ctypes and other examples .. No, I don't think functors are intuitive.
<Drup> not the "real world" ones, at least
<dmbaturin> Drup: Any parameterized things are probably not intuitive. The most complex the parameter, the less intuitive it is. :)
<dmbaturin> * more
<rgrinberg> Drup: ok write it up, and throw it over on ocsimore when you get a chance
<rgrinberg> :)
<Drup> ocsimore ? what ?
<rgrinberg> Drup: the wiki, no?
<rgrinberg> the one made in OCaml
<dmbaturin> The wiki?
<Drup> why would I put it on ocsigen.org ?
<Drup> ocaml.org is literally made for this kind of things
<Drup> (and it's not ocsimore based, thanks god)
<rgrinberg> to get the chance to use the excellent ocsimore
xificurC has quit [Remote host closed the connection]
<Drup> *cough* *cough*
<dmbaturin> Is ocsimore so bad?
<Drup> It's not *bad*
<Drup> just unusable
xificurC has joined #ocaml
<Drup> It crumbles under its own complexity, mostly due to over-engineering.
<Drup> "Let's make it super extensible in all the directions at the same time !"
<Drup> back on the subject. dmbaturin: yes, but there are several patterns than make it much easier to understand even complex parameters
<Drup> Pretty sure a good amount of ocamlers don't really understand how structural typing works with modules/functors.
<bitemyapp> dmbaturin: no, only bits of PFPL. I read ML for the Working Programmer (not Harper)
<rgrinberg> i probably don't :P
<bitemyapp> dmbaturin: I'll look into it, thank you!
<rgrinberg> bitemyapp: that book is awesome!
<bitemyapp> rgrinberg: I agree
<rgrinberg> but then again most ocaml programmers don't use OO or functors
<bitemyapp> rgrinberg: I think the author simply got busy @ Snap, but I don't really know for sure. Books are rough.
<rgrinberg> take richard jones for example :P
<bitemyapp> the one we're writing is going to be pretty long.
<Drup> I can understand not using OO, it's not very useful really
<Drup> not using functors on the other hand .. it's a bit sad
<bitemyapp> found Harper's book, thank you.
<Drup> it can makes the code much much simpler, even trivial functors
<rgrinberg> functors have their cost - and it can be steep
<bitemyapp> yeah if Haskell had books as good as ML and Coq have, I wouldn't need to write a book :)
<rgrinberg> trivial functors are the best, e.g. instanitating some map module you're going to throw away
<Drup> throw away ? why would you throw it away ?
<Drup> Don't do that. Give it a name and put it in a corner
<rgrinberg> i mean not expoe
<Drup> ah, well, it depends what you are doing
<rgrinberg> imo the functor combinator stuff/assemblage could fix my biggest gripes with them though
<rgrinberg> so again we're counting on you Drup :P
<Drup> that's marginal for most usages
<Drup> It's good for things like mirage because basically every file is functorized
<Drup> but that's not the standard use of functors at all ...
<dmbaturin> Drup: Now I'm wondering if I do understand how structural typing works with modules.
<Drup> :D
<Drup> rgrinberg: for example, that doesn't help you to use ocamlgraph.
<Drup> hum, actually, that may help you a bit for that, not sure
ethycol has quit [Ping timeout: 246 seconds]
manizzle has joined #ocaml
xificurC_ has joined #ocaml
xificurC has quit [Ping timeout: 256 seconds]
blandflakes has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
blandflakes has joined #ocaml
tinhead has joined #ocaml
tnguyen has joined #ocaml
mcc has joined #ocaml
tinhead has quit [Remote host closed the connection]
btbytes has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
btbytes has quit [Client Quit]
blandflakes has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
BitPuffin|osx has quit [Ping timeout: 272 seconds]
idegen has quit [Quit: Leaving.]
struktured has quit [Quit: Konversation terminated!]
darryn has quit [Quit: Lost terminal]
swgillespie has joined #ocaml
tinhead has joined #ocaml
tinhead has joined #ocaml
tinhead has quit [Ping timeout: 265 seconds]
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
nullcat has joined #ocaml
n3ss3s has joined #ocaml
<n3ss3s> Hey
mcclurmc has quit [Ping timeout: 244 seconds]
<n3ss3s> I want to use async to read a file byte by byte, doing an operation on the byte and then writing it to another file (i.e. the file isn't read into memory at once)
<n3ss3s> Is there a recommended pattern for this kind of a back and forth
tinhead has joined #ocaml
mcclurmc_ has joined #ocaml
jeffmo has quit [Quit: jeffmo]
tinhead has quit [Remote host closed the connection]
hay207 has joined #ocaml
<mcc> I've got a program with a pervasively used custom string type… what would be the most sensible way to use this string type with literals?
<n3ss3s> I think read_until is going to work here, I'm indeed parsing a delimited file
struktured has joined #ocaml
<mcc> Like, is there a way to make a custom string literal operator? Is PPX the best way to do this?
<mcc> I'm worried about just passing my string ops into a function and doing allocations every time I use them.
Ray____ has quit [Ping timeout: 264 seconds]
seanmcl has joined #ocaml
seanmcl has quit [Max SendQ exceeded]
seanmcl has joined #ocaml
<nullcat> mcc: well, seems Drup sleeps early today, i'd like to answer your question but i am not really clear about your question...
<mcc> heh
<mcc> nullcat: I'm writing a program in which when i work with strings, it's usually in a codepoint list representation.
<mcc> nullcat: occasionally i have functions that will do something like, wrap a string in quotation marks. This means the literal "\"" shows up in the program.
<nullcat> ok
<mcc> i'm trying to figure out if there's some way to inline a literal like "\"" and have it be my custom string type, run through a converter i specify, instead of being a normal ocaml string
<mcc> I think there is probably some way to override ^ but idk about like {| or whatever
blandflakes has joined #ocaml
blandflakes has quit [Client Quit]
<nullcat> still don't know what's wrong with "\""^str^"\""
<nullcat> not sure. maybe someone else can answer your question
<nullcat> rgrinberg: ?
<mcc> nullcat: the problem is that str is not a string
<mcc> str is an int array
<nullcat> so you want to something like int array -> int array?
<nullcat> add two "\"" at both ends?
<mcc> i'm not sure i understand the question.
<nullcat> mcc: so you have "let str = [|97;98;99|]" to represent string "abc"?
blech_ has quit [Read error: Connection reset by peer]
blech_ has joined #ocaml
<mcc> yeah
<mcc> but in my code, i would rather say [%u "abc" ] or something
<mcc> and i think i know how to do this with ppx, and i'm not sure if there's a better way
<nullcat> just use ppx...
<nullcat> [%u "abc"] this is already ppx, right?
seanmcl has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
tinhead has joined #ocaml
tinhead has quit [Remote host closed the connection]
n3ss3s has quit [Ping timeout: 272 seconds]
<mcc> Yeah but it turns out like… idk
<mcc> PPX is a total pain to set up with Make :(
<mcc> (no idea if oasis makes it better?)
<mcc> for a local ppx, you have to compile in two passes, once for the ppx tool, once for the actual program :/
<nullcat> easy to use existing ppx library but it's painful to use your own.
<nullcat> yeah
<mcc> yes.
<mcc> i've been thinking about filing a bug on that >_>
freling has joined #ocaml
mcclurmc has joined #ocaml
tinhead has joined #ocaml
hay207 has quit [Quit: Leaving]
mcclurmc_ has quit [Ping timeout: 265 seconds]
tinhead has quit [Remote host closed the connection]
psy_ has joined #ocaml
rgrinberg has quit [Ping timeout: 246 seconds]
arj has joined #ocaml
rgrinberg has joined #ocaml
arj has quit [Quit: Leaving.]
inf-gropeoid has quit [Ping timeout: 250 seconds]
ygrek has quit [Ping timeout: 258 seconds]
tinhead has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
tinhead has quit [Remote host closed the connection]
tinhead has joined #ocaml
freling has quit [Quit: Leaving.]
MrScout has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ggole has joined #ocaml
Denommus` has joined #ocaml
swgillespie has joined #ocaml
MrScout has quit [Remote host closed the connection]
blandflakes has joined #ocaml
blandflakes has quit [Client Quit]
milosn has quit [Ping timeout: 250 seconds]
<nullcat> is there any built-in type to do either? e.g. type ('a, 'b) either = Left of 'a | Right of 'b
<ggole> No.
<ggole> Recently we got a result type in pervasives that's a bit like that though.
<nullcat> type ('a, 'b) result = Ok of 'a | Error of 'b?
<ggole> Yeah
<nullcat> thx
tinhead has quit [Remote host closed the connection]
mcc has quit [Quit: This computer has gone to sleep]
thomasga has joined #ocaml
milosn has joined #ocaml
zpe has joined #ocaml
kushal has joined #ocaml
Haudegen has quit [Ping timeout: 256 seconds]
Simn has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
TheLemonMan has joined #ocaml
oscar_toro has quit [Ping timeout: 258 seconds]
rgrinberg has quit [Ping timeout: 246 seconds]
Haudegen has joined #ocaml
oscar_toro has joined #ocaml
rgrinberg has joined #ocaml
oscar_toro has quit [Ping timeout: 272 seconds]
ousado has quit [Ping timeout: 252 seconds]
ygrek has joined #ocaml
blandflakes has joined #ocaml
matason has joined #ocaml
blandflakes has quit [Client Quit]
psy_ has quit [Ping timeout: 240 seconds]
cml has joined #ocaml
matason has quit [Ping timeout: 265 seconds]
mort___ has joined #ocaml
matason has joined #ocaml
Alain has joined #ocaml
tmtwd_ has joined #ocaml
tmtwd has quit [Read error: Connection reset by peer]
rgrinberg has quit [Ping timeout: 264 seconds]
tobiasBora has quit [Ping timeout: 265 seconds]
tobiasBora has joined #ocaml
amnn has joined #ocaml
rishabhjain has joined #ocaml
rishabhjain has quit [Client Quit]
ingsoc has joined #ocaml
AltGr has left #ocaml [#ocaml]
zpe_ has joined #ocaml
ygrek has quit [Ping timeout: 250 seconds]
zpe has quit [Ping timeout: 272 seconds]
tmtwd_ has quit [Ping timeout: 276 seconds]
blandflakes has joined #ocaml
xificurC_ has quit [Quit: WeeChat 1.2]
xificurC has joined #ocaml
blandflakes has quit [Client Quit]
<ollehar> neat
sdothum has joined #ocaml
nullcat has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ia0 has quit [Quit: leaving]
ia0 has joined #ocaml
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 264 seconds]
<vbmithr_> ideas to have the equivalent of monad transformers in ocaml ?
<vbmithr_> problem: I use several monads at once, and it's painful to handle this
manizzle has quit [Remote host closed the connection]
Sim_n has joined #ocaml
Simn has quit [Ping timeout: 252 seconds]
Sim_n is now known as Simn
Sim_n has joined #ocaml
Kakadu has joined #ocaml
Simn has quit [Ping timeout: 276 seconds]
Haudegen has quit [Ping timeout: 265 seconds]
inf-gropeoid has joined #ocaml
dsheets has quit [Ping timeout: 265 seconds]
thomasga has quit [Quit: Leaving.]
kdas_ has joined #ocaml
kushal has quit [Ping timeout: 250 seconds]
kdas_ has quit [Remote host closed the connection]
kushal has joined #ocaml
rgrinberg has joined #ocaml
thomasga has joined #ocaml
Haudegen has joined #ocaml
rgrinberg has quit [Ping timeout: 244 seconds]
seanmcl has joined #ocaml
thomasga has quit [Quit: Leaving.]
siddharthv_away is now known as siddharthv
seanmcl has quit [Client Quit]
seanmcl has joined #ocaml
jabesed has joined #ocaml
Sim_n is now known as Simn
wwilly has joined #ocaml
hay207 has joined #ocaml
blandflakes has joined #ocaml
yomimono has quit [Ping timeout: 258 seconds]
blandflakes has quit [Client Quit]
Hannibal_Smith has joined #ocaml
freling has joined #ocaml
freling has quit [Client Quit]
matason has quit [Ping timeout: 246 seconds]
<reynir> hrm
<reynir> in ppx_tools.metaquot [%pat? x] matched the pattern with the variable "x"
<reynir> would be nice if you could match any name
rgrinberg has joined #ocaml
<Drup> _ ?
<Drup> ah
<companion_cube> vbmithr_: maybe with functors that build a new monad type
<Drup> reynir: just use the constructor directly
<reynir> Ppat_var x ?
Sim_n has joined #ocaml
rgrinberg has quit [Ping timeout: 272 seconds]
Simn has quit [Ping timeout: 252 seconds]
Reventlov has quit [Quit: leaving]
Reventlov has joined #ocaml
Reventlov has quit [Client Quit]
Reventlov has joined #ocaml
thomasga has joined #ocaml
blandflakes has joined #ocaml
_andre has joined #ocaml
freling has joined #ocaml
Haudegen has quit [Ping timeout: 255 seconds]
<vbmithr_> companion_cube: thanks :)
<vbmithr_> I'll think about it
tobiasBora has quit [Ping timeout: 272 seconds]
<companion_cube> be careful that code that makes heavy use of monads might be slow
<companion_cube> because OCaml doesn't optimize much this kind of code (currently)
Ray____ has joined #ocaml
Hannibal_Smith has quit [Quit: Leaving]
matason has joined #ocaml
leafac has joined #ocaml
Denommus` has quit [Ping timeout: 246 seconds]
dsheets has joined #ocaml
simn__ has joined #ocaml
<vbmithr_> ok
<vbmithr_> interesting!
Haudegen has joined #ocaml
yomimono has joined #ocaml
Sim_n has quit [Ping timeout: 276 seconds]
simn__ is now known as Simn
tobiasBora has joined #ocaml
jita has joined #ocaml
<companion_cube> maybe flambda (a branch with more optimizations) might help making monadic code more efficient
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 250 seconds]
amnn has quit [Read error: Connection reset by peer]
amnn has joined #ocaml
blandflakes has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
seanmcl has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
smondet has joined #ocaml
jonludlam has joined #ocaml
leafac has quit [Quit: Leaving.]
leafac has joined #ocaml
octachron has joined #ocaml
siddharthv is now known as siddharthv_away
Ray____ has quit [Ping timeout: 265 seconds]
idegen has joined #ocaml
stux|RC-only has quit [Quit: Aloha!]
freling has quit [Quit: Leaving.]
stux|RC-only has joined #ocaml
leafac has quit [Quit: Leaving.]
<Drup> reynir: yes
rgrinberg has joined #ocaml
seanmcl has joined #ocaml
Gama11 has joined #ocaml
agarwal1975 has joined #ocaml
rgrinberg has quit [Ping timeout: 244 seconds]
leafac has joined #ocaml
blandflakes has joined #ocaml
badkins has joined #ocaml
blandflakes has quit [Client Quit]
Alain has quit [Quit: Page closed]
Sim_n has joined #ocaml
Simn has quit [Ping timeout: 252 seconds]
waneck has joined #ocaml
A1977494 has joined #ocaml
Gama11 has quit [Read error: Connection reset by peer]
Gama11 has joined #ocaml
Submarine has joined #ocaml
Submarine has joined #ocaml
Sim_n is now known as Simn
A1977494 has left #ocaml [#ocaml]
seanmcl has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Gama11_ has joined #ocaml
mcclurmc has joined #ocaml
Gama11 has quit [Ping timeout: 258 seconds]
mcclurmc has quit [Ping timeout: 256 seconds]
mcclurmc has joined #ocaml
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 264 seconds]
shinnya has joined #ocaml
The_Mad_Pirate has quit [Ping timeout: 256 seconds]
freling has joined #ocaml
tane has joined #ocaml
Submarine has quit [Remote host closed the connection]
blandflakes has joined #ocaml
cml has quit [Quit: Page closed]
m___ has joined #ocaml
mort___ has left #ocaml [#ocaml]
<m___> Is Janestreet core_kernel supposed not to have unix dependencies?
<dmbaturin> I believe it is, but I didn't try (not a core fan).
<m___> was using time_ns of core_kernel, but found that it looks to be the only module with unix dependencies
<vbmithr_> m___: I think it is "supposed", yes, but maybe not there yet
Hannibal_Smith has joined #ocaml
kdef has joined #ocaml
matason has quit [Ping timeout: 252 seconds]
matason has joined #ocaml
psy_ has joined #ocaml
<vbmithr_> I have a question about existential stuff
<vbmithr_> val send_bigstring : [> `Send] socket -> CCBigstring.t -> unit Lwt.t
The_Mad_Pirate has joined #ocaml
mcc has joined #ocaml
<vbmithr_> I'd like to express that the type of this function is "there is a type such that this type is [> `Send] socket)
<ggole> vbmithr_: what do you mean?
<vbmithr_> Error: The implementation lib/nanomsg_lwt.ml
<vbmithr_> does not match the interface lib/nanomsg_lwt.cmi:
<vbmithr_> Values do not match:
<vbmithr_> val send_bigstring : '_a socket -> CCBigstring.t -> unit Lwt.t
<vbmithr_> is not included in
waneck has quit [Read error: Connection reset by peer]
<vbmithr_> val send_bigstring :
<vbmithr_> [> `Send ] socket -> CCBigstring.t -> unit Lwt.t
<vbmithr_> Do you understand this. What does it means that '_a socket != [> `Send ] socket
<Drup> value restriction.
<vbmithr_> How do I fix this
<vbmithr_> ?
<Drup> wild guess, you eta-expand
<Drup> can you link to the code ?
<vbmithr_> careful is the branch name.
<tane> Can't one just add the [> `Send] to the signature?
<vbmithr_> I did it
<ggole> If it is an eta-expansion problem, the signature isn't the issue
djellemah has quit [Ping timeout: 265 seconds]
<ggole> Yeah, send_bigstring_buf is partially applied.
<Drup> vbmithr_: in the implementation here, socket is not parametrized
<Drup> hum, nevermind, wrong branch
<Drup> actually, no, socket still not parametrized on the right branch
<vbmithr_> But I sort of understand the problem
<vbmithr_> it's a phantom type no ?
<Drup> vbmithr_: ah, you have two sockets types
<vbmithr_> But basically the thing I want to achieve is the class phantom type usage
<vbmithr_> yes
<Drup> i'm a bit slow today :|
<Drup> add a variance annotation on your socket type
<Drup> type +'a socket
<Drup> in both the .mli and the .ml
<vbmithr_> ok
<Drup> I think it would also be better to add a constraint on the 'a
<vbmithr_> same issue
<Drup> constraint 'a = [< ... ]
<vbmithr_> yeah, that might do the trick
<Drup> no, that will not, but it's a good thing to do it :)
<vbmithr_> on both the signature and the actual type ?
<Drup> yes
<vbmithr_> done
<vbmithr_> It seems the error move somewhere else now
<vbmithr_> i.e. maybe this did the trick
Haudegen has quit [Ping timeout: 246 seconds]
<mcc> hey, drup, i have some silly questions >_>
<mcc> i'm trying to rework emily to represent strings as int arrays rather than strings internally
<mcc> this is turning out more awkward than i expected
<companion_cube> you want arrays of codepoints?
<mcc> Yeah.
<companion_cube> the alternative is using utf8
<companion_cube> it's pretty simple
<ggole> No indexing that way
<ggole> And iteration becomes a bit more complicated
<mcc> Problems I am running into: - Buffer.t appears to be a byte array; can i get something like that for an int array? - Is there any way other than PPX to get a "string literal" operator that is internally represented as my codepoint array? - This looks unfixable, but uutf uses int32 arrays for codepoint arrays and sedlex uses int arrays *gag*
<mcc> ggole: yeah i'd be looking at quadratic time to iterate over an array
<mcc> ggole: unless i changed the semantics of iteration in my language just to fit the ocaml implementation better :/
<ggole> You can implement an extensible array easily enough (or use an existing one)
<ggole> There's one in Batteries (if you decided to use that).
slash^ has joined #ocaml
<mcc> i'm feeling more and more tempted by Batteries.
<ggole> For string literals... hmm
zpe_ has quit [Remote host closed the connection]
<ggole> For the ocaml side you could write a conversion with a short name and just use that.
<ggole> It would be slightly clumsy, but your users wouldn't see.
<vbmithr_> Drup: The constraint did the trick!!
<mcc> a what?
<vbmithr_> Drup: I'd like to understand why now
<ggole> A function that transforms an ocaml string (literal) to an emily stirng
yomimono has quit [Ping timeout: 276 seconds]
<Drup> vbmithr_: you know what value restriction is ?
<mcc> ggole: so the problem i'm encountering, and maybe this is premature optimization
<Drup> mcc: if you think "but, muh, string literals are not constants"
<vbmithr_> not really
<vbmithr_> I could read http://mlton.org/ValueRestriction
<Drup> yes, it's 1) premature optimization 2) something flambda will do in the future anyway
rgrinberg has joined #ocaml
<mcc> ggole: is that i've got like… "\""^str^"\"". so if i wrap both of the "\""s in this function, i'm calling a function each time, and creating a nontrivial amount of garbage
<Drup> vbmithr_: there is a chapter about value restriction in RWO
<Drup> might be more appropriate
<mcc> drup: what is flambda? ocaml is going to add an optimization where calling a function on a constant is evaluated at compile time?
<ggole> mcc: oh, I see
<Drup> mcc: roughly, yes
<ggole> You could intern the strings?
<Drup> (it's doing more than that, but the end result for you, yes)
<mcc> ggole: i could, yeah! it would be awkward but it's definitely an option
<mcc> drup: what is the timeline for this?
<Drup> my personal bet is end of th year
tmtwd has joined #ocaml
<mcc> by intern you're just thinking put at the top of the file let quote = toIntArray "\"" ?
<ggole> No (although that would work)
<ggole> I was thinking of maintaining a table of literals so you don't reconstruct them each time
<ggole> Not suitable if strings are mutable in your language.
<Drup> ggole: stop optimizing prematurely T__T
rgrinberg has quit [Ping timeout: 240 seconds]
yomimono has joined #ocaml
<ggole> Or if they have identities that are supposed to be different for each literal, I suppose
ygrek has joined #ocaml
<mcc> ggole: no mutable strings in this language.
<mcc> ggole: might have a mutable string *type* at some point, but gonna implement it with ropes.
rgrinberg has joined #ocaml
<Drup> and you wan't interop with C ?
<Drup> you need a byte array at some point
<ggole> A byte array would do that job better than a string, surely
* ggole points at... OCaml
<Drup> ggole: then you have an issue with polymorphism
<vbmithr_> weak polymorphism = existential type ?
* Drup poitns at ... OCaml
<Drup> vbmithr_: no
<vbmithr_> ok
<vbmithr_> a bit lost here
Haudegen has joined #ocaml
tinhead has joined #ocaml
<Drup> vbmithr_: you read the RWO chapter ?
<ggole> Drup: if you prefer, byte_array rather than byte array
inf-gropeoid is now known as pyon
<vbmithr_> I'm just going to
<Drup> well, that's the same as string then :D
<Drup> or rather, bytes*
<ggole> vbmithr_: tldr, weakening some type variables patches a soundness problem due to the possibility of mutation
<Drup> I doubt that's very enlightening ...
<ggole> It gets across that it is a limitation and not a type system feature.
<ggole> Sure, for the details read the thingy.
<vbmithr_> yep
<vbmithr_> I'm in it
<mcc> drup: i'm going to interop with C and yes, i see your point.
<vbmithr_> This transformation is referred to as eta expansion and is often useful to resolve problems that arise from the value restriction.
<vbmithr_> In my case it was not eta expansion then
<vbmithr_> Wasn't an issue of partial application
Sim_n has joined #ocaml
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
AlexRussia has quit [Ping timeout: 244 seconds]
TheLemonMan has joined #ocaml
hay207 has quit [Ping timeout: 272 seconds]
Simn has quit [Ping timeout: 276 seconds]
<vbmithr_> The issue here is that the signature, by virtue of being abstract, has obscured the fact that Concat_list.t is in fact an immutable data type.
<vbmithr_> This could have been this
hay207 has joined #ocaml
tinhead has quit [Remote host closed the connection]
jita has quit [Quit: Page closed]
hay207 has quit [Quit: Leaving]
rand000 has joined #ocaml
yomimono has quit [Ping timeout: 245 seconds]
tmtwd has quit [Quit: Leaving]
waneck has joined #ocaml
freling has quit [Quit: Leaving.]
sh0t has joined #ocaml
<sh0t> Guys I have this attempt of a lexer: http://paste.ubuntu.com/11523863/ why when I input something on the stdin i always interpret it correctly (so i print the token) but then i also print the error of an unrecognized token...i suspect is due to the the fact that i alwyas press enter after a good token has been input?
leafac has quit [Quit: Leaving.]
MrScout has joined #ocaml
thomasga has quit [Quit: Leaving.]
wwilly has left #ocaml ["Leaving"]
octachron has quit [Quit: Leaving]
AlexRussia has joined #ocaml
<Drup> vbmithr_: yes, that's the issue
thomasga has joined #ocaml
<Drup> vbmithr_: it's the subsection "Relaxing the Value Restriction"
<Drup> (the part about covariance, in particular)
<Drup> sh0t: yes, '\n' is not a recognize character in your lexer.
<vbmithr_> ok, but the variance does not fix my code
<vbmithr_> although the constraint fixes it
<Drup> it doesn't ?
<vbmithr_> no
<Drup> no no, the variance fixed it :)
<Drup> the constraint had nothing to do with it
<sh0t> Drup if i add a token for '\n'...i get similar error let me try again
<vbmithr_> no, I did not put any variance at all
<vbmithr_> The reality is exactly the opposite of what you say
<Drup> sure you did, you changed it for "type +'a socket"
<vbmithr_> no.
<sh0t> srorry Drup but it seems to me i have arule for '\n'
<sh0t> | '\n' {printf "\n"; flush stdout; rr_syntax lexbuf}...
<sh0t> ahhh
<vbmithr_> I made some experiment and figured out that it doesn't work without a constraint, whatever variance I put
<sh0t> but it comes after | _ ..
<vbmithr_> And with the constraint, ocaml does not care about the variance at all.
<Drup> vbmithr_: in the .ml or the .mli ?
<vbmithr_> both
<Drup> that is not normal
<Drup> show me
Haudegen has quit [Ping timeout: 246 seconds]
<vbmithr_> and the corresponding .mli
<vbmithr_> this compiles
tinhead has joined #ocaml
<Drup> that's just wrong
tinhead has quit [Changing host]
tinhead has joined #ocaml
dsheets has quit [Ping timeout: 265 seconds]
leafac has joined #ocaml
kushal has quit [Ping timeout: 244 seconds]
yomimono has joined #ocaml
tinhead has quit [Remote host closed the connection]
<vbmithr_> well maybe I have hallucinations, but…
jwatzman|work has joined #ocaml
<Drup> vbmithr_: the careful branch doesn't compile for me, something about nanomsg/nn.h
matason has quit [Ping timeout: 244 seconds]
<Drup> eh, it'll work better with nanomsg installed, I guess
<vbmithr_> yeah
Kakadu has quit [Quit: Page closed]
<Drup> I think I made a huge mistake, I upgraded aspcud ~~
<vbmithr_> why ?
<vbmithr_> it should work.
m___ has quit [Ping timeout: 246 seconds]
<Denommus> is there a "('a -> 'a Stream.t) -> 'a Stream.t" function?
darkf has quit [Quit: Leaving]
<vbmithr_> Yes, although in the future, core's error type will be in pervasives.
<vbmithr_> True ?
<Drup> Denommus: how does that work ?
Anarchos1 has joined #ocaml
jonludlam has quit [Ping timeout: 256 seconds]
<Denommus> Drup: like Haskell's mfix for IO
yomimono has quit [Ping timeout: 258 seconds]
<Denommus> Drup: it executes the function only once, with the eventual output fed back as the input
<Denommus> Drup: that's probably not the exact function signature, because the function should probably be lazy somehow
<Drup> vbmithr_: still not compiling, due to ctypes this time
<Drup> do you need the dev version ?
tinhead has joined #ocaml
octachron has joined #ocaml
<vbmithr_> not sure.
<Drup> ah, nevermind, got it
<Drup> (and yeah, there is an issue with last aspcud)
<vbmithr_> slower than before ?
<vbmithr_> report an issue maybe
<vbmithr_> to the original guy
<Drup> no, it's the opam interface
<Drup> "External solver failed with inconsistent return value."
dsheets has joined #ocaml
<Drup> vbmithr_: your package still doesn't compile :|
leafac1 has joined #ocaml
<Drup> "lib/nanomsg_stubs.c:3:37: erreur fatale: ctypes/cstubs_internals.h : Aucun fichier ou dossier de ce type"
<Drup> ah, finally
leafac has quit [Ping timeout: 272 seconds]
<Drup> ok, I got it
<Drup> vbmithr_: it's only working because the function send_bigstring is inside the same module as the declaration of 'a socket
<Drup> so the compiler know it's covariant
freling has joined #ocaml
<vbmithr_> ok
<Drup> you should really expose that it's covariant.
<vbmithr_> ok.
<rgrinberg> vbmithr_: did you miss this development https://github.com/ocaml/ocaml/pull/147
<rgrinberg> :P
<Drup> your package is going to be useless anyway, as subtyping on capability will not work
<vbmithr_> ?
<Drup> if 'a socket is not covariant, you can't give a socket of type [`Read] socket to a function expecting [< `Read | `Write]
<vbmithr_> yes, so I want it covariant then
<vbmithr_> I thought you were saying that the whole of my code was useless
xificurC has quit [Read error: Connection reset by peer]
<Drup> unusable* would have been a better choice of word :p
<ggole> You can with coercions?
Submarine has joined #ocaml
Submarine has joined #ocaml
<ggole> But that's annoying.
<Drup> ggole: not always
<ggole> Oh, it's abstract
<ggole> Or private
<ggole> Right, I was thinking of plain variants
<ggole> Er, plain poly variants
<Drup> yeah, it's a phantom
oscar_toro has joined #ocaml
<Drup> guaranteed 100% non terminating.
<Drup> (and not making sense, either)
<Drup> (actually, it terminates by an exception if you return en empty list, but you got it)
Haudegen has joined #ocaml
ygrek has quit [Ping timeout: 265 seconds]
<Drup> oh, actually, it's a Lazy.Undefined, I didn't know that one
ollehar1 has joined #ocaml
nullcat has joined #ocaml
<Denommus> Drup: I get exceptions every time I use that XD
<Denommus> Drup: but the idea is that it SHOULD terminate. I guess I'll take your idea and try to implement it with streams
mcc has quit [Quit: This computer has gone to sleep]
Kakadu has joined #ocaml
blech_ has quit [Ping timeout: 255 seconds]
blech_ has joined #ocaml
waneck has quit [Quit: Leaving]
kushal has joined #ocaml
tinhead has quit [Remote host closed the connection]
tinhead has joined #ocaml
tinhead has joined #ocaml
thomasga has quit [Quit: Leaving.]
ggole has quit []
mort___ has joined #ocaml
blech__ has joined #ocaml
blech_ has quit [Ping timeout: 258 seconds]
octachron has quit [Quit: Leaving]
ousado has joined #ocaml
ousado has joined #ocaml
<sh0t> HI guy sorry for the stupid question i am very new of ocaml. I have a function pprint defined in a file pprint.ml which I want to call on the file lexer.mll how do I go and do that? I tried to include the file with open Pprint but it doesnt work it says reference unbounded
<sh0t> *guys
nullcat has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Denommus> sh0t: how are you compiling your project?
rgrinberg has quit [Ping timeout: 256 seconds]
<sh0t> like this: ocaml -o lexer lexer.cmo parser.cmo ast.cmo pprint.cmo
<sh0t> ofcourse before i compiled with -c the files...and
<sh0t> i got lexer.ml from lexer.mll with ocamllex and parser.ml from parser.mly with ocamlyacc
<Denommus> sh0t: pprint.cmo should be before lexer.cmo, shouldn't it?
<sh0t> oh i didn't know the linker's input has to follow an order...
<sh0t> let me try
<Denommus> "The order in which the .cmo files are given to ocamlc during the linking phase determines the order in which the module definitions occur." http://caml.inria.fr/pub/docs/manual-ocaml/moduleexamples.html
<Denommus> sh0t: I recommend you to learn oasis once you get the hand of things. It will make the compilation process easier
<sh0t> yeah Denommus thanks for the hint...t was really that...
<sh0t> oassi
<sh0t> oasis
<sh0t> what's that?
<sh0t> somethinkg like...gnutools
<sh0t> ?
<sh0t> to make makefiles...and stuff
freling has quit [Quit: Leaving.]
<Denommus> sh0t: yes, something like that :-)
<sh0t> Ok Denommus thanks a lot...I'llprobably stick around this chan for a long time :)
<Denommus> sh0t: you're welcome, come by whenever you need
<sh0t> thanks !
tinhead has quit []
<Denommus> is there anything like MVar in Batteries or Core?
tmtwd has joined #ocaml
Sim_n is now known as Simn
<Denommus> maybe something like channels
slash^1 has joined #ocaml
slash^ has quit [Ping timeout: 252 seconds]
noze has joined #ocaml
<noze> is sedlex compatible with menhir?
Gama11_ has quit [Remote host closed the connection]
Gama11 has joined #ocaml
manizzle has joined #ocaml
slash^1 has quit [Ping timeout: 252 seconds]
<Denommus> noze: it is
<Denommus> noze: I mean, you can make them compatible
kdef has quit [Quit: Leaving]
<sh0t> Hey Denommus: if I am doing patter matching...and for a case I want to do many actions...should i put them between begin end...?
blandflakes has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
<sh0t> or is it enough to put a semicolon between the commands?
dtscode has joined #ocaml
<noze> Denommus: sweet, thanks
<sh0t> i don't understand the role of the comma isn't i just for sequence of commands
<sh0t> ?
Gama11 has quit [Read error: Connection timed out]
Gama11 has joined #ocaml
<blech__> comma is tuple. Semicolon is execute, ignore, perform next
<sh0t> I'll make it easier what's wrong in this code? It says syntax error at line 58 http://paste.ubuntu.com/11526713/
<dtscode> Does anyone happen to know of an ocaml md file for gedit?
<blech__> sh0t, try not ending the last line with a semicolon
<noze> sh0t: when you have nested match statements you should enclose the inner ones with begin .. end
<blech__> that too, I was going to say parens
<sh0t> ah
<sh0t> lemme try
<sh0t> :)
<blech__> also where is 's' bound? (line 53)
<sh0t> oh blech__ yeah i didn't see it
<sh0t> it's supposed to be a v
<blech__> little tip, you can actually nest those
<sh0t> i tried to fix it like this
<sh0t> but i still have problems could you please check?
<sh0t> (I mean i can read (and I do) of ocaml...but until I get my hands dirty I can't learn)
<sh0t> *the manual
zpe has joined #ocaml
<blech__> sh0t, what error are you getting?
<sh0t> the very specific error: 'Syntax Error'
<blech__> also what I meant was you can get rid of the internal match by matching against ScalarAssignment ( Name n, e)
<sh0t> line 59
<sh0t> oh right!
<sh0t> i am gonna try that but the error is belowe that
<Denommus> sh0t: sorry, I was away
<sh0t> no problem...i am getting a 'syntax error'... at line 55 http://paste.ubuntu.com/11526909/
<blech__> sh0t, the error isn't actually on that line
<blech__> that's where the compiler barfs
<blech__> but it's because it's expecting something that's not a blank line
<sh0t> yeah
<blech__> do me a favor
<blech__> don't end your last match with a semicolon
<Denommus> sh0t: I can't help you right now, kinda busy, sorry
<sh0t> No prob. Denommus. Ok blech__!
<sh0t> blech__, i did but it's not the problem
jeffmo has joined #ocaml
kushal has quit [Quit: Leaving]
<sh0t> | _ -> printfn("notImp")
<blech__> in each.
<blech__> or rather, more specifically
<blech__> at the end of the Bool match
<sh0t> blech__, i think this semicolon are creating me a lot of problems...can you please explain to me the role
<sh0t> of the semicolon?
amnn_ has joined #ocaml
<sh0t> when is it needed?
<sh0t> *these
<blech__> <expression 1>;<expression 2>
<blech__> the semicolon executes expression 1, ignores the result, and then executes expression 2
<blech__> when you end with a semicolon, the compiler still expects you to provide a new expression
rgrinberg has joined #ocaml
<blech__> so let's simplify what's happening
Cyanure has joined #ocaml
<blech__> let f x = match x with A -> print_string("A") | B -> print_string("B"); let f' x = x + 1 ;;
<blech__> results in the same syntax error you've got earlier
amnn has quit [Ping timeout: 256 seconds]
<sh0t> mm ok
<blech__> so try deleting the semicolon at the end of the pprintExpC definition and tell me if that improves things
<blech__> at the end of the bool match
<sh0t> i did and it improves in the sense that at least i get an type error now :) but now i don't undertand wheere it comes from cause the type constructros seem ok to me
<sh0t> the error is:
<blech__> sh0t, generally if you want to work heavily with semicolons wrap them in a block (parens, begin/end) or resort to using ';;'
<sh0t> ok
rgrinberg has quit [Ping timeout: 256 seconds]
<blech__> the problem you're having now is because you used a comma
<blech__> on line 52
<blech__> the line should actually read
<blech__> printf "%s<-" n
<blech__> no parens or commas
<sh0t> so i was passing a pair?
<blech__> exactly
<sh0t> and not two different thins
<sh0t> got it
<sh0t> yep thanks blech__ :D
<blech__> what language are you coming from?
<Denommus> noze: I'm thinking of make a simple library that only contains a functor with all that boilerplate
paarth has joined #ocaml
blech__ has left #ocaml ["Leaving"]
<paarth> im blech, finally recovering my actual nick
rgrinberg has joined #ocaml
ncthom91 has joined #ocaml
mort___ has quit [Quit: Leaving.]
leafac1 has quit [Quit: Leaving.]
ncthom91 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
leafac has joined #ocaml
s1n4 has quit [Quit: leaving]
s1n4 has joined #ocaml
Hannibal_Smith has quit [Quit: Leaving]
<sh0t> paarth, did u ask me?
<paarth> ye
zpe has quit [Remote host closed the connection]
<sh0t> i come from imperative stuff...C java...for functional stuff i know lambda calculus :P
<paarth> are you familiar with the idea of an expression oriented language?
jonludlam has joined #ocaml
<dmbaturin> sh0t: Note that some things from untyped lambda calculus won't work in types ones. :)
<sh0t> paarth, mm not really
<sh0t> dmbaturin, haha yeah :) that's the good thing about types
<paarth> sh0t, hmm the wiki for this is not very helpful
nullcat has joined #ocaml
Hannibal_Smith has joined #ocaml
<paarth> long story short C and java and such work off of commands
<paarth> you tell them do this thing, then do this other thing, then explicitly return
<paarth> ocaml doesn't quite work that way. A function is defined as a single expression (that expression is treated as its return value)
<sh0t> ah sure...it's a functional language
<sh0t> is it this you mean?
<paarth> they are slightly different concepts but yes
<sh0t> (you can still do something "operationally" though..)
<sh0t> i mean...u can have states
<paarth> yes! but this does not behave the same way as it does in C/Java
<sh0t> mm can u be more specific?
<paarth> I'm mentioning this to bring home the point about semicolons
<paarth> do you understand why you don't need the final semicolon in a chain? (and in some cases don't really want it)
lordkryss has joined #ocaml
<sh0t> because there is no last command...to execute... so i can't "take the last value" forget it and execute the following comman
<sh0t> cause there is no last command
<sh0t> is this u mean?
<dmbaturin> "foo x; bar y" means the same as "let _ = foo x in bar y".
leafac has quit [Quit: Leaving.]
<sh0t> yeah
<sh0t> i get this..like u execute foo x...u forget about the result...and u execute bar y
<paarth> sh0t, correct. In some cases the compiler will let it slide (last semicolon in a block) but generally you use them as a statement separator, not a statement ender
<sh0t> ok paarth this makes sense now
<sh0t> adn thanks dmbaturin for the example
<raboof> I'm trying to build an application with '-dontlink unix', and it fails because apparently somewhere something is still pointing to Unix
<raboof> is there a way to get a 'trace' of where those references come from? I've been playing a bit with ocamlfind and ocamldep but didn't get very far yet (pretty new to OCaml, playing with Mirage)
<smondet> raboof: if it is at the findlib level you can use the funciton Findlib.package_deep_ancestors
<smondet> *function
<smondet> example: Findlib.package_deep_ancestors ["native"] ["cohttp"];; (after #require "findlib";;)
jabesed has quit [Ping timeout: 256 seconds]
kdef has joined #ocaml
tmtwd has quit [Remote host closed the connection]
leafac has joined #ocaml
nullcat has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
nullcat has joined #ocaml
nullcat has quit [Client Quit]
ncthom91 has joined #ocaml
blandflakes has joined #ocaml
<sh0t> paarth, s it possible, in a pattern match, to unify two branches...
<paarth> unify?
<sh0t> like in a case switch in C...without break
<paarth> yes
<sh0t> case a-> b| case c-> b
<sh0t> b is the same...
<paarth> yeah that's just A | C -> b
<sh0t> ok thanks
<paarth> if you don't specify an expression with -> then it groups the cases
<dsheets> in patterns, `|` is a pattern operator. i.e. you can do | { field = (A | C) } -> b
Submarine has quit [Remote host closed the connection]
obadz has quit [Ping timeout: 258 seconds]
ingsoc has quit [Ping timeout: 250 seconds]
tinhead has joined #ocaml
tinhead has joined #ocaml
ingsoc has joined #ocaml
hay207 has joined #ocaml
Hannibal_Smith has quit [Quit: Leaving]
<sh0t> ok
freling has joined #ocaml
<sh0t> guys i have another silly question...i am parsing...in a while true loop a file...and i am catching an Eof exception...now the main function output type is unit but i don't know then how to end this line :
<sh0t> with Eof ->
<tane> you want to return unit?
ollehar1 has quit [Quit: ollehar1]
<sh0t> yes
obadz has joined #ocaml
<Anarchos1> sh0t -> ()
<tane> with Eof -> ()
<tane> yeah :)
<sh0t> ahha thanks
freling has quit [Quit: Leaving.]
amnn_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Sim_n has joined #ocaml
freling has joined #ocaml
amnn has joined #ocaml
freling has quit [Client Quit]
Simn has quit [Ping timeout: 252 seconds]
amnn has quit [Client Quit]
Cyanure has quit [Remote host closed the connection]
ncthom91 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tane has quit [Quit: Verlassend]
amnn has joined #ocaml
wraithm has joined #ocaml
wraithm has quit [Client Quit]
tinhead has quit [Remote host closed the connection]
swgillespie has joined #ocaml
ingsoc has quit [Ping timeout: 252 seconds]
<sh0t> whats the easiest way to implement an "environment" in ocaml...like a mapping from variables to values
<sh0t> like a list ?
<sh0t> a list of pairs...
<sh0t> then the access would be pretty long is there something like
<sh0t> a map key-> values
<sh0t> data structre in the standard lib?
ncthom91 has joined #ocaml
<smondet> sh0t: there are the `Map` and `Hashtbl` modules
<dmbaturin> sh0t: There's List.assoc function in pervasives.
Sim_n has quit [Quit: Leaving]
<sh0t> ok thanks i'll look at those
<dmbaturin> List.assoc "bar" ["foo", 1; "bar", 2]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
<dmbaturin> In real-life settings Map or Hashtbl are better due to performance, but for quick experiments assoc is easier to use.
<dmbaturin> (The difference is that Map is immutable, while Hashtbl is mutable)
Anarchos1 has quit [Ping timeout: 240 seconds]
eventualbuddha has quit [Ping timeout: 276 seconds]
freling has joined #ocaml
andreypopp has quit [Ping timeout: 256 seconds]
Algebr has joined #ocaml
jcloud has quit [Ping timeout: 272 seconds]
<smondet> dmbaturin: sh0t: the other difference that often people forget is that Map is guaranteed O(ln(n)) and Hashtbl is often O(1)-ish but has a worst case of O(n)
S11001001 has quit [Ping timeout: 265 seconds]
tg has quit [Ping timeout: 272 seconds]
<sh0t> oh ok! good to know
tg has joined #ocaml
bobpoekert has quit [Read error: Connection reset by peer]
wraithm has joined #ocaml
mariusae has quit [Ping timeout: 276 seconds]
The_Mad_Pirate has quit [Read error: Connection reset by peer]
The_Mad_Pirate has joined #ocaml
<zozozo> is it worth it to create a pull request on the ocaml repo on github to fix a typo in the documentation of Pervasives ?
ygrek has joined #ocaml
Gama11 has quit [Remote host closed the connection]
kdef has quit [Quit: Leaving]
Kakadu has quit [Remote host closed the connection]
amnn has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
blandflakes has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
freling has quit [Quit: Leaving.]
lordkryss has quit [Quit: Connection closed for inactivity]
<sh0t> guys what's the purpose of having the keyword type to declare a new type...if u never use it...like when u declare a function u don't specify the types of the arguments
<sh0t> ?
<def`> the keyword type is for type declaration
eventualbuddha has joined #ocaml
<def`> the inference will only find out type expressions
<sh0t> def`, could u be more specific i don't understand
<def`> sure wait
<sh0t> thanks
<def`> type t = A
ncthom91 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<def`> let my_fun A = "it's an A"
n3ss3s has joined #ocaml
<def`> the first line is a type declaration, it creates something new : a type named t, and a value, named A, of type t
<def`> (actually a value constructor, but that doesn't matter)
<sh0t> AH
<sh0t> A is value...
<sh0t> i thought t was a name of the type defined by the r.hs
<sh0t> like type t= (A* B)
<sh0t> t is the type of pairs a*b
<def`> the second line says that the function my_fun maps the value (constructor) A to the string "it's an A"
<def`> hence, my_fun has type t -> string
<sh0t> so A is a value
<def`> what you say is also valid, also in this case it would be a type alias. That's another role of the type keyword
<sh0t> mm
<def`> the syntax would be type t = a * b (type names are always lower case)
<def`> and it means that every time you use the type t, it's the same as using the type a * b
<def`> Have you done C?
<sh0t> yeah
<def`> type t = alias is a typedef
<sh0t> ok
<def`> type t = (*some other syntaxes you will discover, is a type declaration like a struct, enum, union … *)
<sh0t> say i do something like:
<sh0t> type ty = (a * b) list
<sh0t> in this way ty is the new type
<def`> But then you might wonder why having aliases. They serve an important purpose for a feature you will discover later in the module system.
<sh0t> list of pairs
<sh0t> ok
<sh0t> i don't get the thing of the constructor though
<def`> it's not a new type, it's another name for list of pairs
<def`> of a *b
<sh0t> mm ok
<sh0t> sure
<sh0t> it'sa new name for an existing type
<def`> exactly.
<def`> compare:
<def`> typedef int my_int;
<def`> struct my_int { int payload; };
<sh0t> ah!
andreypopp has joined #ocaml
<def`> first case is really another name, second case you create something new
<def`> the equivalent in ocaml would be
<def`> type my_int = int
<def`> versus
<def`> type my_int = { payload: int }
<sh0t> where payload is the constructor right?
S11001001 has joined #ocaml
<sh0t> so now payload(5) payload(0) are all values of the type my_int?
<def`> In this case it's a field of the record (which are the equivalent "C struct" in OCaml)
<dmbaturin> sh0t: {payload: 42} would be a value of type my_int.
<dmbaturin> * {payload = 42}
ncthom91 has joined #ocaml
<def`> up to the syntax, as corrected by dmbaturin, yes
jcloud has joined #ocaml
<paarth> zozozo, IIRC the git repo is just a mirror of the svn repo
<paarth> I don't think your change will be taken
<def`> my definition involving A above my sound confusing to you, I thought you were more familiar with the langage.
<sh0t> def` i started yesterday
<sh0t> but i know something about functinoal programming languages
<def`> this last syntax would be the equivalent of an enum : type t = A | B (*note the uppercase*) is equivalent to enum t { A, B };
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<def`> except ocaml sum types (the name for the declaration above) are much more expressive than C enums
<def`> but you'll have time to discover that.
<sh0t> mm it's just that i am reading some code of a person who is much more expert than me and...i don't get a few things
<sh0t> he wrote something like
<sh0t> type c = (a * b) list
<sh0t> but then he also wrote
<sh0t> let f c=...
<def`> completely unrelated
<paarth> indeed. in my head I think of them as two separate things
<sh0t> why would someone use the same name for a type and a value
<sh0t> ?
<def`> the first c is a type, the second an expression
<paarth> sh0t, imagine there's the main language, and there's a type language
<dmbaturin> sh0t: Because they can. :)
<zozozo> paarth: there are a number of pull request on the github repo anyway, some of them merge into trunk, so they are useful
<sh0t> dmbaturin, haha sure...doesnt help understand his code though
<sh0t> (for a newbie)
<paarth> type language is where the LHS of the type thing = blah | blah2 comes in. blah and blah2 are available in the expression language as constructors, 'thing' is available in the type language as a type
<def`> sh0t: what I often do in my code is to name a variable of some type with the same name of the type when I know it's the only one in scope
<dmbaturin> OCaml doesn't force you to make type names and binding (variable/function) names to have no intersections.
<def`> type account = { name : string } let print_account account = print_string ("Name is: " ^ account.name)
<paarth> so in that "let f c = ..." expression you could also write that as "let f (c:c) = ..."
<sh0t> def`, isn't bad practice?
<paarth> the c on the left is the name binding, the c on the right is the type
tinhead has joined #ocaml
tinhead has joined #ocaml
<def`> sh0t: always depend on the case, my code above wouldn't be more readable by choosing a different names
<sh0t> i see def`
<def`> values and types don't live in the same namespace, there is no chance of conflict (but eventually confusion in the mind of the reader, so be careful ;-))
<sh0t> yeah paarth thanks i understand
<def`> (In C you'll get conflict for instance)
<sh0t> yeah
bobpoekert has joined #ocaml
seanmcl has joined #ocaml
<dmbaturin> When explicit type annotations are rare, there's little potential for confusion I think.
kdef has joined #ocaml
<def`> and type and value names cannot syntactically occur in similar places
<def`> so once you know the syntax, it's just not possible to get confused
<sh0t> ok so maybe it's just because i don't know the syntax
<def`> yep, that's normal, it will come :)
<paarth> zozozo, I may well be wrong then. I'd try it and see what comes of it
mariusae has joined #ocaml
<def`> zozozo: yep pull requests are welcome, if your one is simple and correct, it will get merged in a breeze
tnguyen has quit [Quit: tnguyen]
ncthom91 has quit [Quit: Textual IRC Client: www.textualapp.com]
tinhead_ has joined #ocaml
swgillespie has joined #ocaml
tinhead has quit [Ping timeout: 258 seconds]
<Algebr> mine has been out for 2 days, no comments. Whats a breeze supposed to be, a week?
bobpoekert has quit []
<def`> At least yes :-)
<zozozo> def`: thx, it's done (it's really trivial actually)
swgillespie has quit [Client Quit]
swgillespie has joined #ocaml
<def`> Algebr: I meant you won't have to fight to get it merged, but you might have to wait. OCaml releases happen on a yearly basis (intermediate versions are merged from time to time)
ollehar1 has joined #ocaml
<ollehar1> type-safe side-effects? is that monads?
<ollehar1> or mumbo-jumbo?
<def`> context?
<def`> type-safe side-effects are side-effects not breaking type safety
<def`> so any kind of side-effects in OCaml…
<ollehar1> hm
<def`> with value restriction*
<ollehar1> was thinking about algebraic effects as breaking type-safety
<ollehar1> but if there was none to begin with...
<def`> well, algebraic effects not necessarily break type safety
<def`> when properly implemented, as they should
<ollehar1> hm
<ollehar1> but you get runtime errors instead of compiler errors?
hay207 has quit [Ping timeout: 264 seconds]
<def`> yeps, this has nothing to do with type safety, but with runtime semantics
<ollehar1> ah
<Denommus> runtime errors for side-effects are mostly unevitable, unless you wrap everything under option or result
<def`> ocaml without value restriction would be type unsafe, e.g
<def`> let set r x = r := x;;
<def`> let r = ref None;;
<Denommus> *inevitable
<def`> erf, I failed, pff nevermind, if you know value restriction you'll have understood :D (otherwise i'll correct)
<def`> they are inevitable if you consider the resources to be bounded… you can't do much against an out of memory
<def`> (even if you know you'll execute with a hard bound on memory consumption, you can't assert the kernel will be able to provide this memory)
bobpoekert has joined #ocaml
<sh0t> algebraic effects...what are they? I think I attended a lecture on that by a big guy but i didn't get much out of it
<def`> sh0t: think exceptions, but generalized
<sh0t> generalized in which way?
<sh0t> like u can compose them
<sh0t> algebraically?
<def`> for instance you can resume them
<def`> also
<sh0t> mmm
blandflakes has joined #ocaml
<def`> (for exceptions alone, with first class functions, you can already compose handlers)
<def`> (with algebraic effects, you could create new objects behaving like exceptions within some controlled way)
<sh0t> "within some controlled way"?
<sh0t> i mean how do u generalize exception?
<ollehar1> things that break normal flow of execution?
leafac has quit [Quit: Leaving.]
<def`> yes
blandflakes has quit [Client Quit]
<def`> exceptions are just a way to express non local control flow
blandflakes has joined #ocaml
<def`> (and open sums in OCaml, this part is already generalized by open types)
<def`> non-local forms of control flow are some generalization of exceptions :-)
<ollehar1> so introducing algrebraic effects in ocaml, we could scrap the exception system?
<ollehar1> well, unless for backwards comp
<def`> exceptions are one form of algebraic effects, and they will still receive a special handling
<sh0t> why are they algebraic?
<def`> (for backward comp, because they are exposed to C-ffi, etc)
leafac has joined #ocaml
<def`> because handlers are homomorphisms from free algebras :D
<ollehar1> ha
<def`> more seriously, just think of exception as a name
<sh0t> yeah i need to learn some categorytheory
<def`> then what operations should you provide to turn the name into an actual operation
<sh0t> mm
<def`> basically, with algebraic effect you say "i want to perform the name Exception Not_found" (perform is the generalization of raise/throw)
<def`> and the implementor should provide an action deciding what to do when the effect "Exception" is performed
<def`> and multiple names can cohabit, defining different effects that can be composed
seanmcl has quit [Read error: Connection reset by peer]
<sh0t> mmm
<def`> I'll stop there, I am not familiar enough with the topic and it would get too technical anyway
<sh0t> ok thanks def`
<def`> you're welcome :)
<ollehar1> but can you track side-effects in the type system?
<Drup> No
<ollehar1> what about this: A computation might then have a type int & {write ρ,read σ}. This means that the computation produces an int value, but it also writes something to a memory region ρ and reads a value from a memory region σ (you then know you do not need a lock to protect σ).
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<Drup> I know the integration of effects into type systems
<def`> that's a type system where you can type some effects yes
<Drup> I'm just saying it's not done in ocaml multicore
<def`> yep
<ollehar1> ok
<ollehar1> is there any language that does this? some haskell extension?
<ollehar1> nooo!
<Drup> for an actual language doing that
<def`> java ;-)
madroach has quit [Ping timeout: 264 seconds]
<ollehar1> I tried eff already, but thought there was too much run-time thingys
<def`> tracking first order exceptions… hahaha, those guys :')
<Drup> def`: only exceptions, not effects in general :p
<ollehar1> ah, yes, exceptions in java
<Drup> ollehar1: "but I want to track effects :(" "but it trackts effects too much :("
<Drup> =')
madroach has joined #ocaml
<Drup> http://research.microsoft.com/en-us/projects/koka/ smaller and probably cuter (and less interesting, imho)
<Drup> (and there is idris but the "effect system" is a hack on top of monads, not a real effect system)
<ollehar1> ok
kdef has quit [Quit: Leaving]
seanmcl has joined #ocaml
<ollehar1> I want to track effects, but with compiler errors if I do something wrong :P
<ollehar1> like, "you don't catch this exception anywhere!"
<ollehar1> hm
<ollehar1> but generalized, then
<dmbaturin> ollehar1: But what if you don't want to catch it?
<dmbaturin> E.g. it's supposed to be handled by the users of your library.
<Drup> dmbaturin: then you indicate it in the type of your function
<ollehar1> yes
<ollehar1> there's also an extension to haskell called eff, it seems ;)
<Drup> encoded into monads, iirc
swgillespie has joined #ocaml
<dmbaturin> Drup: Does Eff produce warnings/errors for unhandled effects?
<dmbaturin> (I should finally build it and try it myself)
<Drup> I don't know the implementation, so can't answer
<def`> it seems to me that effects are typed, you might even not be to do anything without providing an handler
<def`> (you 'll just end up with a value of type 'a my_effect, …)
badon has quit [Quit: Leaving]