<gtristan>
pretty non standard build scripts though
silver has joined #ocaml
maattdd has joined #ocaml
maattdd_ has quit [Ping timeout: 256 seconds]
lamcee has joined #ocaml
psacrifice has joined #ocaml
M-Illandan has quit [Remote host closed the connection]
Bluddy[m] has quit [Read error: Connection reset by peer]
timclassic has quit [Remote host closed the connection]
ktosiek[m] has quit [Remote host closed the connection]
M-martinklepsch has quit [Remote host closed the connection]
yetanotherion[m] has quit [Read error: Connection reset by peer]
aspiwack[m] has quit [Remote host closed the connection]
srenatus[m] has quit [Remote host closed the connection]
smondet[m] has quit [Remote host closed the connection]
M-jimt has quit [Remote host closed the connection]
regnat[m] has quit [Write error: Connection reset by peer]
ktosiek[m] has joined #ocaml
lamcee has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
llmz has quit [Ping timeout: 260 seconds]
aspiwack[m] has joined #ocaml
regnat[m] has joined #ocaml
M-jimt has joined #ocaml
srenatus[m] has joined #ocaml
timclassic has joined #ocaml
M-martinklepsch has joined #ocaml
Bluddy[m] has joined #ocaml
M-Illandan has joined #ocaml
yetanotherion[m] has joined #ocaml
smondet[m] has joined #ocaml
demonimin has joined #ocaml
mfp has joined #ocaml
ygrek has quit [Remote host closed the connection]
FreeBirdLjj has quit [Remote host closed the connection]
psacrifice has quit [Ping timeout: 264 seconds]
psacrifice has joined #ocaml
maattdd has quit [Ping timeout: 240 seconds]
murmour has joined #ocaml
ygrek has joined #ocaml
snowcrshd has quit [Ping timeout: 260 seconds]
snowcrshd has joined #ocaml
hovind has joined #ocaml
_andre has joined #ocaml
tane has joined #ocaml
ygrek has quit [Remote host closed the connection]
ygrek has joined #ocaml
mengu has joined #ocaml
FreeBirdLjj has joined #ocaml
ygrek has quit [Ping timeout: 240 seconds]
lucybun has quit [Remote host closed the connection]
lucybun has joined #ocaml
lamcee has joined #ocaml
lamcee has quit [Client Quit]
mcspud has quit [Ping timeout: 246 seconds]
mrvn has joined #ocaml
<mrvn>
# type t = { };;
<mrvn>
Error: Syntax error
<mrvn>
are empty records not allowed?
<octachron>
mrvn, empty records like 0-tuples are not allowed
<octachron>
thinking about it, sum type with 0 constructors are also not valid
mcspud has joined #ocaml
<mrvn>
but that's because you can't type that. "type t = ". How would ocaml know that the type is done there?
mengu_ has joined #ocaml
<octachron>
mrvn, creating a specific syntax for this use case is not that hard "type t = . "
<mrvn>
I'm redirecting into a variable. Is the output getting to long for the variable?
<mrvn>
ups
<mrvn>
octachron: type t = .. :)
mengu has quit [Ping timeout: 258 seconds]
sepp2k has joined #ocaml
rpg has joined #ocaml
ygrek has joined #ocaml
mengu has joined #ocaml
mengu_ has quit [Ping timeout: 260 seconds]
psacrifice has quit []
larhat has joined #ocaml
rpg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
zpe has joined #ocaml
ygrek_ has joined #ocaml
ygrek has quit [Ping timeout: 260 seconds]
yomimono has joined #ocaml
alienbot has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
nomicflux has joined #ocaml
nomicflux has quit [Quit: nomicflux]
<lapinot>
hi, i'm scratching my head around some higher kinded polymorphism.. Just to be sure: having a function an identity function `id` so that `id (id)` has the exact same type is impossible in ocaml right? Or maybe equivalently, poly-typexpr are not useable everywhere (including on function arguments)
<octachron>
lapinot, you two questions are not completely equivalent. For the second one, higher-rank polymorphism is possible using either records or objects
<octachron>
record: type id = { f:'a. 'a -> 'a }, object: "object method id:'a. 'a -> 'a = fun x -> x end"
<octachron>
For the first question, the problem seems to be more the value restriction: "let f x = let id x = x in let id = id id in id x" works
<octachron>
but "let not_id = let id x = x in id id" is monomorphic due to the value restriction
<lapinot>
nice answer, so that value restriction is inevitable?
FreeBirdLjj has joined #ocaml
<lapinot>
(to be understood: even if i add some dangerous option or hint stating that i'm only doing pure computations and that this would be safe)
BitPuffin|osx has joined #ocaml
<octachron>
lapinot, in this precise case, since relaxed value restriction also applies, yes (((except if you break Ocaml type system))).
<lapinot>
ok, oh indeed.. breaking the rules does actually break the rules! Obj.magic (Obj.magic (Obj.magic)) :D
mengu has quit [Remote host closed the connection]
<lapinot>
typing this in a toplevel gives type 'a = <poly>, i never encountered that <poly>, what is it?
laserpants has quit [Ping timeout: 260 seconds]
zpe has quit [Remote host closed the connection]
kamog has joined #ocaml
<flux>
I understand it just to be a polymorphic value that cannot be represented, because its exact type is unknown to the toplevel
<mami>
when i have "and 'a t = unit -> 'a node
<mami>
i mean "and 'a t = unit -> 'a node" after a typesig, does that mean: if "'a t" is unit, regard it as "'a node"?
<flux>
mami, no. x -> y is the syntax for the type of a function that takes argument x and returns y
<flux>
also x -> y -> z is the same as x -> (y -> z)
<flux>
in general it's not possible to make any kind of conditional in OCaml depending on the type of a value
<mami>
what does it want to tell me then?
<mami>
the typesig is this
<mami>
type +'a node =
<mami>
| Cons of 'a * 'a t
<mami>
| Nil
<mami>
and 'a t = unit -> 'a node
<flux>
it defines 'a t to be a polymorphic type (with type argument 'a) that is the type of a function that accepts a unit argument () and returns a value of type 'a node
<mami>
aha! thanks.
<octachron>
lapinot, note that in many situations there are (more or less acrobatic) workarounds to avoid the value restriction
<lapinot>
i think that this is used to create a lazy list (having 'a t instead of 'a node may be used to defer the computation of the result)
<lapinot>
mami ^
<mrvn>
mami: That looks like a lazy list, a generator.
<mrvn>
an enumeration
<mami>
lapinot: mrvn: makes sense now, the same lib also has: "let return x () = Cons (x, empty)
<mami>
"
<flux>
well it's sort of a "semi lazy" list, because I connect laziness to mean that the value is memoized, which this list doesn't do
<mami>
flux: could i just do it with the lazy keyword?
<flux>
yes
FreeBirdLjj has quit [Remote host closed the connection]
<mami>
which reasons could the original author have, to not use the lazy keyword? does it have different performance properties/ memory footprint?
<flux>
type +'a node = Nil | Cons of 'a * 'a node Lazy.t
<flux>
well, I expect lazy to be slower and because it memoizes the result, it can result in larger memory usage
<mrvn>
mami: lazy is more complex because it remembers that it was evaluated.
<mami>
i see, it makes sense then to not do it lazy in this place.
<lapinot>
octachron: i'm interested in that.. i'm writing some interpreter for a caml subset in a class and I followed a paper about "typeful normalization by evaluation". So I have some (user) functions encoded in ocaml, these can be polymorphic but my normalization function does apply value restriction to them, it would be kick-ass to remove that barrier
<mami>
mrvn: that would make it more efficient if similar computations would repeatedly happen?
<mrvn>
mami: remembering involves a lot of complext stuff in the Gc that changes the value.
<mrvn>
mami: I don't think you are supposed to iterate your list more than once.
<mami>
mrvn: good, so it really does not make any sense to use Lazy here.
<mrvn>
mami: try it and profile it
<mrvn>
mami: try streams and enums/sequence from other core libs too
FreeBirdLjj has joined #ocaml
jnavila has quit [Ping timeout: 260 seconds]
<lapinot>
got to go, bye folks
<mami>
mrvn: will do
FreeBirdLjj has quit [Remote host closed the connection]
malc_ has joined #ocaml
Ayey_ has joined #ocaml
sepp2k has quit [Ping timeout: 260 seconds]
sepp2k has joined #ocaml
alienbot has quit [Read error: Connection reset by peer]
ryanartecona has joined #ocaml
SpiceGuid has joined #ocaml
sh0t has joined #ocaml
manizzle has quit [Ping timeout: 240 seconds]
MercurialAlchemi has quit [Ping timeout: 240 seconds]
rpg has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
rpg has quit [Ping timeout: 240 seconds]
ryanartecona has joined #ocaml
<tobiasBora>
Hello,
Ayey_ has quit [Ping timeout: 260 seconds]
<tobiasBora>
I'd like to know, is there a function that takes a Lwt stream of type () -> (), a number of threads, and that runs all the functions in the stream, shared in the x threads?
yomimono has quit [Ping timeout: 246 seconds]
snowcrshd has quit [Remote host closed the connection]
<tobiasBora>
(I've a big file that I'd like to proceed with a multithreading thing, that's why I'd like to do that)
jabroney has joined #ocaml
<reynir>
unit -> unit?
<tobiasBora>
reynir: yes, for example let's imagine that I get from a file a stream of string, then I build from it a stream that works like "take the last element of the file stream, and Printf this string"
yomimono has joined #ocaml
snowcrshd has joined #ocaml
mfp has quit [Ping timeout: 256 seconds]
<tobiasBora>
For example,
<tobiasBora>
let lines = Lwt_io.lines_of_file "myfile.txt"
mcspud has quit [Ping timeout: 246 seconds]
<tobiasBora>
let display_lines = Lwt_stream.map (fun s -> Printf.printf "%s\n" s) lines
<tobiasBora>
And the thing is that I don't know how to "great_function_that_share_stream_between_threads"
<tobiasBora>
Because if I manually do it, I would need to create a pool of threads that always pick up an element from the stream...
gtristan has quit [Ping timeout: 240 seconds]
<companion_cube>
tobiasBora: you can try with Lwt_stream.iter_p and Lwt_pool
<companion_cube>
(pool is to limit to n parallel computations)
<tobiasBora>
companion_cube: oh nice, I missed the iter_p function. The iter_p function create really all the threads in the same time?
rpg has joined #ocaml
mcspud has joined #ocaml
<companion_cube>
I think so
<companion_cube>
as soon as values arrive, of course
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 240 seconds]
<tobiasBora>
companion_cube: ok thank you. However in the pool doc, I can read:
<tobiasBora>
"Note that pools are not for keeping Lwt threads. Lwt threads are very cheap to create and are pure. It is neither desirable nor possible to reuse them. If you want to have a pool of system threads, consider module Lwt_preemptive. "
<tobiasBora>
so I'm not sure to see how you would put pool inside
<companion_cube>
if a computation is costly (but the thread is cheap):
<companion_cube>
Lwt_stream.iter_p (fun f -> Lwt_pool.acquire foo (fun () -> f ())) some_stream
<companion_cube>
this way, you only apply functions from the stream when you can acquire a dummy token (here of type `unit`)
<companion_cube>
so it limits the number of parallel function applications
jao has joined #ocaml
<tobiasBora>
companion_cube: Hum quite cleaver... And I also saw the Lwt_stream.create_bounded function, is it possible to use it in the same idea?
<mami>
i am trying to replace the lazy Gen we have with a Seq
<mami>
Gen has a function that gives me back a Gen of the object i suplly
<mami>
type 'a t = Gen of (('a * 'a t) option) Lazy.t
<mami>
my Seq is this:
<mami>
type +'a node =
<mami>
| Cons of 'a * 'a t
<mami>
| Nil
<mami>
and 'a t = unit -> 'a node
marsam has joined #ocaml
<mami>
how would i define the Seq generation function in a similar way to Gen?
snowcrshd has quit [Remote host closed the connection]
<mami>
with of does not work since i need to keep the typesig unit -> 'a node there
<tobiasBora>
then I have an error: "Stack overflow during evaluation (looping recursion?)."
<tobiasBora>
(I'm building an infinite stream containing "YES")
<tobiasBora>
and I expected that it would run infinitely by printing YES...
rpg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<tane>
tobiasBora, problem is iter_p
sz0 has joined #ocaml
<tobiasBora>
tane: hum yes it makes sense...
rpg has joined #ocaml
<tobiasBora>
But then I don't see what I could do...
<tane>
tobiasBora, do you want multi threading or actual parallelism?
<def`>
tobiasBora: does it still happen with(fun () -> Lwt_unix.yield () >>= fun () -> Lwt.return (Some "YES"))
<tobiasBora>
tane: Well, I'd love to have actual parallelism, but I thought that Ocaml was not able to do multicore, so I tought I would run several instances else
<def`>
(I suspect the problem is that you have no concurrency in your code, in which case Lwt is faster but consume stack)
<def`>
(Async doesn't have this eager binding behavior -- which breaks monad laws afair -- so it should be fine with Async)
rpg_ has joined #ocaml
rpg has quit [Ping timeout: 256 seconds]
<tane>
tobiasBora, so, multi-processing?
<tane>
short reboot, brb
tane has quit [Quit: Leaving]
tane has joined #ocaml
<tobiasBora>
def`: With yield indeed it works... What did you do exactly?
Ayey_ has joined #ocaml
<tobiasBora>
tane: Well, If you know how to get parallelism and multi core, yes I take it!
<tobiasBora>
it's funny to use yield ^^
<tobiasBora>
If I use "Lwt_unix.fork ()", you agree that I won't be able to use the same string between the two process right?
Ayey_ has quit [Ping timeout: 240 seconds]
ryanartecona has joined #ocaml
SpiceGuid has quit [Quit: ChatZilla 0.9.92 [SeaMonkey 2.46/20161213183751]]
<tane>
tobiasBora, if you go for multi-processing, split it completely and communicate the data in a serialized form
<tane>
this may be some overhead but will be worth it, if processing the data takes more time than then communication of instance and results :)
freusque has quit [Quit: WeeChat 1.7]
Mercuria1Alchemi has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 256 seconds]
<mrvn>
tobiasBora: ocaml doesn't support parallel threads
<mrvn>
tobiasBora: if you fork then you have 2 processes and two strings even if they are the same.
al-damiri has joined #ocaml
copy` has joined #ocaml
mfp has joined #ocaml
rpg_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rpg has joined #ocaml
mcspud has quit [Ping timeout: 246 seconds]
murmour has quit [Quit: Leaving.]
vicfred has quit [Quit: Leaving]
mcspud has joined #ocaml
FreeBirdLjj has joined #ocaml
yomimono has quit [Ping timeout: 264 seconds]
FreeBirdLjj has quit [Ping timeout: 246 seconds]
mcspud has quit [Ping timeout: 246 seconds]
ryanartecona has quit [Quit: ryanartecona]
alfredo_ has joined #ocaml
Ayey_ has joined #ocaml
alfredo has quit [Ping timeout: 260 seconds]
Ayey_ has quit [Ping timeout: 258 seconds]
Anarchos has joined #ocaml
mfp has quit [Read error: Connection reset by peer]
mcspud has joined #ocaml
Ayey_ has joined #ocaml
Ayey_ has quit [Ping timeout: 264 seconds]
ryanartecona has joined #ocaml
shinnya has quit [Ping timeout: 240 seconds]
Ayey_ has joined #ocaml
jabroney has quit [Quit: Leaving.]
Ayey_ has quit [Ping timeout: 240 seconds]
troydm has joined #ocaml
Ayey_ has joined #ocaml
snowcrshd has joined #ocaml
mcspud has quit [Ping timeout: 246 seconds]
troydm has quit [Client Quit]
Ayey_ has quit [Ping timeout: 264 seconds]
cojy_ has joined #ocaml
adi______ has joined #ocaml
technoma` has joined #ocaml
l1x_ has joined #ocaml
troydm has joined #ocaml
Pepe__ has joined #ocaml
j0sh_ has joined #ocaml
theblatt1 has joined #ocaml
dlat_ has joined #ocaml
Nazral_ has joined #ocaml
strmpnk_ has joined #ocaml
Bluddy[m] has quit [Ping timeout: 276 seconds]
M-martinklepsch has quit [Ping timeout: 276 seconds]
j0sh has quit [Ping timeout: 276 seconds]
adi_____ has quit [Ping timeout: 276 seconds]
strmpnk has quit [Ping timeout: 276 seconds]
SIGILL has quit [Ping timeout: 276 seconds]
Pepe_ has quit [Ping timeout: 276 seconds]
theblatte has quit [Ping timeout: 276 seconds]
SkeThuVe has quit [Ping timeout: 276 seconds]
noplamodo_ has quit [Ping timeout: 276 seconds]
dlat has quit [Ping timeout: 276 seconds]
l1x has quit [Ping timeout: 276 seconds]
cojy has quit [Ping timeout: 276 seconds]
maufred has quit [Ping timeout: 276 seconds]
technomancy has quit [Ping timeout: 276 seconds]
Nazral has quit [Ping timeout: 276 seconds]
maker has quit [Ping timeout: 276 seconds]
rpg has quit [Ping timeout: 269 seconds]
adi______ is now known as adi_____
noplamodo has joined #ocaml
M-martinklepsch has joined #ocaml
maufred has joined #ocaml
Bluddy[m] has joined #ocaml
SkeThuVe has joined #ocaml
maker has joined #ocaml
cojy_ is now known as cojy
SIGILL has joined #ocaml
strmpnk_ is now known as strmpnk
l1x_ is now known as l1x
mcspud has joined #ocaml
marsam has quit [Remote host closed the connection]
technoma` is now known as technomancy
rpg has joined #ocaml
<tobiasBora>
tane: Ok thank you, is there any library that automatate that? And what is lwt-parallel?
<tane>
tobiasBora, lwt parallel is just that (assuming the description holds)
<lapinot>
i'm back.. now i'm working on a small parser (using menhir) and i face a lot of end-of-stream conflicts which i don't really understand. Is there any good tutorial on how to write clean grammars? I'm a bit puzzled by the fact that menhir handles precedence and associativity himself (without the need of writing left-only or right-only recursive rules) but still enforces that the user write his rules with
<lapinot>
low-level details in mind (state transitions and look-ahead)
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
vtomole has quit [Ping timeout: 260 seconds]
sz0 has quit [Quit: Connection closed for inactivity]
orbifx has joined #ocaml
Ayey_ has joined #ocaml
fraggle_ has quit [Remote host closed the connection]
gtristan has joined #ocaml
Ayey_ has quit [Ping timeout: 240 seconds]
mengu has joined #ocaml
Mercuria1Alchemi has quit [Ping timeout: 240 seconds]
mengu has quit [Remote host closed the connection]
mengu has joined #ocaml
Ayey_ has joined #ocaml
Ayey_ has quit [Ping timeout: 260 seconds]
marsam has quit [Read error: Connection reset by peer]
marsam has joined #ocaml
<lapinot>
some other thought about polymorphism that struck me: is it possible to have a container (a mapping for example) that could contain values of different types? I'm thinking about GADTs and mapping some 'a x keys to 'a y values
<lapinot>
(but the container would allow any 'a)
<companion_cube>
look at `hmap` on opam (or CCHetMap in containers)
bbc has quit [Ping timeout: 264 seconds]
<lapinot>
companion_cube: thanks
Ayey_ has joined #ocaml
Ayey_ has quit [Ping timeout: 240 seconds]
malc_ has quit [Remote host closed the connection]
bbc has joined #ocaml
<orbifx>
sup all?
<lapinot>
and would be what i discussed earlier (an id function that types exactely same as `id (id)`) possible in coq?
<companion_cube>
no idea, it does work in haskell though
kakadu has joined #ocaml
<_y>
lapinot, my gallina is a bit rusty, but i think it would work out as is indeed
<companion_cube>
does it mean you write Coq code with lifetimes? :p
argent_smith1 has joined #ocaml
<_y>
modulo the arguments which are used to instanciate the type variables, which are left implicit and hidden by the syntax
<lapinot>
companion_cube: oh indeed, now i have a real incentive to really learn haskell! gonna rewrite my few functions asap!
<_y>
companion_cube, i bet you found that joke months ago and were in desperate hope for someone to say the expression :-°
<lapinot>
_y: ok, i'm gonna look further to check
argent_smith has quit [Ping timeout: 240 seconds]
Ayey_ has joined #ocaml
<lapinot>
companion_cube: ha, i just understood that one.. would be fun that rust evolves into having such hardcore functional features (GADTs, higher-kinded poly...)
<_y>
it works, but the implicit type instanciation fails so you have to specify it yourself (and for some reason just giving «ID», which is apparently defined as a shortcut for the type of «id», would lead to universe inconsistency)
<_y>
(seems to me that Coq retains a fixed universe level for the value «ID» and is not able to generalize it over any level)
<orbifx>
anyone know if MirageOS supports PAM?
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
_andre has quit [Quit: leaving]
jabroney has joined #ocaml
<lapinot>
_y: okay, i'm not very fluent in Coq so i don't really get why the others don't work (that universe thing) but i get the solution
<lapinot>
actually i never programmed in Coq, only did a little theorem proving class (arguably i was writing programs but you get it)
<companion_cube>
you seem to have identity problems ;)
<lapinot>
(note that the code does funny things using that feature, it's not defining an identity function that ... (actually a simple identity function will do the job))
<lapinot>
companion_cube: wow, on fire ;)
<orbifx>
smondet[m]: here?
gregoire has quit [Ping timeout: 240 seconds]
snowcrshd has quit [Remote host closed the connection]
<lapinot>
if anyone wonders, my code is representing typed lambda calculus and nbe should return a term in eta-long beta-normal form
<lapinot>
(at least that's what the papers says!)
gregoire has joined #ocaml
fraggle_ has joined #ocaml
moei has quit [Quit: Leaving...]
marsam has quit [Remote host closed the connection]
marsam has joined #ocaml
silver has quit [Read error: Connection reset by peer]
silver has joined #ocaml
maattdd has joined #ocaml
spew has joined #ocaml
rightfold has joined #ocaml
<rightfold>
Anyone done OCaml-Rust interop?
ryanartecona has joined #ocaml
lpaste_ has quit [Ping timeout: 240 seconds]
* Drup
points at Enjolras
Ayey_ has joined #ocaml
Ayey_ has quit [Ping timeout: 258 seconds]
<rgrinberg>
Drup: i see you're finally warming up to jbuilder
lpaste has joined #ocaml
<Drup>
By "warming up" you mean "yell because I can't even write my tests" ? :D
<Drup>
you'll see quite soon what it was for.
hovind has quit [Ping timeout: 240 seconds]
<rgrinberg>
Drup: in your ticket, is my_ppx just a binary that you produce?
<Drup>
rgrinberg: it's a by product of a ppx library
ode has joined #ocaml
<Drup>
(as in, a library with "(kind ppx_rewriter)"
<Drup>
All in all, I'm not sure how I feel about the limited flexibility
<rgrinberg>
I'm not sure about the subtleties of ppx here, but I ported atdgen along with its tests fairly easily. You can talk about the binary that you produced in rules with ${bin:binary_name}
<Drup>
that doesn't work in that case, afaics
<rgrinberg>
You can also take a look at some jst ppx packages for how to do it.
<Enjolras>
rightfold: hi, for ocaml / rust bindings, the easier is to use ctypes for generating the bindings with rusty-cheddar to generate a C header file from rust
<Enjolras>
future is rusty-binder but i've not tried it
<Enjolras>
In theory we could make ctypes generate rust-binding directly but this is quite some work to write ocaml-rusttypes :)
marsam has quit [Remote host closed the connection]