mocrunsthecity has quit [Remote host closed the connection]
mocrunsthecity has joined #ocaml
<hnrgrgr>
tcpc: (>>=) is value, you don't need 'lwt.syntax'. Just (#require "lwt";;) and (open Lwt).
<hnrgrgr>
The syntax extension is for "lwt x = ... in "
FreeArtMon has joined #ocaml
<tcpc>
hnrgrgr: what a stupid misunderstanding
<tcpc>
thanks a lot
<adi__>
http://pastebin.com/YZetWhaA I understand how OCaml realized type of function f and g, but I don't get it how it was done for curry... Can anyone explain me this? for me it looks like the order was reversed.
<Drup>
why do you thing so ?
<Drup>
adi__: f is called on a tuple
<Drup>
(I'm talking about the f in the curry function)
<Drup>
so it's normal that it takes a tuple and returns something
dant3 has quit [Remote host closed the connection]
<adi__>
my way of thinking: let f x y = x+y equals let f = function x-> function y-> x+y so now: + is operator for two ints hence x+y is type of int and x and y have to be type of int. So for the curry: let curry = function f -> function x -> function y -> f (x,y); and now i assume that it should be the same way as it was for f so: 'a -> 'b -> 'c -> (and because f takes a tuple) 'a * 'b -> c that is how i thing
<Drup>
you got it reversed =)
<Drup>
f is *taking* a tuple, not returning one
<adi__>
hm... but on the other hand: ('a * 'b ->c) == type of f , and then 'a = type of x and 'b = type of y ?
<mrvn>
adi__: you are expecting curry to return a function but you are returning a value.
<Drup>
adi__: yes
<adi__>
oh my ;) now it is so obvious :D
darklajid has joined #ocaml
<adi__>
now i get it. thanks a lot ;)
<pippijn>
gasche: does ('a * 'b -> 'c) -> ('a -> 'b -> 'c) have exactly one inhabitant?
<mrvn>
pippijn: ocaml drops the last ()
travisbrady has joined #ocaml
kyrylo has quit [Read error: Connection reset by peer]
kyrylo has joined #ocaml
ocp has joined #ocaml
<gasche>
pippijn: yes
chris2 has quit [Ping timeout: 248 seconds]
mcclurmc has joined #ocaml
<gasche>
pippijn: this is precisely the kind of situations were I think unique-inhabitant would be most useful: glue code between strongly-typed functions
chris2 has joined #ocaml
<gasche>
if you are writing a strongly-parametric function (say in a FRP library or whatever), and you don't remember whether it's (f a b) or (f b a), just use (? f a b) and let (?) be uniquely-inferred to either identity or flip
sagotch has quit [Ping timeout: 245 seconds]
<Drup>
Agda holes <3
<Drup>
gasche: can I have agda case decomposition for Christmas too ?
<adrien>
sure, sure
* adrien
pats Drup
<adrien>
oh, look outside, a rainbow!
<rks`>
Drup: what do you mean?
mcclurmc has quit [Ping timeout: 272 seconds]
<Drup>
rks`: write "match x with truc -> ?", put cursor on "?", press button, split the truc according to the type
<Drup>
repeat for nested pattern if necessary
<rks`>
right
<rks`>
well
<rks`>
hopefully we'll have that in merlin someday
<Drup>
yep
<rks`>
(says the guy who didn't write a single line of code in the past few months)
<jpdeplaix>
:D
<gasche>
reading history from top to bottom, I was going to say "ask the merlin devs", but I see they reacted already
<rks`>
:p
<def-lkb>
:D
<gasche>
def-lkb: have you made progress cleaning up the merlin stuff?
<rks`>
yes
<rks`>
and he even started writing a blog post
pminten has joined #ocaml
mcclurmc has joined #ocaml
mocrunsthecity has quit [Remote host closed the connection]
ocp has quit [Ping timeout: 245 seconds]
mcclurmc has quit [Ping timeout: 240 seconds]
<def-lkb>
gasche: I am making progress on merlin itself, not on the ocaml part.
<def-lkb>
gasche: I will submit the ocamllex patch first, after that I am not sure what you would like to see upstreamed
travisbrady has quit [Quit: travisbrady]
<jpdeplaix>
gasche: if you have time, don't forget to handle the macaque PRs (at least the one for OASIS and the fix for unions)
<jpdeplaix>
IN and arrays are not ready yet I think
zpe has joined #ocaml
zpe has quit [Ping timeout: 252 seconds]
<gasche>
I'm working on format+GADTs right now
<gasche>
def-lkb: yeah I wondered about the merlin patches
<gasche>
did you email me about the ocamllex patch, and did I not answer?
dant3 has joined #ocaml
<def-lkb>
gasche: indeed you did not answer :), but I can submit directly on mantis (or wait for the whole infrastructure to be switched to github :D?)
avsm has joined #ocaml
<gasche>
I was in deadline mode
<adrien>
style question:
<gasche>
I'll have a quick look
<adrien>
I have the following line which is 100 chars: let create_process_sync ?(stdout=Unix.stdout) ?(stderr=Unix.stderr) ?(env=Unix.environment ()) a =
<adrien>
would you reformat it?
<gasche>
yes
<adrien>
and if so, how? :P
<gasche>
I'd cut after the function name
<def-lkb>
align ?
<gasche>
and then format the argument freely, indented against the function name start
dant3 has quit [Ping timeout: 240 seconds]
<adrien>
one per line or more?
<gasche>
then "=" aligned with "let" starting position
<gasche>
more if you wish
dsheets_ has joined #ocaml
<adrien>
so
<adrien>
let create_process_sync
<adrien>
?(stdout=Unix.stdout)
<adrien>
..
<adrien>
=
<adrien>
?
dsheets_ has quit [Remote host closed the connection]
<gasche>
no, arguments should be argumented strictly more than the start of the function name
dsheets_ has joined #ocaml
<adrien>
indent the args not the '='?
<rks`>
yes
<gasche>
yes
<adrien>
thanks, looks good to me )
<adrien>
:)
<gasche>
you need the "=" unindented to make a visual break between the arguments and the function body
<adrien>
(well, turns out I'm going to change the ?env arg so the line won't be as long anymore but I've had other times with long lines :) )
tane has joined #ocaml
<adrien>
I was a bit worried it would look out of place but I find it looks like with "module X : sig ... end = struct ... end"
<gasche>
(I think it would be fine to indent the arguments at the start of the function name, rather than strictly more to the right, but then it's about taste)
<gasche>
another thing
<gasche>
the semantics of when default values for optional argument is not that clear
ben_zen has quit [Quit: leaving]
<gasche>
if (Unix.environment ()) must not be shared between call, I'd define it from (?env) as an option in the body
<gasche>
*calls
<gasche>
when .. are initialized
<adrien>
well, that one went away
<adrien>
but I am building a value for create_process_env, not changing the environment of the currently-running process
<pippijn>
gasche: I don't know if I like the (?) thing
<pippijn>
gasche: but let flip : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c = ?
<pippijn>
that would be nice
<pippijn>
where you encode logic in the type system
avsm has quit [Quit: Leaving.]
ygrek has quit [Ping timeout: 253 seconds]
mort___ has joined #ocaml
mort___ has left #ocaml []
mocrunsthecity has joined #ocaml
<gasche>
adrien: it depends on whether the value you build is mutable
<gasche>
initializers should be correct if they behaved like C static variables
<gasche>
+even
<adrien>
you mean that using default values to create fresh values on each call is discourage?d?
Thooms has quit [Quit: WeeChat 0.3.8]
NoNNaN has quit [Ping timeout: 240 seconds]
mcclurmc has joined #ocaml
FreeArtMon has quit [Ping timeout: 253 seconds]
NoNNaN has joined #ocaml
mcclurmc has quit [Ping timeout: 252 seconds]
<adrien>
besides debian, which linux distribution doesn't have a 4.0 in something released and stable?
<adrien>
I guess rhel and its derivatives too but I guess these are even worse
thomasga has joined #ocaml
FreeArtMon has joined #ocaml
mocrunsthecity has quit [Read error: Connection reset by peer]
mocrunsthecity has joined #ocaml
pminten has quit [Quit: Leaving]
philtor has joined #ocaml
zpe has joined #ocaml
dant3 has joined #ocaml
ollehar1 has joined #ocaml
zpe_ has joined #ocaml
zpe has quit [Read error: Connection reset by peer]
Simn has joined #ocaml
avsm has joined #ocaml
ygrek has joined #ocaml
arj has quit [Quit: Leaving.]
FreeArtMan__ has joined #ocaml
<adrien>
btw, I've been working on a small "script" and experimenting by running it as:
<adrien>
time sudo ocaml unix.cma str.cma ./win-builds/build-packages.ml 1.4 cross_toolchain flexdll
<adrien>
(yeah, as root while experimenting)
<adrien>
but I get: (Program not linked with -g, cannot print stack backtrace)
<adrien>
is there something I haven't noticed or is it simply impossible
<adrien>
?
<adrien>
(impossible to get the backtraces)
bjorkintosh has quit [Ping timeout: 245 seconds]
FreeArtMon has quit [Ping timeout: 248 seconds]
<adrien>
and just found an issue in my code:
<adrien>
| s -> try int_of_string s with _ -> 0
<adrien>
with Not_found -> 0
<adrien>
='(
<adrien>
actually, should work as expected
<companion_cube>
why don't you put "#load" and #require in your .ml file?
dant3 has quit [Ping timeout: 264 seconds]
mcclurmc has joined #ocaml
nisstyre has joined #ocaml
olasd has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
mort___ has joined #ocaml
mcclurmc has joined #ocaml
Thooms has joined #ocaml
avsm has quit [Quit: Leaving.]
<adrien>
it is meant to be compiled, I think
<adrien>
argh, disregard my issue
<adrien>
basically I call a log function and wanted to print a backtrace
<adrien>
but in the log function there is an exception is raised and caught but the backtrace I get is for that exception and only that exception
<adrien>
3and it's get_callstack which I wanted
travisbrady has joined #ocaml
FreeArtMan__ has quit [Ping timeout: 252 seconds]
<gasche>
I'm wondering whether the pattern-synonyms post would be appropriate for r/haskell
mcclurmc has quit [Remote host closed the connection]
<companion_cube>
implement it first, so you can mock them
<companion_cube>
;)
FreeArtMan__ has joined #ocaml
FreeArtMan__ has quit [Client Quit]
shadynasty has joined #ocaml
avsm has joined #ocaml
dant3 has joined #ocaml
stomp has quit [Ping timeout: 245 seconds]
stomp has joined #ocaml
mort___1 has joined #ocaml
lostcuaz has joined #ocaml
mort___ has quit [Ping timeout: 252 seconds]
avsm has quit [Quit: Leaving.]
nikki93 has joined #ocaml
mort___ has joined #ocaml
mort___1 has quit [Ping timeout: 252 seconds]
travisbrady has quit [Quit: travisbrady]
Simn has quit [Ping timeout: 252 seconds]
<orbitz>
hr
<orbitz>
m
travisbrady has joined #ocaml
<nisstyre>
why doesn't ocaml use uniqueness types at all? I get that it's impure but it could've been pure and still had mutation, right?
<ggole>
It's probably simpler to just have mutation without regard to types.
<ggole>
It's not as if OCaml's type system is wasting away for lack of complexity.
<nisstyre>
ggole: yes, but less safe and less optimizable
<nisstyre>
just curious why nobody thought to add them
<nisstyre>
maybe it would be too hard to fit in?
dant3 has quit [Read error: No route to host]
<nisstyre>
Clean has had them for quite a while and now Rust
<adrien>
"pragmatic"! (I was looking for this word one or two days ago :P )
<nisstyre>
(which people are actually in danger of using)
<ggole>
I think that Clean and Rust were designed from the start to take that approach.
dant3 has joined #ocaml
<nisstyre>
yeah that's true
<ggole>
Bolting them on after the fact might not produce a clean design
<nisstyre>
ggole: I think Haskell bolted on monads after the fact
<ggole>
And you might want to make some changes to the runtime to take advantage, etc.
<nisstyre>
yeah, the compiler would have to be changed significantly
<ggole>
I suspect that there's little advantage for the programs (like Coq) that OCaml is primarily intended to support, too.
<Drup>
I wonder where does this "ocaml is done to support Coq" thingy
mcclurmc has joined #ocaml
<dsheets_>
Drup, xleroy?
<ggole>
Xavier made some comments that indicated that he thought that way
<nisstyre>
ggole: Clean is the closest language I've found that I really like but sadly there's almost no libraries I can find, so I'm thinking about using OCaml more instead
<nisstyre>
and just dealing with the fact that you can write impure code
<ggole>
I like being able to write impure code without fuss.
<nisstyre>
well, Clean doesn't have a way to extend the language easily like camlp4 I guess
<adrien>
hmmm
<nisstyre>
ggole: I like it as well
<Drup>
dsheets_: it seems highly silly to me :/
<adrien>
I think it's that _today_ ocaml doesn't really get funding but coq does
<dsheets_>
Drup, why? ml was for lcf theorem proving, no?
<Drup>
dsheets_: "was"
Thooms has quit [Read error: No route to host]
Thooms has joined #ocaml
<dsheets_>
Drup, ya, so it makes sense for the creators of languages like this to say "i made this language/compiler because i wanted to write this program"
mcclurmc has quit [Remote host closed the connection]
<nisstyre>
dsheets_: or they just wanted to see if they could write the compiler
<nisstyre>
and then nobody ever bothered to write much else in it
<dsheets_>
sure, some languages are like that. but ml/ocaml were explicitly designed with theorem provers in mind, afaik
<nisstyre>
sadly that's what a lot of researchy languages feel like
<ggole>
You wouldn't write a compiler and then maintain it for 15 years "just to see", that's crazy.
<dsheets_>
of course, the scope of applicability has since increased substantially...
mcclurmc has joined #ocaml
<nisstyre>
ggole: in that case you'd probably be using it to teach CS 101 or something
<nisstyre>
e.g. Clean
<ggole>
Caml light was used for teaching a bit, I think.
<adrien>
it still is
<adrien>
(unfortunately)
<ggole>
As long as the kiddies are properly indoctrinated in FP, it's OK.
* ggole
coughs
<nisstyre>
Racket was explicitly designed for teaching but somehow ended up being fairly practical
<dsheets_>
is racket much different from mitscheme?
<nisstyre>
mit scheme is probably like a subset of Racket
<nisstyre>
but Racket has a lot more stuff
<nisstyre>
and it supports adding non s-expression based syntax
cesar_ has joined #ocaml
<nisstyre>
e.g. there is a Datalog language for it
<dsheets_>
as sugar? i know it has a lot of extra stuff like contracts and optional types
cesar_ is now known as Guest537
<ggole>
Racket has evolved into its own language now, more or less: hence the change of name.
<nisstyre>
dsheets_: no, at the top of your Racket file you put #lang foo
<nisstyre>
and it interprets the file depending on that
<dsheets_>
but i thought it was mostly a stdlib collection around an r6rs or sth scheme
thomasga has quit [Quit: Leaving.]
<nisstyre>
#lang racket being the most common one
<ggole>
In addition to all the additions I think it differs from scheme in some respects, such as immutable cons cells
mcclurmc has quit [Remote host closed the connection]
<nisstyre>
ggole: yeah set-cdr! and set-car! don't exist
<nisstyre>
they're relegated to their own library and separate type
<ggole>
They have mcons for making mutable conses, or some such thing.