<Drup>
huum, maybe it's indeed going to just be a "Pstr_attribute" hanging around
ski_ is now known as ski
claudiuc_ has joined #ocaml
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
claudiuc has quit [Ping timeout: 240 seconds]
martinsk has quit [Quit: This computer has gone to sleep]
<whitequark>
Drup: there's no concept of a file attribute...
thomasga has quit [Quit: Leaving.]
arjunguha has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuc_ has quit [Remote host closed the connection]
hhugo has quit [Read error: Connection reset by peer]
hhugo has joined #ocaml
squiggnet has quit [Ping timeout: 260 seconds]
racycle_ has quit [Quit: ZZZzzz…]
q66_ has joined #ocaml
hausdorff has joined #ocaml
q66 has quit [Ping timeout: 252 seconds]
lordkryss has quit [Ping timeout: 252 seconds]
ygrek has joined #ocaml
distantunclebob has joined #ocaml
distantunclebob1 has quit [Ping timeout: 255 seconds]
mpmilano_ has joined #ocaml
<mpmilano_>
hey guys, I've got a stack overflow whose backtrace is entirely the same line in list.ml - any idea how I can find out where the error actually comes from?
q66_ has quit [Quit: Leaving]
philtor_ has quit [Ping timeout: 264 seconds]
squiggnet has joined #ocaml
hhugo has quit [Quit: Leaving.]
groovy2shoes has joined #ocaml
shinnya has quit [Ping timeout: 272 seconds]
hhugo has joined #ocaml
ygrek has quit [Ping timeout: 248 seconds]
manizzle has quit [Ping timeout: 255 seconds]
ygrek has joined #ocaml
penglingbo has joined #ocaml
Muzer has joined #ocaml
martinsk has joined #ocaml
alexst has quit [Ping timeout: 244 seconds]
alexst has joined #ocaml
hhugo has quit [Quit: Leaving.]
alexst has quit [Ping timeout: 248 seconds]
tnguyen1 has quit [Ping timeout: 260 seconds]
<ygrek>
mpmilano_, which function?
<ygrek>
list module in stdlib trades speed for tail recurisvness
<ygrek>
and can blow the stack
<ygrek>
don't use it for long lists
<mpmilano_>
ygrek: just don't really know which of my many lists is long
<mpmilano_>
I went and instrumented them all for length and found it. thanks though
racycle has joined #ocaml
groovy2shoes has quit [Ping timeout: 244 seconds]
jao has quit [Ping timeout: 248 seconds]
yacks has quit [Ping timeout: 260 seconds]
arjunguha has joined #ocaml
arjunguha has quit [Client Quit]
axiles has joined #ocaml
arjunguha has joined #ocaml
yacks has joined #ocaml
yacks has quit [Ping timeout: 248 seconds]
philtor has joined #ocaml
arjunguha has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alpounet has joined #ocaml
mpmilano_ has quit [Remote host closed the connection]
jbrown has quit [Ping timeout: 255 seconds]
arjunguha has joined #ocaml
arjunguha has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jbrown has joined #ocaml
yacks has joined #ocaml
tulloch has joined #ocaml
ygrek has quit [Ping timeout: 244 seconds]
yacks has quit [Quit: Leaving]
yacks has joined #ocaml
racycle has quit [Ping timeout: 244 seconds]
dant3 has quit [Remote host closed the connection]
racycle has joined #ocaml
philtor has quit [Ping timeout: 272 seconds]
martinsk has quit [Quit: Leaving]
distantunclebob has quit [Quit: Leaving.]
racycle has quit [Quit: ZZZzzz…]
ustunozg_ has joined #ocaml
jsvgoncalves has joined #ocaml
WraithM has quit [Ping timeout: 252 seconds]
Simn has joined #ocaml
dant3 has joined #ocaml
alpounet has quit [Ping timeout: 260 seconds]
alpounet has joined #ocaml
Eyyub has quit [Ping timeout: 264 seconds]
WraithM has joined #ocaml
sagotch has joined #ocaml
divyanshu has joined #ocaml
cago has joined #ocaml
yacks has quit [Quit: Leaving]
eikke__ has joined #ocaml
maattdd has joined #ocaml
tulloch has quit [Ping timeout: 255 seconds]
BitPuffin has quit [Ping timeout: 264 seconds]
arjunguha has joined #ocaml
arjunguha has quit [Client Quit]
tulloch has joined #ocaml
yacks has joined #ocaml
alpounet has quit [Remote host closed the connection]
thomasga has joined #ocaml
alpounet has joined #ocaml
mort___ has joined #ocaml
hhugo has joined #ocaml
jludlam has joined #ocaml
AltGr has joined #ocaml
maattdd has quit [Ping timeout: 248 seconds]
Kakadu has joined #ocaml
hausdorff has quit [Remote host closed the connection]
divyanshu has quit [Quit: Computer has gone to sleep.]
divyanshu has joined #ocaml
jludlam is now known as jonludlam
BitPuffin has joined #ocaml
lordkryss has joined #ocaml
lordkryss has quit [Ping timeout: 272 seconds]
tulloch has quit [Read error: Connection reset by peer]
lordkryss has joined #ocaml
tulloch has joined #ocaml
ustunozg_ has quit [Remote host closed the connection]
<mort___>
got an opam/iocaml package issue — what happened to the bytes.1.0 and bytes.1.1 packages?
<mort___>
they seem to have been removed, but that's made `opam upgrade` just now fail because iocaml-kernel relies on `Bytes` (presumably provided by the previuosly installed bytes.1.1 package)
<mort___>
sorry, iocaml-kernel appears to use ctypes which relies on bytes
<mort___>
(and findlib also warning that topdirs.cmi is in several directories)
siddharthv has quit [Quit: leaving]
siddharthv has joined #ocaml
deavid has quit [Ping timeout: 244 seconds]
deavid has joined #ocaml
dsheets_ has joined #ocaml
<octachron>
BitPuffin: What is the difference with Ocaml first class module? (except for the syntax)
sagotch has joined #ocaml
<Kakadu>
mort___: topdirs.cmi is minor warning, it doesn't ruin anything
alpounet has quit [Ping timeout: 252 seconds]
alpounet has joined #ocaml
mort___ has quit [Ping timeout: 260 seconds]
darkf has joined #ocaml
<BitPuffin>
octachron: that it's polymorphic
<BitPuffin>
octachron: think the object orientation of ocaml but for modules
<BitPuffin>
so you can take a module that contains at least this function, but possibly more
<BitPuffin>
plus working with first class modules in ocaml is a bit awkward because you have to unpack and all that stuff. Here it is the only way :)
<octachron>
hum, I am not sure how it is different from Ocaml.
<octachron>
If you have a function : (module S) -> thing we can use any module which implements at least the signature S
<octachron>
But I agree that Ocaml first class module syntax is awkward
<BitPuffin>
octachron: well for one you will be able to do something like this:
<BitPuffin>
m: Sig1..Sig2..
<BitPuffin>
so it implements at least Sig1 and Sig2
<BitPuffin>
or you can say Sig1..Sig2 where it implements both but no more
<BitPuffin>
then I'm thinking there will be a way to make a subset of a signature
<BitPuffin>
but I didn't consider that ocaml actually let's a signature to implement more
avsm has quit [Quit: Leaving.]
<BitPuffin>
so it's pretty much ocaml's module system but packaged up in a way that makes you want to use that and never use OO because it won't have any :P
q66 has joined #ocaml
<octachron>
So what you want is to add more way to combine signatures?
<BitPuffin>
yeah
<BitPuffin>
I don't think ocaml infers modules either the same way
<BitPuffin>
I mean you have to do let three = (module Three : X_int);;
ustunozg_ has quit [Remote host closed the connection]
ygrek has quit [Ping timeout: 255 seconds]
<octachron>
Is'n it equivalent to have some sort of higher-kinded function, ie function from type to type?
<BitPuffin>
so you have to specify that the module type is X_int, so it's lame
<BitPuffin>
octachron: which thing?
<octachron>
The union or intersection of signatures
<BitPuffin>
ah
<BitPuffin>
yeah I guess it could be
<BitPuffin>
but that's again awkward
<octachron>
Module type inference is quite limited but I am not sure if it is a theoretical problem or just a consequence of the fact that first class module is a quite recent feature.
<BitPuffin>
that said it's not like the reason I'm creating the language is solely the module system, it's just a mockup on how I wanted the module part to work :P
<BitPuffin>
octachron: I think it is mainly so that you can return Mod.t instead of some generic type
<BitPuffin>
could be wrong though
tulloch has quit [Ping timeout: 248 seconds]
<BitPuffin>
also the language is not really meant to make anyone happy but me. I'm basically inventing things as I go along according to what I need.
avsm has joined #ocaml
<octachron>
Speaking about higher-kinded type problem, I always found quite distressing that you cannot write "Tuple.map functions_tuples argument_tuples"
rand000 has quit [Quit: leaving]
tulloch has joined #ocaml
<BitPuffin>
The main thing the subset of a signature thing will be used for is for domain specific APIs. So for example the thing I want to make is that if you have say a linear algebra math library. And you make a subcompiler that takes the yig (language name) code and compiles it to GLSL, you might only have a subset of the moudle available. So in this case the math library would normally expose an N dimensional vector
<BitPuffin>
and an R*C dimenional matrix, but those are not available in GLSL or HLSL so you need to make a subset
siddharthv is now known as siddharthv_away
<BitPuffin>
octachron: how come you can't?
<octachron>
BitPuffin: Have you tried to write down the type of this function?
<BitPuffin>
I will be doing that
<BitPuffin>
or wait you mean Tuple.map?
<BitPuffin>
no
<octachron>
Yeah, I meant the type of Tuple.map
<BitPuffin>
val map: ('a -> 'b) * ('c -> 'd) list -> 'a * 'c list -> 'b * 'd list ?
squiggnet has quit [Ping timeout: 255 seconds]
<BitPuffin>
octachron: I don't see why that doesn't work?
<octachron>
Sorry, I was thinking of the more general N-uple.map : " [prod (a_k -> b_k)] -> [prod a_k ] -> [prod b_k] "
squiggnet has joined #ocaml
<octachron>
i.e you cannot type function which works for any kind of n-uple, even if you can "write" them
ustunozg_ has joined #ocaml
<BitPuffin>
sure you can
<BitPuffin>
just wrap the tuple into a generic type
<BitPuffin>
don't know if that works in ocaml
<BitPuffin>
but in my language I guess that would be something like
tulloch has quit [Ping timeout: 272 seconds]
<BitPuffin>
val map <A, B>: (A -> B) list -> A list -> B list
<BitPuffin>
it's not apparent that it's a tuple here though
<BitPuffin>
but I think I'll come up with some syntax to constrain it to a type kind
<BitPuffin>
maybe:
<octachron>
The problem is that every element of the list could have a different type
<BitPuffin>
octachron: no it can't, lists are homogenous
<octachron>
But n-uples are not : n-uple are finite inhomogeneous list (or array)
<BitPuffin>
val map <A(nple), B(nple)>: (A -> B) list -> A list -> B list
<gasche>
you can write something like a generic Tuple.map with GADTs for heterogeneous lists
<BitPuffin>
octachron: well no an nple (a, b, c) won't be the same type as nple (a, b, c, d) so you couldn't have both in a list
<gasche>
it's less syntactically convenient than tuples, but it's only one syntactic sugar away
<gasche>
you can in fact also do that without GADTs, using combinators
<gasche>
you'll need an explicit arity marker in either cases
<gasche>
(which could be inferred by type-directed code inference)
avsm has quit [Quit: Leaving.]
<octachron>
gasche: Really? Good news. Last time I tried to use gadt to do that I failed. Maybe I should have tried harder
<gasche>
it's not really an earth-moving problem in my personal opinion
<BitPuffin>
what's gadt?
<gasche>
guarded algebraic datatypes
<BitPuffin>
which is?
<mrvn>
octachron: The hard part though is getting the ntuple out of a mixed list in a usable form though
<mrvn>
BitPuffin: allows you to write a function returning different types dependent on the input
<BitPuffin>
ohhh waiiiit
<BitPuffin>
octachron: you mean mapping over the elements of the nple and not a list of nple?
<ousado>
octachron didn't say anything about a mixed list, AFAIU
<octachron>
BitPuffin : yes. But it seems I was wrong :)
<BitPuffin>
mrvn: just do (cdr (cdr (cdr( cdr(...) :P
<BitPuffin>
implement a c*r syntax extension
<BitPuffin>
so you can do
<BitPuffin>
cddddddddddddddddddddddddddddr
<mrvn>
BitPuffin: that would not give you the right type
<BitPuffin>
sure it would
<mrvn>
BitPuffin: not in a mixed list
<BitPuffin>
well I mean the type of the nple is known
<BitPuffin>
so it will know the type of the element at cddddddddddddddddddddddddddddr
<BitPuffin>
you can never write an nple that you don't know the type of
<mrvn>
anyway, back to the original problem. You want a function map that takes a list of funtions 'a_n -> 'b_n and apply that to a list of ('a_1 * 'a_2 * .. * 'a_n) tuples?
<BitPuffin>
so a language could allow you to write a generic function to pass to a map and verify that the function indeed works for all the types
<flux>
I've written apply2 and apply3 functions when I've needed it
<flux>
actually probably apply4 as well
<flux>
but applyn, well, it doesn't really fit the type system as of now :)
<BitPuffin>
flux: well what I'm saying is that you could write one that works for any and can verify at compiletime that it will work
<BitPuffin>
maybe not in ocaml
<BitPuffin>
but it's theoretically possible
thomasga has quit [Quit: Leaving.]
<mrvn>
yes
<flux>
with obj.magic anything is possible!
<octachron>
@mrvn : Just to apply the functions f_1,...,f_n to the arguments a_1,...,a_n for any n
maattdd has joined #ocaml
<octachron>
giving f_1 a_1, ..., f_n a_n as a result
<mrvn>
Problem is tuples aren't extensible. You can't take a n-tuple and another element and produce a n+1-tuple.
<mrvn>
So you need to have a witnes type that is something other than a tuple and allows such a transformation to build your f_1 ... f_2
<BitPuffin>
so if you have a type (int * int * string * int * float * string * int), there are 3 different types in here, so if you write a val: 'a -> 'b that you want to map over the nple type you just instantiate that function for the 3 different types and verify that there is no type error and then you map
<octachron>
@mrvn: For this part of the problem, you can use a GADT type, isn'it?
<mrvn>
BitPuffin: Huh? YOu only want to provide one int -> .. function and use that for all elements that are int?
<mrvn>
octachron: you can. DOn't even have to I think
<BitPuffin>
mrvn: yeah?
<mrvn>
BitPuffin: then you need runtime type informations
<BitPuffin>
no
<mrvn>
BitPuffin: yes you do.
<BitPuffin>
nple types are known at compile time
<mrvn>
BitPuffin: nope. they can be polymorphic
<BitPuffin>
how so?
<mrvn>
BitPuffin: you know the n, not the types
<mrvn>
(
<BitPuffin>
well yeah
<BitPuffin>
but you will instantiate map for all the different tuples
<mrvn>
('a * 'b * 'c) tuples
<mrvn>
Is 'a an int or a float? Who knows.
<BitPuffin>
you will know
<mrvn>
not if it is polymorphic
<BitPuffin>
you mean generic
<BitPuffin>
or what do you mean
<flux>
let's say you have that function tuplemap. then you have function: let doit xs = tuplemap int_of_string xs . What is the type of 'doit'?
<BitPuffin>
'a might be a variadic type sure
<mrvn>
let map_twice f1 f2 list = map f2 (map f1 list)
<BitPuffin>
but you can know statically that you then need to deal with that
<flux>
only if you don't have separately compiled code, which ocaml does
<BitPuffin>
flux: the type is generic
<mrvn>
map_twice has no idea about any of the types in the tuples.
<flux>
"generic"? ('a -> 'b) ?
<BitPuffin>
yeah
<BitPuffin>
mrvn: yes it does
<BitPuffin>
well it can at least
<BitPuffin>
dunno about ocaml
<flux>
and then I wrote another module that calls doit 4.0
<flux>
how does doit know what to do without runtime types?
<mrvn>
BitPuffin: no it can't.
<flux>
it has been compiled before I enter that expression (say, in the toplevel)
<BitPuffin>
flux: because it knows at compiletime which nples you pass to it
<flux>
bitpuffin, then you actually want a macro, not a function
<mrvn>
BitPuffin: at compile time you don't pass anything to it. That bit of code is it.
<BitPuffin>
flux: a generic function
<BitPuffin>
but sure
<flux>
because due to separate compilation it cannot know how it's being called
<BitPuffin>
a macro works as well
<BitPuffin>
well that's what I mean by instantiate
<flux>
well, the new extension point systems might just give what you want
<BitPuffin>
separate compilation
<mrvn>
BitPuffin: ocaml doesn't instantiate
<flux>
as I understand it it's possible to interact with the type system with some witchcraft
<BitPuffin>
octachron was the one who wanted it
<ousado>
octachron: what you were talking about is a tuple of n functions, and all you want is to apply them to n arguments so you get a tuple of (f_0 a_0),..,(f_n a_n) right?
<BitPuffin>
mrvn: but my language will
<BitPuffin>
mrvn: like I said, it is possible, just maybe not in ocaml :P
<mrvn>
BitPuffin: to make that work like you want you need a GADT that acts as runtime type. Then for each tuple element you can lookup the right function for the type at runtime and call it.
<mrvn>
BitPuffin: then your language doesn't have polymorphic functions.
<BitPuffin>
mrvn: no it will have generic functions
<mrvn>
BitPuffin: which is like c++ templates and sucks
<flux>
it would be even easy in cases where you explicitly spell out the value, say @@[tuplemap int_of_string (42, "42")]
<BitPuffin>
mrvn: no it doesn't
<mrvn>
BitPuffin: yes it does. it needlessly duplicates code like crazy and take forever to compile
<octachron>
ousado: yes, for any n
<BitPuffin>
mrvn: you could probably be smart about it
<ousado>
yes
<BitPuffin>
mrvn: instantiate some, polymorph some others :P
<mrvn>
BitPuffin: that takes ever more time. And whole programm optimization
<mrvn>
BitPuffin: as soon as you polymorph some you are back to the original problem.
<octachron>
BitPuffin: I am not even sure that I want it, it just seems strange that this kind of function is that much harder to write than to define
<mrvn>
applying non-polymorphic functions to a polymorphic type needs some runtime type infos.
<BitPuffin>
mrvn: so polymorphic functions determine their behaviour at runtime?
<mrvn>
BitPuffin: no. polymorphic functions don't care about the type at all.
<BitPuffin>
alrighty
<mrvn>
For the polymorphic function the polymorphic type is simply abstract. That's why you can't call the int -> .. function when the 'a happens to be an int.
<BitPuffin>
well then you see what you do, is that you first instantiate a polymorphic version, and then for types that don't work with polymorphic functions you instantiate the function template style
Shozan has joined #ocaml
<mrvn>
octachron: you need to build the list of functions for map the same way you build the tuple so you can match the resulting types.
<BitPuffin>
mrvn: I think it's a nice compromise between the two
<mrvn>
BitPuffin: nope. it sucks.
<BitPuffin>
polymorphic functions have size advantages, so it's preferrable, but sometimes it doesn't work, so for those cases you generate code
<BitPuffin>
it doesn't suck
<BitPuffin>
it's perfect
<BitPuffin>
the optimal way :)
penglingbo has quit [Ping timeout: 255 seconds]
ggole has joined #ocaml
<mrvn>
BitPuffin: with first class functions you quickly have function taking multiple polymorphic functions and then your type space grows exponential. You compiler quickly takes more time than the univers still has to compile your code.
<BitPuffin>
mrvn: yeah, but generally you will be using polymorphic functions :P
<octachron>
@mrvn: Do you mean by constructing the function tuples and argument tuples silmutaneously? i.e consructiong a 'a * ('a->'b) tuple or is it some other way?
<BitPuffin>
mrvn: I mostly care about which one is faster at runtime though
<mrvn>
octachron: For your ('a * 'b) nupple you need a (('a * 'b) -> ('c * 'c)) mapper
<BitPuffin>
mrvn: but how the hell does static dispatch work with polymorphic functions
thomasga has joined #ocaml
<mrvn>
BitPuffin: since there can be only exactly one of each function it just gets dispatched.
<mrvn>
BitPuffin: that's the part you break when you specialize.
<mrvn>
octachron: s/'c/'d/
tulloch has joined #ocaml
<mrvn>
octachron: the map function then can match the ('a * 'b) tuple against the ('a * 'b) in the mapper.
shinnya has joined #ocaml
<mrvn>
octachron: by the way, your type isn't a tuple, only a fixed length list.
<BitPuffin>
mrvn: Well it doesn't break, but it grows in size
<mrvn>
BitPuffin: no, it breaks. you get mulltiple flavours of the same function. Then you have to worry about calling the right one.
<BitPuffin>
mrvn: no, the compiler worries about generating code that calls the right one
<mrvn>
BitPuffin: you == your compiler
<mrvn>
Thats the part that grows exponentially if unstoped.
<BitPuffin>
mrvn: which it won't, because usually it will be polymorphic
<BitPuffin>
mrvn: there is only in edge cases like this nple-map where you need to instantiate
<mrvn>
BitPuffin: which grows exponentially
<octachron>
@mrvn : Interesting. What distinction do you make between tuple and finite length list?
<BitPuffin>
mrvn: it does, but you rarely need it
<BitPuffin>
so in the end I don't think it will destroy the compiler particularly much
maattdd has quit [Quit: WeeChat 0.4.3]
<octachron>
@mrvn: Commutativity?
<mrvn>
BitPuffin: which you often can only know when everything is compiled. So goodbye to the seperate compilation units.
<mrvn>
octachron: nothing to do with it
<BitPuffin>
mrvn: you mean compiling on multiple cores?
<BitPuffin>
you can probably get around that
<mrvn>
octachron: val map_tuple : (('a * 'b) -> ('c * 'd)) mapper -> ('a * 'b) tuple list -> ('c * 'd) tuple list
<BitPuffin>
with more passes xD
<mrvn>
BitPuffin: no, compile one module at a time so you only need to recompile the module that changed in a large source.
<BitPuffin>
mrvn: caching?
avsm has joined #ocaml
<mrvn>
BitPuffin: any function like map can only be compiled when you see how it is finally applied. So basically you end up doing whole program compilation for every little change.
<BitPuffin>
I guess the ocaml arrays are as crappy as they are because of polymorphism
<BitPuffin>
because their size are a runtime value
<mrvn>
BitPuffin: how is that crappy?
<BitPuffin>
less static checking
<ggole>
That's because of float specialisation, not polymorphism
<BitPuffin>
you need both though
<mrvn>
You can do static size with GADT
<BitPuffin>
how does that work
<mrvn>
BitPuffin: you get a witness type for the size
<BitPuffin>
could you show an example?
<mrvn>
not from memory. Bu you get something like "val make : 'a size -> 'b -> ('a size * 'b) array" and "make (D Three Four Two) 0" to make an array of size 342.
<octachron>
@mrvn: I understand my error was trying to construct the mapper as a simple tuple. I see how it works. Thanks. But I still don't understand the difference between tuple and finite list :)
<mrvn>
octachron: a tupple has O(1) access to each element. Your type has to iterate over your type till it gets the nth element.
<BitPuffin>
mrvn: hmm
<BitPuffin>
mrvn: GADTs seem interesting
maattdd has joined #ocaml
<octachron>
mrvn: Ok. I was just thinking about the mathematic semantic and not the algorithmic complexity.
<mrvn>
BitPuffin: Once you have such a sized array type you can also proof that your quicksort never has accesses something outside the allowed size.
<mrvn>
BitPuffin: as it in only compiles if it is correct and then you can use the unsafe_get functions.
<mrvn>
s/as it in/as in it/
<BitPuffin>
mrvn: It seems awfully a lot like the type properties I wanted to have in my language
<BitPuffin>
mrvn: Ie not just type parameters, but parameters to the type that are only used at compile time. Such as vector size, if it is normalized or if a matrix is orthogonal
<mrvn>
BitPuffin: problem is that the code gets a lot more complex to write because you have to annotate the types everywhere. Would be easier with some compiler magic.
thomasga has quit [Quit: Leaving.]
<BitPuffin>
mrvn: yeah, i was thinking maybe I could take this but wrap it in a way that gives you fuzzy feelings and looks just like templates, except it isn't
<BitPuffin>
so you could do type <T>[D] vector = T array D or something
<BitPuffin>
just some sample syntax
<BitPuffin>
so from that you could do
<BitPuffin>
type vec3 = <float32>[3] vector
thomasga has joined #ocaml
shinnya has quit [Ping timeout: 248 seconds]
<ggole>
Oh length, I thought you meant element size
arjunguha has joined #ocaml
<ggole>
Never mind me.
arj has joined #ocaml
shinnya has joined #ocaml
yacks has quit [Read error: Connection reset by peer]
<BitPuffin>
mrvn: do you by any chance know a good paper about GADTs?
ontologiae has joined #ocaml
tulloch_ has joined #ocaml
<mrvn>
BitPuffin: no. but there are good posts on the ML
thomasga has quit [Quit: Leaving.]
arjunguha has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tulloch has quit [Ping timeout: 252 seconds]
Shozan is now known as SHODAN
<sagotch>
I am having trouble with polymorphic variants and "generic" printing function. Here is my file: http://pastebin.com/dhzn1RNA (45 lines, half is empty lines), and what the toplevel says is here : http://pastebin.com/wNA3Qk75.
<sagotch>
I never used polymorphic variants for real application before, so maybe I am doing it wrong
<sagotch>
does my code looks like junk?
huza has joined #ocaml
<mrvn>
sagotch: your to_string has the wrong type
<mrvn>
sagotch: why do you use 'a alloca in 'a load and 'a store?
<sagotch>
(and there is one error on the `Return, which misses a parameter)
<sagotch>
Because you load from an alloca
<sagotch>
and store to an alloca
<sagotch>
which has to be typed
<sagotch>
cant store or load a float to or from a int alloca
<mrvn>
sagotch: so make it type 'a store = [`Store of 'a * 'a typp];;
yacks has joined #ocaml
<mrvn>
sagotch: this might also work better with GADTs
ontologiae has quit [Ping timeout: 252 seconds]
<sagotch>
I do not think making [`Store of 'a * 'a typp] is going to work. I need to know the alloca where I want to store, not only the typp
<mrvn>
sagotch: and alloca is only the type
<mrvn>
At least match against `Load (`Alloca t) so you avoid the broken recursion
ontologiae has joined #ocaml
penglingbo has joined #ocaml
<sagotch>
Okay for matching `Load, but alloca could have more than a type later, such as a name
<mrvn>
at the moment it only has an alloca so you need to match that
<sagotch>
I will try with GADT (I actually tried before and did not suceed, but not with the same example)
mcsquiggedy has left #ocaml ["Leaving"]
divyanshu has quit [Quit: Computer has gone to sleep.]
avsm has quit [Quit: Leaving.]
maattdd has quit [Ping timeout: 264 seconds]
maattdd has joined #ocaml
huza has quit [Quit: WeeChat 0.3.8]
tane has joined #ocaml
Simn has quit [Ping timeout: 240 seconds]
divyanshu has joined #ocaml
<sagotch>
Seems better with GADT indeed :)
<mrvn>
That's why they were added
<ggole>
...until you need a list, set, or map of them
<BitPuffin>
mrvn: btw aren't functors a little bit like templates?
<BitPuffin>
since you can do substitution stuff
shinnya has quit [Ping timeout: 272 seconds]
distantunclebob has quit [Client Quit]
<BitPuffin>
hmm
<BitPuffin>
how the hell does variant types work behind the scenes?
<adrien_oww>
integers
<BitPuffin>
wat
<BitPuffin>
but they can have string values and stuff
<BitPuffin>
couldn't you do a lot of optimizations and jump directly to a match branch?
<BitPuffin>
that is when the value isn't coming from a runtime value
<ggole>
They're either an integer or a pointer to a tagged block
ygrek has joined #ocaml
<ggole>
(In OCaml: the abstract nature of the types permits other possible implementations)
octachron has quit [Quit: Page closed]
avsm has joined #ocaml
tani has joined #ocaml
Eyyub has quit [Ping timeout: 244 seconds]
tane has quit [Ping timeout: 260 seconds]
hausdorff has joined #ocaml
tulloch_ has quit [Ping timeout: 240 seconds]
tulloch has joined #ocaml
ustunozgur has joined #ocaml
tulloch has quit [Ping timeout: 252 seconds]
jeregrine_ has joined #ocaml
jeregrine_ has quit [Remote host closed the connection]
philtor has quit [Ping timeout: 255 seconds]
ustunozg_ has quit [Ping timeout: 272 seconds]
Hannibal_Smith has quit [Quit: Sto andando via]
hausdorff has quit [Remote host closed the connection]
tulloch has joined #ocaml
ontologiae has quit [Ping timeout: 272 seconds]
tulloch has quit [Ping timeout: 252 seconds]
avsm has quit [Quit: Leaving.]
q66 has quit [Quit: Leaving]
ontologiae has joined #ocaml
avsm has joined #ocaml
Kakadu has quit [Ping timeout: 246 seconds]
<Drup>
BitPuffin: if you don't know Idris, look it up
<Drup>
and mrvn, no, this is not gadt, it's dependent type
<Drup>
you can emulate a subset of dependent types with GADT, but it's a huge pain in the ass
Eyyub has joined #ocaml
<BitPuffin>
Drup: thanks that will be a useful resource
<Drup>
BitPuffin: the concept you are looking for the "type only at compile time" thingy is "type erasure"
<Drup>
and it's something quite powerful (and useful) in dependently typed languages, because you it can also erase equality and type witnesses
<BitPuffin>
type only at compile time?
ontologiae has quit [Ping timeout: 255 seconds]
<Drup>
no more types at runtime
<BitPuffin>
yeah that I don't want
<Drup>
ocaml does it, but not for gadts
<BitPuffin>
does idris do it?
AltGr has left #ocaml [#ocaml]
<Drup>
yes
<BitPuffin>
will have to read up on this language
<Drup>
beware, it's a bit heavy on the type theory stuff, because dependent types ;)
<BitPuffin>
well it sounds interesting
tulloch has joined #ocaml
<BitPuffin>
in fact I may even have to write some code in this idris :D
<Drup>
ATS and Coq extraction also do this kind of crazy type erasure, but I would argue they are less viable as the practical programming language
<Drup>
as a*
<Drup>
(and Agda do barely any type erasure at all)
<BitPuffin>
Drup: thanks for pointing me in this direction, super nice inspirations
<BitPuffin>
kinda funny, because the main thing about my idea is that you could have type properties (type dependencies) of any type in the language and it turns out it's been done xD
<Drup>
of course it's been done
<Drup>
language designer should be forced to do like PHDs
<companion_cube>
:D
hausdorff has joined #ocaml
<Drup>
do the fucking bibliography first
<Drup>
:p
tulloch_ has joined #ocaml
tulloch has quit [Ping timeout: 244 seconds]
<BitPuffin>
Drup: well I'm only designing this language for my own needs :P
<BitPuffin>
because no language provides everything I want :P
<Drup>
I know, I know, let's say it's my personal never-ending-rant ;)
<BitPuffin>
Drup: how is idris on the concurrency+parellellism front?
<Drup>
I don't know.
<BitPuffin>
Drup: yeah :) you are probably right when it comes to general purpose take over the world languages
<Drup>
Idris is very young anyway
<Drup>
(it's 2 years old, I think ?)
<Drup>
so there is room for improvement, I think you would find very happy people if you want to add concurency stuff
<BitPuffin>
-- WARNING: No guarantees that this works properly yet!
<BitPuffin>
well gtg! see y'all!
Eyyub has quit [Ping timeout: 240 seconds]
BitPuffin has quit [Ping timeout: 252 seconds]
tulloch_ has quit [Ping timeout: 244 seconds]
philtor has joined #ocaml
Hannibal_Smith has joined #ocaml
arjunguha has joined #ocaml
philtor has quit [Ping timeout: 272 seconds]
avsm has quit [Quit: Leaving.]
Kakadu has joined #ocaml
ygrek has quit [Ping timeout: 255 seconds]
Eyyub has joined #ocaml
slash^ has joined #ocaml
studybot_ has quit [Ping timeout: 264 seconds]
dsheets_ has quit [Ping timeout: 252 seconds]
studybot_ has joined #ocaml
penglingbo has quit [Ping timeout: 255 seconds]
BitPuffin has joined #ocaml
Thooms has joined #ocaml
samebchase has quit [Ping timeout: 264 seconds]
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
lordkryss has quit [Ping timeout: 252 seconds]
distantunclebob has joined #ocaml
alpounet has quit [Remote host closed the connection]
tani has quit [Quit: Verlassend]
eikke__ has quit [Ping timeout: 260 seconds]
Averell is now known as Averell
eikke__ has joined #ocaml
samebchase has joined #ocaml
lordkryss_ has joined #ocaml
ontologiae has joined #ocaml
tulloch has joined #ocaml
ontologiae has quit [Ping timeout: 260 seconds]
distantunclebob1 has joined #ocaml
ontologiae has joined #ocaml
distantunclebob has quit [Ping timeout: 240 seconds]
eikke__ has quit [Ping timeout: 252 seconds]
eikke__ has joined #ocaml
cago has left #ocaml [#ocaml]
ygrek has joined #ocaml
Eyyub has quit [Ping timeout: 248 seconds]
leovonl has joined #ocaml
arjunguha has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eikke__ has quit [Ping timeout: 272 seconds]
eikke__ has joined #ocaml
tulloch has quit [Ping timeout: 248 seconds]
arjunguha has joined #ocaml
arjunguha has quit [Client Quit]
arjunguha has joined #ocaml
pgomes has joined #ocaml
alpounet has joined #ocaml
eikke__ has quit [Ping timeout: 255 seconds]
eikke__ has joined #ocaml
rand000 has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
arjunguha has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Drup>
just read gerd's post, am I the only to think "use a fonctor" ?
<whitequark>
Drup: functors are cancer.
<whitequark>
like templates in C++
<adrien>
Drup: I'd say you should probably think a bit more about it and more than that, try to think from Gerd's POV
<whitequark>
heavily functorized code is hard to write, hard to test, hard to use and especially hard to have sane documentation for
<Drup>
whitequark: I respectfully disagree :)
<adrien>
he's german, he speaks in a funny way :P
* orbitz
likes functors quite a bit
<whitequark>
I know one thing, *almost* every time I had to use a functor, I regretted it
<orbitz>
I write functors to maek it easier to test
arjunguha has joined #ocaml
<orbitz>
Why didn't they just introduce rstring isntead?
<orbitz>
and have conversation functions?
<orbitz>
making string immubtale seems like a pretty heavy handed change, no?
<Drup>
adrien : I don't think he's completely wrong, just that I don't think his solution are good
<orbitz>
When reading it my first thought was if you're going to break backwards compat, why not use a phantom type?
<pippijn>
orbitz: phantom type would fix .get
<orbitz>
indeed, and restrict .set
<orbitz>
if you don't mind just having a read only view you can just make it a projection on a strong as well
<orbitz>
what am I missing?
eikke__ has quit [Ping timeout: 240 seconds]
<Drup>
whitequark: yet you solved the issue with a functor in ocaml-sodium
<orbitz>
he said he regretted it though!
<whitequark>
Drup: nope!
<whitequark>
in sodium, it's used to switch between Bytes/Bigbytes
<Drup>
it's still a functor, used for the same kind of thing !
<pippijn>
I used functors in my unicode lib
<pippijn>
and I think it was not a bad choice
<Drup>
orbitz: I feel like just making them immutable would break some code, but not that much
<Drup>
changing the arity of string would break a lot more stuff
<pippijn>
yes
<orbitz>
yes it would
<orbitz>
IMO, adding rstring type is better, but that's me
<Drup>
orbitz: well, that's basically the same as the current solution
<orbitz>
no it isn't
<orbitz>
from what I understand
hhugo has quit [Quit: Leaving.]
<orbitz>
I dunno, i think it will break a lot of code to be honest. Enough to be really annoying, at least.
ygrek has quit [Ping timeout: 244 seconds]
fraggle_ has quit [Remote host closed the connection]
<Drup>
whitequark: since you seem to have a strong opinion about functors, what do you think of typeclasses (either the Haskell, Scala or Rust variation) ? :p
<whitequark>
Drup: never seen Scala, Rust has a really great implementation
<whitequark>
and apparently Haskell's is inferior to what is planned for OCaml
<whitequark>
I think the typeclasses as they hopefully will appear in OCaml are really great
<whitequark>
"implicits"
fraggle_ has joined #ocaml
<Drup>
and why do you think it's better than functors ?
<whitequark>
?
<whitequark>
they're orthogonal?
<orbitz>
whitequark: not quite, as far as I undertand
<orbitz>
typecalsses are essentially functors that write more code for you
<whitequark>
so here's Drup's answer: I don't have to do so much work
<Drup>
so much work ?
<whitequark>
yes, functors are a lot of work, see above. testing is a pain, knowing how to properly instantiate them is a pain
<whitequark>
figuring out docs is a pain. ocamldoc *sucks* at documenting functors, you never know where you'll see the docs and where you'll just have three levels of hierarchy ending in an empty page
axiles has quit [Remote host closed the connection]
<Drup>
I agree about ocamldoc
jao has quit [Ping timeout: 252 seconds]
<Drup>
I think you haven't used typeclasses enough to see the pain point :p
<Drup>
points*
<orbitz>
It's unclear to me how testing a functor is a pain. I use functors expliclty to make the code more testable
<Drup>
same here
<orbitz>
for example I factor out the communication transport with a functor so in my tests aI can implement a dummy transport that just runs inmemory for testing network realted things
<Drup>
and I don't clearly see how it's complicated to instantiate them either, it's basically a big function application
<Drup>
(not saying you're wrong whitequark, just trying to understand)
<Drup>
(and I definitely agree with the documentation issue)
Eyyub has joined #ocaml
<whitequark>
well, I think there are two general cases for using functors
<whitequark>
one is for polymorphic data structures, like Hashtbl.Make
<whitequark>
it's ok, but probably can/should be replaced with typeclases (?)
rand000 has quit [Ping timeout: 240 seconds]
<Drup>
yes it can
<Drup>
the two are mostly dual
<whitequark>
another is for parameterizing code with behavior
<Drup>
you trade spagetti at declaration site (functors) for spagetti at usage site (for typeclasses)
<orbitz>
i use the latter a lot
<whitequark>
and that is what I find contrived and terrible
<whitequark>
e.g. take a look at Cohttp source
<Drup>
why is that ?
<whitequark>
everything is functorized, and like half of those functors pass their arguments to other functors
<Drup>
because that's the part which is very painful to encode using typeclasses
<whitequark>
or rather, the inner ones infect the outer ones
<orbitz>
whitequark: as a user of Cohttp do you have to deal with that problem?
<whitequark>
it's something that has to be done to encode the feature Cohttp wants (duality for Lwt/Async), and there's no easier way
<whitequark>
but it doesn't change the fact that the functorized source is contrived and hard to understand
<Drup>
that's because in cohttp, they have to abstract over two different library
<whitequark>
orbitz: it depends. I have to deal with it while reading the docs, I have to deal with it when reading the source because the docs aren't enough and/or there's a bug in Cohttp
eikke__ has joined #ocaml
<Drup>
it's very hard to abstract over lwt *and* async because they are too different
<Drup>
but imagine how you would do that with typeclasses
<Drup>
(hint : you wouldn't)
<whitequark>
I wouldn
<whitequark>
t
<orbitz>
I've only got one level of indirection so far in my functors
<orbitz>
maybe someday i'll be a two, or three, functor programming
<whitequark>
in fact I don't know a good solution for the latter, but that doesn't change the fact that functors aren't a good one
<orbitz>
Hrm
<orbitz>
I haven't used Cohttp, in the functor code I have used it seemd rather antural and I didn't feel it wa a problem
* orbitz
shrugs
<orbitz>
to each their own
<Drup>
whitequark: I think you are wrong :p
tane has joined #ocaml
<whitequark>
that may be possible
<orbitz>
what's definitly true is I shoudln't have eaten that ice cream
<whitequark>
but then I think that today's statically typed languages are needlessly painful and not advanced enough so...
<Drup>
(but I like functors a lot)
<Drup>
whitequark: oh, I agree about that :D
<whitequark>
well, functors are just a special case of that rule
* orbitz
writes very functorized code in Erlang actually :
<orbitz>
:)
alexst has joined #ocaml
philtor has joined #ocaml
Thooms has quit [Ping timeout: 252 seconds]
Thooms has joined #ocaml
philtor has quit [Ping timeout: 272 seconds]
ustunozgur has quit [Quit: Leaving...]
alexst has quit [Ping timeout: 272 seconds]
lordkryss has joined #ocaml
distantunclebob1 has quit [Quit: Leaving.]
ggole has quit []
lordkryss_ has quit [Quit: Connection closed for inactivity]
shinnya has joined #ocaml
pgomes has quit [Ping timeout: 260 seconds]
<whitequark>
wtf
<whitequark>
I was going to publish my LZ4 bindings, and here you are, JaneStreet already made them
<whitequark>
except they're ungoogleable and undocumented :(
<Drup>
typical jst x)
<whitequark>
"Note that none of the sizes supplied by the caller are verified and arguments are handed off to the C api as is. These bindings can serve as the basis for a more highlevel API for LZ4 -OR- when the caller does not want to pay the cost of additional checks.
<whitequark>
?!
hausdorff has quit [Remote host closed the connection]
<Drup>
whitequark: yours are not dependent on core, which make them probably easier to use for a significant part of the ocaml ecosystem
<whitequark>
Drup: do you think I should write to jst, or just release them under some different name?
<Drup>
well, you can always ask
Kakadu has quit [Quit: Konversation terminated!]
<Drup>
why the fuck do lz4 depends directly on pa_ounit ? x_x
<whitequark>
ugh
<whitequark>
I'll just name it "ocaml-lz4"
vfoley has quit [Remote host closed the connection]