<Drup>
dmbaturin: how is that different with or without lwt ?
<palomer>
hey guys
<dmbaturin>
Maelan: I wish I could get a typed lambda calculus course myself rather than trying to build a coherent picture piece by piece. :)
<palomer>
I’ve been reading through some ocaml code and I keep seeing the @@ operator
<Drup>
palomer: "f @@ x" ≡ "f x"
<palomer>
what’s the point?!?!?!!
<dmbaturin>
palomer: val (@@) : ('a -> 'b) -> 'a -> 'b
<dmbaturin>
palomer: To avoid parentheses.
<Drup>
palomer: f @@ g @@ x ≡ f (g x)
<palomer>
ahhhh
<palomer>
looks like haskell :)
<Drup>
It's $ in haskell
<palomer>
so we don’t like parentheses anymore?
<dmbaturin>
palomer: There's also |> : 'a -> ('a -> 'b) -> 'b
<dmbaturin>
x |> f |> g
<palomer>
x |> f |> g = g(f(x)) ?
<dmbaturin>
Yep.
<dmbaturin>
Drup: Well, I'm not sure if I can always make something use Lwt_io functions instead of uncooperative versions.
<dmbaturin>
palomer: Sometimes @@ and |> can save you from excessive parentheses proliferation. :)
<Drup>
by throwing you into excessive operator proliferation :D
AltGr has joined #ocaml
<dmbaturin>
Parens or operators? Choose sides carefully!
empyrean has joined #ocaml
<dmbaturin>
Drup: What I mean is that I don't want to invent a wire protocol, but I do need to pass JSON-encoded messages of arbitrary length. What's the best practice for this?
jwatzman|work has quit [Quit: jwatzman|work]
browncodes has quit [Ping timeout: 268 seconds]
<Drup>
I don't really have an answer for you
<Drup>
(mostly because I don't really understand the issue ...)
<Drup>
(but, again, I'm mostly clueless about IO)
jeffmo has quit [Quit: jeffmo]
<palomer>
anyone here tried the websocket module from OPAM?
<dmbaturin>
The issue is that I need to know when to stop reading. :)
<dmbaturin>
Or know how many bytes to read in advance.
igoroliveira has quit [Quit: Connection closed for inactivity]
nopf has quit [Ping timeout: 246 seconds]
luigy has quit [Ping timeout: 250 seconds]
nopf has joined #ocaml
luigy has joined #ocaml
gustav___ has quit [Ping timeout: 260 seconds]
gustav___ has joined #ocaml
swgillespie has joined #ocaml
rgrinberg1 has quit [Ping timeout: 255 seconds]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
tmtwd has quit [Ping timeout: 240 seconds]
tmtwd has joined #ocaml
ousado_ has joined #ocaml
ousado has quit [Ping timeout: 240 seconds]
<palomer>
I found this code in the websocket module source tree: (ignore @@ server uri; fst @@ Lwt.wait ());
<palomer>
I don’t see the point of having the fst there
<palomer>
it’s the same as ignore (server uri; fst (Lwt.wait ()), which is the same as ignore (server uri; Lwt.wait())
<palomer>
unless I’m missing something
<Drup>
palomer: pretty sure you got the parens wrong
<Drup>
it's (ignore ...) ; (fst ...)
<palomer>
ahhhh
<palomer>
so @@ binds tighter than ;
echo-area has quit [Remote host closed the connection]
<bernardofpc>
re containersLabels (even if I'm not a big user of CC*), I feel it makes more sense with ipython-notebook-type completion; for example, will merlin show the ~f:(a->b->a) in TypeEnclosingExpression ?
jimt has quit [Ping timeout: 240 seconds]
echo-area has joined #ocaml
ygrek has quit [Ping timeout: 244 seconds]
gabemc has joined #ocaml
higgs has joined #ocaml
rgrinberg1 has joined #ocaml
<palomer>
uhhh, what?
higgs has quit [Ping timeout: 240 seconds]
higgs has joined #ocaml
huza has joined #ocaml
higgs has quit [Ping timeout: 240 seconds]
darkf has joined #ocaml
higgs has joined #ocaml
higgs has quit [Client Quit]
Algebr has quit [Remote host closed the connection]
steshaw has quit [Quit: Connection closed for inactivity]
Algebr has joined #ocaml
empyrean has quit [Remote host closed the connection]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
tmtwd has quit [Ping timeout: 260 seconds]
Algebr has quit [Remote host closed the connection]
mac10688 has quit [Ping timeout: 268 seconds]
gabemc has quit [Ping timeout: 272 seconds]
sh0t has joined #ocaml
huza has quit [Quit: WeeChat 0.3.8]
sh0t has quit [Ping timeout: 246 seconds]
gabemc has joined #ocaml
swgillespie has joined #ocaml
swgillespie has quit [Max SendQ exceeded]
swgillespie has joined #ocaml
tmtwd has joined #ocaml
contempt has quit [Remote host closed the connection]
rgrinberg1 has quit [Ping timeout: 240 seconds]
rgrinberg1 has joined #ocaml
contempt has joined #ocaml
psy_ has quit [Ping timeout: 240 seconds]
nullcatxxx_ has joined #ocaml
psy_ has joined #ocaml
MercurialAlchemi has joined #ocaml
yurug has joined #ocaml
yurug1 has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 264 seconds]
yurug has quit [Ping timeout: 240 seconds]
yurug has joined #ocaml
yurug1 has quit [Read error: Connection reset by peer]
tmtwd has quit [Ping timeout: 240 seconds]
lagrangi-wan has quit [Quit: F...ix you, Emacs.]
rgrinberg1 has quit [Ping timeout: 264 seconds]
sivoais has quit [Ping timeout: 256 seconds]
sivoais has joined #ocaml
Denommus` has joined #ocaml
blik71 has joined #ocaml
Denommus has quit [Ping timeout: 255 seconds]
<blik71>
hey can someone take a look at my code really quick, I'm new to Ocaml and wanted to know why I am getting an unbound value exception during a particular function call
yurug has quit [Read error: Connection reset by peer]
yurug has joined #ocaml
sivoais has quit [Ping timeout: 264 seconds]
obadz has quit [Ping timeout: 256 seconds]
obadz has joined #ocaml
sivoais has joined #ocaml
<dmbaturin>
blik71: Sure.
sivoais has quit [Ping timeout: 246 seconds]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
sivoais has joined #ocaml
<blik71>
thanks but i figured it out i was returning a list instead of an int lol
tennix has quit [Quit: WeeChat 1.3]
jimt has joined #ocaml
yurug has quit [Ping timeout: 240 seconds]
blik71 has quit [Ping timeout: 240 seconds]
rgrinberg1 has joined #ocaml
yurug has joined #ocaml
rgrinberg1 has quit [Ping timeout: 240 seconds]
yurug has quit [Read error: Connection reset by peer]
yurug has joined #ocaml
nullcatxxx_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Denommus` has quit [Read error: Connection reset by peer]
Denommus` has joined #ocaml
yurug has quit [Read error: Connection reset by peer]
ygrek has joined #ocaml
yurug has joined #ocaml
palomer has quit [Quit: palomer]
<companion_cube>
bernardofpc: labels belong in types, so merlin should show them
yurug has quit [Ping timeout: 250 seconds]
nullcatxxx_ has joined #ocaml
yurug has joined #ocaml
Haudegen has quit [Ping timeout: 255 seconds]
yurug has quit [Read error: Connection reset by peer]
yurug has joined #ocaml
nullcatxxx_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ygrek has quit [Ping timeout: 240 seconds]
yurug has quit [Ping timeout: 250 seconds]
yurug has joined #ocaml
obadz has quit [Ping timeout: 268 seconds]
tane has joined #ocaml
obadz has joined #ocaml
Haudegen has joined #ocaml
damason has quit [Ping timeout: 255 seconds]
jeffmo has joined #ocaml
yurug has quit [Read error: Connection reset by peer]
yurug has joined #ocaml
rgrinberg1 has joined #ocaml
yurug has quit [Ping timeout: 272 seconds]
rgrinberg1 has quit [Ping timeout: 268 seconds]
ely-se has joined #ocaml
obadz has quit [Ping timeout: 250 seconds]
obadz has joined #ocaml
tennix has joined #ocaml
willy__ has joined #ocaml
willy_ has quit [Ping timeout: 240 seconds]
keen______ has joined #ocaml
yurug has joined #ocaml
keen_____ has quit [Ping timeout: 264 seconds]
Krikey_Sanchez has joined #ocaml
<Krikey_Sanchez>
I'm just learning ocaml coming from a haskell background
<Krikey_Sanchez>
how do I define a type that has a variant that is a list of a type variable?
<def`>
Not sure what you mean
<dmbaturin>
Krikey_Sanchez: type 'a foo = Foo of 'a | Bar of 'a list
<def`>
but 'type 'a t = Variant of 'a list'
<Krikey_Sanchez>
does ocaml use capitalization syntactically?
<Krikey_Sanchez>
like, do type names have to be lowercase?
<dmbaturin>
Yes, it does.
<def`>
yes
<def`>
only value constructors and modules names are capitalized
<dmbaturin>
Type constructors have to be lowercase, and data constructors have to be capitalized.
<flux>
it is the very smallest consistent style guide for the whole of ocaml.. :)
antkong has quit [Quit: antkong]
<flux>
krikey_sanchez, module names (and module type names, even as module arguments) and constructors begin with an uppercase letter, all others start with a lowercase or an underscore
<flux>
re significant whitespace: f# seems to have gotten rid of some of the crud in ocaml by opting to use it..
<dmbaturin>
Type variables start with apostrophe.
<flux>
case in point: match inside a match
<flux>
but I don't know, maybe the f# syntax has its downsides, I haven't actually tried writing it
<Krikey_Sanchez>
man, mandatory-lowercase type names
<Krikey_Sanchez>
that is weird to me
<def`>
flux: not module types (language corner cases) >/dev/null
<dmbaturin>
Krikey_Sanchez: More weird than mandatory capitalized type names? :)
<flux>
def`, well that was hardly because of the whitespace syntax :)
<Krikey_Sanchez>
it's just that I'm used to the haskell way of doing things :)
<def`>
flux: what?
<flux>
def`, I doubt F# dropped the module system because they opted to use significant whitespace
<def`>
flux: I mean module types names in OCaml have no lexical restrictions
<dmbaturin>
flux: The biggest problem is that neither syntax allows to recover the intended meaning in nested matches and the like.
<flux>
def`, oh
<flux>
def`, I hadn't noticed :-)
<Krikey_Sanchez>
also, it seems like ocaml will let me write either pure functional code, or object-mutating code
<Krikey_Sanchez>
and I'm not sure which I should pick
<def`>
they might be the only kind of unrestricted identifier :D (polymorphic variants too)
<flux>
I guess the same kind of 'oh' that polymorphic variants can start with lowercase
<def`>
yes
<Krikey_Sanchez>
I'm trying to write a bloom filter
<flux>
I understand that's mostly an oversgiht that cannot be fixed
<def`>
no better explanation than 'it was possible' (or LR was ok)
<Krikey_Sanchez>
and I don't know if it's better to use the object syntax and have methods that update an internal data structure
<Krikey_Sanchez>
or write haskell style functions that take a filter value and return a new filter value
<dmbaturin>
Krikey_Sanchez: You can even write reference mutating code without any objects if you feel like it. Or record field mutating (foo.myfield <- value).
<flux>
krikey_sanchez, I wouldn't probably use object style for algorithmic code
<def`>
Krikey_Sanchez: for a bloom filter, pure data structure seems inappropriate
<def`>
Just use module abstractions
<Krikey_Sanchez>
so yeah I don't entirely undrestand modules yet
<Krikey_Sanchez>
I have the tutorial page on them open now
<Krikey_Sanchez>
it seems like it's intended as a namespacing scheme
<flux>
I think you don't really need to understand much about them for writing a bloom filter
<def`>
opaque type and a bunch of functions in the signature, you can use mutation and no objects in the implementation
<def`>
yep
<Krikey_Sanchez>
by signature you mean the stuff between struct and end in the module def?
<def`>
yes, the interface if you prefer
<dmbaturin>
I think F# dropped both modules and ocaml-style objects to simplify full interoperability with other .Net languages that all use object system imposed by .Net
<Krikey_Sanchez>
so, I can define some function: let insert filter value = ...
<Krikey_Sanchez>
and write it in such a way that I mutate the value passed to filter
<Krikey_Sanchez>
and not just return a new filter?
<ely-se>
you can efficiently represent an immutable bloom filters
<ely-se>
yes Krikey_Sanchez you can do that, and return unit
<Krikey_Sanchez>
so syntactically, I can either mutate the value, or return a new value, just like in an ordinary imperative language
<Krikey_Sanchez>
is there a preferred style?
<Krikey_Sanchez>
are there performance impacts for writing mutable vs immutable code?
<def`>
preferred style is to isolate mutations
<def`>
you can use them if they have clear
<def`>
boundaries
<ely-se>
because OCaml does not limit the number of references to mutable data (unlike e.g. Rust), it can easily become difficult to keep track of who sees your mutations. hence immutability is generally preferred
<Krikey_Sanchez>
ok
<dmbaturin>
Krikey_Sanchez: There are three ways to write a signature. It can be in an .mli file, it can be defined as "module type Foo = sig ... end", or it can be embedded ("module Foo : sig ... end = struct ... end").
<def`>
(think ST monad in haskell, but not appearing in the signature)
<def`>
(although OCaml style is more liberal about side effects :))
<Krikey_Sanchez>
so the signature is basically a large type definition?
<Krikey_Sanchez>
like, a module has a type that is the type of every value and function in it?
Kakadu has joined #ocaml
<def`>
yes, thats the point of module system: a second type system to talk about type and terms from the expression language
<dmbaturin>
Krikey_Sanchez: The module language is kinda separate from the core languages. Modules are its "values" and signatures are their types, kind of.
<ely-se>
the signature of the module is not the type of the values in the module
<ely-se>
but it does specify what the types of each of those values are
<dmbaturin>
Krikey_Sanchez: Also, "functor" in ocaml refers to a module parameterized by a signature that can be instantiated with different modules that match that signature.
<def`>
it is highly expressive but comes without inference, is more verbose, etc...
<ely-se>
can you encode linked lists with modules and functors? :p
<Krikey_Sanchez>
as an aside, how do I insert a value into a list?
<ely-se>
1 :: [2, 3, 4]
<Krikey_Sanchez>
mutably, I mean
<Krikey_Sanchez>
or is there no way to do that?
<ely-se>
can't, lists are immutable
<dmbaturin>
Lists are immutable.
<flux>
you can of course wrap a list inside a reference and mutate that reference
<dmbaturin>
Lists are just "type 'a list = [] | (::) of 'a * 'a list", in imaginary syntax.
<ely-se>
I wish "ref 1 = ref 1" were false :[
<Krikey_Sanchez>
what's the equivalent of ":l <filename>" in the repl?
obadz has quit [Ping timeout: 240 seconds]
<MasseR>
Krikey_Sanchez: #use "filename"
<dmbaturin>
;;
<MasseR>
But it reads the file as is, so the outer module is not recognized
<MasseR>
As in, if you have foo.ml with a function foo, you won't invoke it with Foo.foo, but foo
<def`>
#mod_use to preserve module
obadz has joined #ocaml
<dmbaturin>
#use is equivalent to pasting the contents of the file into the REPL.
<ely-se>
watched a video of a guy using a typewriter connected to a computer as a REPL yesterday
echo-area has quit [Read error: Connection reset by peer]
rgrinberg1 has joined #ocaml
rgrinberg1 has quit [Ping timeout: 240 seconds]
Simn has joined #ocaml
zpe has quit [Ping timeout: 246 seconds]
zpe has joined #ocaml
zpe has quit [Read error: Connection reset by peer]
xet7_ has quit [Ping timeout: 240 seconds]
xet7_ has joined #ocaml
yurug has joined #ocaml
ggole has joined #ocaml
xet7_ has quit [Ping timeout: 268 seconds]
xet7_ has joined #ocaml
tennix has quit [Ping timeout: 264 seconds]
zpe has joined #ocaml
xet7_ has quit [Read error: Connection reset by peer]
xet7_ has joined #ocaml
lmaocaml has joined #ocaml
<lmaocaml>
Why is there not integer types of various sizes and singnedness not there in stdlib?
<lmaocaml>
writing numerical code ocaml = SUPER painful.
<lmaocaml>
And the int type is machine dependent ...
<lmaocaml>
How do people deal with these issues?
rgrinberg1 has joined #ocaml
<Drup>
lmaocaml: you have better control over your integers when you store them inside bigarrays, so the storage part is not an issue. integer types are mostly used for storage issues
<lmaocaml>
all integer arithmetics depend on the size of integers...
<lmaocaml>
how is not that an issue?
<Drup>
Do you have a concrete issue where you would want smaller/unsigned integers for arithmetic purposes ?
<lmaocaml>
yes, marshalling data for e.g.
<Drup>
so storage.
<lmaocaml>
also compression algos
<Drup>
It's not for computing
<lmaocaml>
It = ocaml?
<Drup>
the small integers
<lmaocaml>
where are small integers?
rgrinberg1 has quit [Ping timeout: 240 seconds]
xet7_ has quit [Ping timeout: 240 seconds]
xet7_ has joined #ocaml
<enjolras_>
you cn use a lib for mashalling. Or write your own. Integer szefor mashalling are part of the serialize/unserialize function
<Drup>
Ok, let me rephrase that into a more coherent sentence: Most usages of small integers are not computing, they are storage optimization (including the example you gave). If you want this storage optimization, you can use the Bigarray module and have precise control over the array layout. If it's really for computing, then there are external libraries.
<mrvn>
lmaocaml: integers in ocaml are 31/63 bit. In algorithms you usualy need 32/64 bit and then you have the Int32/Int64 modules in stdlib and UInt32/UInt64 outside.
<lmaocaml>
those are boxed..
<Drup>
lmaocaml: locally unboxed inside function body when you do computation
<Drup>
(there is uint package in opam, for example)
<mrvn>
Are int64 boxed inside an array or are they stored liek float array?
<lmaocaml>
is this some optimization?
<lmaocaml>
i thought they were boxed everywhere.
<Drup>
lmaocaml: yes, it's an optim
<mrvn>
lmaocaml: yes, float arrays don't have boxed floats
<lmaocaml>
Drup: that library is hard to use.
<ggole>
int64 arrays are boxed
<lmaocaml>
i wish we had operator overloading
<ggole>
(Elements of them are, I mean.)
<mrvn>
lmaocaml: we do.
<lmaocaml>
only for floats..?
<mrvn>
lmaocaml: just only one overload at a time. Not in parallel.
<ggole>
That could probably be changed if it were important.
<mrvn>
let ( + ) = ( * ) (* overload *)
ollehar1 has joined #ocaml
<lmaocaml>
yeah not really useful.
<lmaocaml>
when you are using all sizes of ints.
<ggole>
int64 and double have the same representation and GC treatment but need different interpretations for polymorphic equal, comparison, etc
<Drup>
lmaocaml: this library is not very well defined :/
<lmaocaml>
and i have to call functions with qualifiers for some basic arithmetic.
<lmaocaml>
the code is fucking ugly :(
<Drup>
lmaocaml: you can use local open, it makes thing easier
<Drup>
let me show you
<lmaocaml>
not really
<mrvn>
lmaocaml: you usualy use ints of a specific size and then you can do let ( + ) = IntXY.( + )
<Drup>
mrvn: No
<mrvn>
lmaocaml: or define +..
ollehar has quit [Ping timeout: 252 seconds]
ollehar1 is now known as ollehar
<lmaocaml>
mrvn: that is what the problem is..
<mrvn>
Drup: no what? YOu don't usualy use ints of a specific size?
<lmaocaml>
no overloading = crazy infix functions
<Drup>
mrvn: no, what you are saying is a bad method
<mrvn>
lmaocaml: You could go real crazy and make objects
<lmaocaml>
also what's the cost of calling ffi?
<lmaocaml>
those are all ffi..
<mrvn>
lmaocaml: for u8 it's high. for 1024bit integers its negible.
<lmaocaml>
LOL
<Drup>
(comparatively to the computation)
<mrvn>
(naturally)
<mrvn>
What FI do you use for u8?
<lmaocaml>
Hence my original question of why these are not primitve types.
<lmaocaml>
mrvn: some compression schemes and dsp algos.
<mrvn>
lmaocaml: simple answere: The compiler didn't need them.
<mrvn>
lmaocaml: I would think they would act on a block of data. Not single ints.
<mrvn>
val compress : option list -> string -> string
<ggole>
OCaml isn't really designed for numeric computation
ollehar has quit [Ping timeout: 246 seconds]
<lmaocaml>
would any work on fixing the runtime would be considered upstream?
rand__ has quit [Quit: leaving]
<mrvn>
but it's great when you can offload the computation to C in chunks. Then you can even release the runtime lock and make use of multiple cores.
sepp2k has joined #ocaml
<lmaocaml>
mrvn: that's like saying write all critical parts in C..
<mrvn>
lmaocaml: there is a uint library already. What's there to fix?
<lmaocaml>
mrvn: the overhead...
ely-se has quit [Quit: leaving]
<Drup>
lmaocaml: There is something I don't understand. Why do you want to compute on small ints ?
<Drup>
just compute on "normal" integers and store them small in a bigarray
<mrvn>
lmaocaml: is there any? Have you checked the generated code?
<mrvn>
Drup: you might have to add extra "mod 256" in the code.
<lmaocaml>
Drup: some of operations like 2s complement needs to be implemented by hand.
<mrvn>
lmaocaml: there is -a and not a.
<lmaocaml>
for small ints.
<mrvn>
xor 0xff
<lmaocaml>
yeah exactly
<mrvn>
no C call involved
<lmaocaml>
so you would have to do these things which the arch does already?
<mrvn>
lmaocaml: that belongs in the UInt module
<lmaocaml>
so if you add 2 instructions per simple int arith, iot amounts a lot for computations.
dhil has joined #ocaml
<mrvn>
lmaocaml: what 2 instructions? So far we've added 0
<lmaocaml>
you are doing xor.
<mrvn>
no, I'm doing not on the large int.
<lmaocaml>
yes and then the xor.
<mrvn>
no.
<mrvn>
For Int8 I do not, for UInt8 I do xor.
<ggole>
Hmm, is writing to a Bigarray defined to truncate? It seems to in practice.
<lmaocaml>
I am writing an emulator, where i have to do these things manually i find it painful.
<mrvn>
or maybe I always do not. Would have to check if that works out everywhere.
<mrvn>
ggole: it truncates to the storage size.
<mrvn>
ggole: I've written support for int31 for BigArray and that truncates to 32bit. Which means on 64bit archs you can store 32bit and get them back and on 32bit you only get 31bit back.
ollehar has joined #ocaml
<lmaocaml>
Ah, now i see my code, i am doing this 2s complement because i don't want to waste 4 bytes when all i need is a single byte.
<mrvn>
lmaocaml: for a single value or a large block of them?
<mrvn>
lmaocaml: Note: UInt8 is stored as 8 byte.
<lmaocaml>
for a range of memory.
<mrvn>
lmaocaml: then use BigArray and it will truncate u8 to bytes when storing.
<lmaocaml>
mrvn: yeah so when you add, subtract diff size of integers you ahve to do this funky business.
<mrvn>
lmaocaml: Nope. you just let it overflow and the lower 8 bit remain correct.
<mrvn>
At least for u8, for signed int the over/underflow is undefined behaviour.
ely-se has joined #ocaml
xet7_ has quit [Ping timeout: 255 seconds]
xet7_ has joined #ocaml
libertas has joined #ocaml
<lmaocaml>
Ah, it seems the problem is i need a sint library
<lmaocaml>
so things like u16 + s8 works properly.
BitPuffin has joined #ocaml
<mrvn>
if "type u16 = private int type s8 = private int" then "let sum = U16.of_int (u16 + s8)"
<mrvn>
or not?
<lmaocaml>
those are memory loc.
<lmaocaml>
so i want to avoid storing 4x size data.
<lmaocaml>
so the u16 is reg and and the s8 is memory
<mrvn>
you would store them compact in BigArray but large in values.
<ggole>
Unless you want structs rather than arrays
<dalastboss>
but it'd be nice if I could just do "type t = ... with hashable"
<dalastboss>
or something like that
<dalastboss>
i should clarify this is when working with core
jeffmo has quit [Quit: jeffmo]
ely-se has quit [Quit: Leaving]
jwatzman|work has joined #ocaml
<Drup>
dalastboss: that piece of code seems fine
mort___ has joined #ocaml
<Drup>
ah, it's going to complain about type with the same names
<dalastboss>
it compiles as is
<dalastboss>
i just feel its a little verbose
<Drup>
not much better to propose
nullcatxxx_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
yurug1 has joined #ocaml
yurug has quit [Read error: Connection reset by peer]
nullcatxxx_ has joined #ocaml
yurug has joined #ocaml
nicoo_ is now known as nicoo
yurug1 has quit [Ping timeout: 252 seconds]
dalastboss has quit [Ping timeout: 246 seconds]
oriba has joined #ocaml
jonludlam has quit [Ping timeout: 240 seconds]
yurug has quit [Ping timeout: 252 seconds]
ely-se has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
kushal has joined #ocaml
jeffmo has joined #ocaml
yurug has joined #ocaml
palomer has joined #ocaml
<oriba>
on Caml-list there was mentioned a OCaml-course, and even long-time OCamlers said, they may do it. I didn't found infos to that course in my mail-folders. What course were they talking about / where to find it?
yurug has quit [Read error: Connection reset by peer]
yurug has joined #ocaml
ollehar has quit [Quit: ollehar]
yurug1 has joined #ocaml
yurug has quit [Read error: Connection reset by peer]
nullcatx_ has joined #ocaml
<oriba>
companion_cube: aha, ok, thanks. Does cover basic things. I wonder why long-term OCamler's said, they want to paticipate. Hmhhh... maybe just for fun....
palomer has joined #ocaml
<sgeisenh>
oriba: there was some mention of opportunities to help others with the course
<oriba>
aha
nullcatxxx_ has quit [Ping timeout: 250 seconds]
yurug has joined #ocaml
yurug has quit [Read error: Connection reset by peer]
yurug1 has quit [Read error: Connection reset by peer]
yurug has joined #ocaml
palomer_ has joined #ocaml
Krikey_Sanchez has quit [Quit: Leaving]
palomer has quit [Ping timeout: 255 seconds]
palomer_ is now known as palomer
kushal has quit [Quit: Leaving]
yurug1 has joined #ocaml
yurug has quit [Ping timeout: 268 seconds]
palomer has quit [Quit: palomer]
marsam has quit [Remote host closed the connection]
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
nullcatx_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
marsam has joined #ocaml
<Drup>
there is a forum for the course which you can access if you are registered, and then you can answer questions
<Drup>
MercurialAlchemi: some of the references in accelerando/Stross' work are surprising sometime :p
mort___ has joined #ocaml
<Drup>
(like, suddenly, a rather not mainstream metal band)
yurug has joined #ocaml
yurug1 has quit [Read error: Connection reset by peer]
<MercurialAlchemi>
Drup: hm, I don't recall, but Accelerando packs 50 ideas per sentence :)
<MercurialAlchemi>
coincidentally, I'm reading the Annihilation Score right now
<Drup>
MercurialAlchemi: I find the start and middle part more interesting than the end
nullcatxxx_ has joined #ocaml
moei has quit [Quit: Leaving...]
moei has joined #ocaml
snyp has joined #ocaml
nullcatxxx_ has quit [Ping timeout: 244 seconds]
ely-se has quit [Quit: Leaving]
BitPuffin has quit [Ping timeout: 246 seconds]
<companion_cube>
yeah, it's tough to read
<MercurialAlchemi>
Drup: yeah
<MercurialAlchemi>
it's a bunch of short stories, that's why
<MercurialAlchemi>
today on HN "JavaScript as default language and software stack"
<MercurialAlchemi>
yeah, right, let's all shoot off our foot
<MercurialAlchemi>
when I hear of a nodejs codebase, my first thought is "fresh legacy code, coming up"
<Drup>
I didn't found it that hard to read
<Drup>
(especially compared to hyperion ...)
<companion_cube>
really? hyperion is less dense
<Drup>
It's not the density, just the confusionness
<orbifx>
I like the sound of mirage, checking ocapic too
<orbifx>
flux: does ocapic compromise performance just to get ocaml code running on PIC, or does it actually perform well?
<Drup>
it's running ocaml's bytecode, not native, so, you could say so
<orbifx>
does ocaml compile to native code at all or is it only bytecode?
wwilly has left #ocaml ["Leaving"]
<icicled>
orbifx, both
<Drup>
of course it compiles to native code too :D
<orbifx>
:D
<orbifx>
I'm starting to like the sound of that
<orbifx>
Pureness drove me to Haskell, but it seems to neglect system level programming necessities
<Drup>
if you are interested into system programming (not really embedded), you might be interested by this book: https://ocaml.github.io/ocamlunix/
<orbifx>
any functional language better than ocaml targetting system development?
<companion_cube>
not really functional, but rust?
<orbifx>
Nice one Drup, looking forward to reading this
<orbifx>
companion_cube: looked at rust I think... i'd prefer more functional
MercurialAlchemi has quit [Ping timeout: 255 seconds]
<companion_cube>
well if you want to get really low-level, memory allocation becomes more of a concern
<dmbaturin>
orbifx: The native compiler is available for x86(64), ARM, SPARC, and, if I remember correctly, PPC. Bytecode interpreter technically runs on anything.
<companion_cube>
there is ATS, too, but it's really tough
<dmbaturin>
Really tough, but also really tempting. :)
<orbifx>
companion_cube: how established is rust? say compared to Haskell or Ocaml
<orbifx>
Haskell isn't that good for system programming just now
jabesed has quit [Ping timeout: 246 seconds]
<dmbaturin>
orbifx: By system programming you mean interfacing with existing OS or writing a new one?
<orbifx>
dmbaturin: practically the first, posix in particular, but being able to write a new one would distinguish the language even more
tane has quit [Quit: Verlassend]
<companion_cube>
well rust is still young, but has a very nice and active community
<companion_cube>
but if you only wish to interface to the C api of your ARM system, OCaml (mirage) should be fine
palomer has quit [Ping timeout: 255 seconds]
<dmbaturin>
Writing a multitasking OS in a language that relies on garbage collection is going to be tough.
palomer has joined #ocaml
<orbifx>
dmbaturin: doesn't ocaml have any facilities to manually control memory (if necessary)?
<Drup>
Not really
<Drup>
the only thing you can do that is "manual" is allocate a big chunk of memory that the GC is not gonna move
higgs has joined #ocaml
<dmbaturin>
Lisp machines had an OS-wide garbage collector, so it's not entirely impossible though.
<orbifx>
Drup: reading the article you pasted. Is pervasives, the equivalent of prelude?
<Drup>
yes
<orbifx>
dmbaturin: OS-wide?
rgrinberg1 has joined #ocaml
<dmbaturin>
orbifx: Yes, the OS did garbage collection for the processes AFAIR. But it was hardware-assisted, and it was a tagged architecture, so not sure if it's feasible to replicate on less specialized hardware.
<orbifx>
ok
<orbifx>
and now for something wilder.. does Ocaml target FPGAs at all?
<companion_cube>
I heard good things about openSTMPd, too
<orbifx>
and I may hardly need to do any changed.. Dovecot i'm dreading a lot more :P
<companion_cube>
but a pure OCaml mail server would be nice
<companion_cube>
if it had smtps, imaps, sieve
<orbifx>
s/changed/changes
<Drup>
( companion_cube : I would add to the required that it's miragified)
<orbifx>
companion_cube: a lot to implement :P
<Drup>
requirements*
<dmbaturin>
malc_: I wonder if implementing lambda term reduction in sendmail is feasible. Probably it is.
<companion_cube>
Drup: of course.
<malc_>
dmbaturin: given turing completeness the answer is resounding - yes
<orbifx>
dmbaturin: good article, thanks
<dmbaturin>
malc_: Yeah, hence "feasible" instead of "possible". What I'm wondering about is how much of a turing tarpit this task would be.
<orbifx>
dmbaturin: have you used some ocaml blog?
<orbifx>
ah.. tumblr powered..
<dmbaturin>
companion_cube: I'd rather keep SMTP and IMAP servers separate, or at least reasonably modular.
<malc_>
dmbaturin: missed "feasible", my bad
<companion_cube>
dmbaturin: using modules
<companion_cube>
please :p
<companion_cube>
but I'd be more confident in a mail toolchain if it was pure OCaml
<orbifx>
break the heck out of them, postfix has it right. Unix philosophy ftw.
<dmbaturin>
orbifx: No, sadly. Tumblr software is getting horrible though, so I'll have to migrate somewhere at some point. They can't handle either HTML or non-JPG images correctly anymore.
rgrinberg2 has joined #ocaml
<dmbaturin>
Probably because there's not much demand for it among 13 years old kids or something.
<orbifx>
dmbaturin: I've written a simple blog in bash
<companion_cube>
don't!
<orbifx>
companion_cube: ?
<companion_cube>
sorry. Writing software in bash is my nightmare
<orbifx>
companion_cube: it wasn't that bad, it's an interface really on other popular unix utilities
<dmbaturin>
Well, the alternative is to use generate static HTML of course. That's what I did to baturin.org (uses the same MPP template processor that runs ocaml.org).
<orbifx>
you can write your own back ends for anything you need it to do
IbnFirnas has quit [Ping timeout: 244 seconds]
rgrinberg1 has quit [Ping timeout: 244 seconds]
brendan has quit [Ping timeout: 244 seconds]
<orbifx>
currently uses markdown for conversion and manages it's own files
eikke has quit [Remote host closed the connection]
<dmbaturin>
orbifx: One company wanted to hire me to work on their photo hosting that was written in Korn shell and ran on Solaris 9 or something equally ancient.
<companion_cube>
I use pelican already :)
<companion_cube>
although I should move to something that supports asciidoc
eikke has joined #ocaml
<orbifx>
dmbaturin: lol, from my experience, bash and other shell scripting is ok as glue and that is it.
<orbifx>
You can do more, but you need a lot of determination :P
IbnFirnas has joined #ocaml
<orbifx>
I wanted to try it though, wanted to write something ultra portable
<orbifx>
even looked at markdown -> html with awk
brendan has joined #ocaml
<orbifx>
dmbaturin: is 'a a unit too?
<companion_cube>
:s
<dmbaturin>
orbifx: 'a is a type variable. It can be substituted for unit of course, same as in haskell.
<dmbaturin>
val foo : 'a -> b ==> foo :: a -> b
<Drup>
actually
<orbifx>
ok
<Drup>
val foo : 'a -> b ==> foo :: a -> B
<dmbaturin>
* let foo : 'a -> 'b = fun x -> ... No handy embedded type annotation syntax in ocaml.
<Drup>
(type name are capitalized in Haskell)
<orbifx>
exception Unix_error of error * string * string --- is * some kind of composition?
<malc_>
# Obj.magic;;
<malc_>
- : 'a -> 'b = <fun>
<Drup>
orbifx: foo * bar is (foo, bar)
<Drup>
it's a tuple
<dmbaturin>
Drup: Good point. Lack of apostrophe before b was a typo though, I didn't mean it. :)
<orbifx>
ok
<malc_>
Drup: it is not a tuple, but that's historic wart
<orbifx>
also is it acceptible to write tuples without brackets in ocaml? saw something like `let x, y = ...`
<orbifx>
malc_: what is it?
<orbifx>
and you suggest it should be a tuple?
<Drup>
malc_: let's happily slip that point under the carpet, shall we ? :D
<malc_>
orbifx: type constructor with three arguments
<malc_>
Drup: sure ;)
<Drup>
For most purposes, it's a tuple
<dmbaturin>
orbifx: * is often rendered as the cross product symbol in non-pasteable media. :)
<malc_>
orbifx: A of (a * b * c) is distinct from A a * b * c is what i'm implying
<malc_>
+of
<dmbaturin>
orbifx: You can also write a list of tuples as [1,2; 3,4]
<companion_cube>
this is going to confuse orbifx
<orbifx>
dmbaturin: that is what i pressume.. something like `.` in Haskell
<orbifx>
companion_cube: I think i got it
<dmbaturin>
The list of tuples? No, that's just syntax. List sugar uses ; as element separator.
<dmbaturin>
And because it's distinct from the item separator fro tuples, no parens are needed there.
<orbifx>
and basically tuples are ok without brackets (in certain places?)
<dmbaturin>
There is no direct equivalent of haskell . :: (b -> c) -> (a -> b) -> a -> c in pervasives, even though it's trivial to implement. @@ is the equivalent of $, and there's also |> { x |> f |> g ==> g(f(x)) }
<dmbaturin>
Yeah, if there's nothing to confuse the parser, naked tuples are ok.
<orbifx>
ah the lingo, what would languages be without it :P
<orbifx>
any ArchLinux users here?
<companion_cube>
yep
ely-se has quit [Quit: sleep]
<orbifx>
companion_cube: you?
<orbifx>
or yep in general ?! :P
<companion_cube>
me
<companion_cube>
what's your question?
<orbifx>
kewl, nothing, just demographing the channel :P
<orbifx>
good to know there is another one here, in case i have any distro specifics, and that is is popular.
<dmbaturin>
orbifx: opam is mostly OS-agnostic.
<dmbaturin>
Well, as long as the OS is not windows. :)
<orbifx>
screw winblows
<orbifx>
who is using that anyway?
* orbifx
winks
<orbifx>
companion_cube: I noticed in archlinux-arm they don't have opam, but a package called ocaml-findlib
<orbifx>
heard of that ?
<companion_cube>
yep, opam relies upon findlib
<Drup>
very crudely, findlib is ocaml's pkg-config
<Drup>
opam is ... an actual package manager
<adrien>
ocamlfind/findlib's semantics are different from pkg-config but they fill the same feature gap: how to properly compile and links files when libraries are involved
<dmbaturin>
orbifx: adrien uses ocaml on windows. If I do need it, that's whom I annoy. :)
shinnya has joined #ocaml
<orbifx>
nice, good desing idea pkg-config, I appreciate it.
<orbifx>
adrien: I'm sorry to hear that
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
malc_ has quit [Quit: leaving]
<orbifx>
dmbaturin: I don't really own any winblows machines. I have a a work laptop I poke with the stick (cygwin) when I need to vpn.
<orbifx>
companion_cube: but no opam in armv7 of archlinux-arm
<dmbaturin>
Well, I still think ocaml can work very well for cross-platform GUI apps.
<companion_cube>
I don't know, I don't use arch-arm, sorry
<orbifx>
unless i can get it from AUR since I pressume it's written in ocaml?
<companion_cube>
it is on AUR yes
<orbifx>
companion_cube: yeah and PKGBUILD confirms armv7h.. that's were I will get it
<Drup>
(the other way is to use mirage to target ARM)
<orbifx>
So glad it's all so painless. Getting ghc alone is >700MiB. Trying to crosscompile....
<orbifx>
mirage pressumes a virt-visor underneath right?
<Drup>
orbifx: yes and no, usually it assumes Xen, but a bare metal version is almost working, using rumprun
<orbifx>
Drup: ok, on some other ideas I have that would be nice, but for this case I'm targetting Arch
<orbifx>
any articles on the flow of making a ocaml project/module/package?
<orbifx>
ala `cabal init`
shinnya has quit [Ping timeout: 240 seconds]
mac10688 has joined #ocaml
nullcatxxx_ has joined #ocaml
<smondet>
dmbaturin: nice to discover your blog, you could add yourself to http://planet.ocaml.org/ (?)
Kakadu has quit [Remote host closed the connection]
nullcatxxx_ has quit [Client Quit]
<orbifx>
Drup: thanks
<orbifx>
on my to-read list for tomorrow
<orbifx>
Drup, dmbaturin, companion_cube, malc_, icicled, vbmithr, flux: thanks all for answering my questions and generally helping.
<orbifx>
Nice channel
<orbifx>
later
orbifx has quit [Quit: "laterz"]
nullcatxxx_ has joined #ocaml
jwatzman|work has joined #ocaml
<dmbaturin>
smondet: I never perceived it as important or topical enough for aggregators. In any case I need to decide something about its new software. Do you happen to know what people use for statically generated blogs these days?
marsam has quit [Remote host closed the connection]
jonludlam has joined #ocaml
yurug has quit [Ping timeout: 246 seconds]
<smondet>
dmbaturin: we use the thing integrated with github
<smondet>
jeckyll
damason has joined #ocaml
<oriba>
companion_cube: imap client libs for ocaml? do you have a link?
obadz- has quit [Ping timeout: 240 seconds]
obadz has joined #ocaml
madroach has quit [Ping timeout: 264 seconds]
madroach has joined #ocaml
<oriba>
companion_cube: ah, there is one in omap...
lagrangi-wan has joined #ocaml
<oriba>
s/omap/opam/ :)
Tekilla has quit [Quit: Quitte]
jonludlam has quit [Ping timeout: 272 seconds]
oriba has quit [Quit: WeeChat 1.3]
bitbckt has quit [Ping timeout: 240 seconds]
S11001001 has quit [Ping timeout: 240 seconds]
Sorella has quit [Ping timeout: 240 seconds]
lwlvlpl has quit [Ping timeout: 240 seconds]
jwatzman|work has quit [Ping timeout: 240 seconds]