<Algebr>
no guarantee that Unix.sleep will be evaluated after f and before g?
<Algebr>
tuples aren't sets, so order does matter
<Drup>
order of the values matter, but the order of evaluation doesn't, and it's not specified
<Algebr>
darn
<Drup>
same for order of evaluation of arguments
<Drup>
foo (f x) (g y)
<Algebr>
Oh I thought OCaml did specifiy left to right for evaling of args.
<Drup>
It doesn't, but it's like that in practice, and nobody reads the documentation, so people use it :D
<Drup>
(in practice, they could specify it, though. Changing it would break so many programs ...)
snhmib has quit [Ping timeout: 250 seconds]
<Algebr>
well add +1 to the people_relying_on_it_counter
AltGr has joined #ocaml
<flux>
in practice, I doubt it would break many programs, though
<flux>
well, hope at least
yunxing has joined #ocaml
<Drup>
It would
<flux>
who relies on side effect order within non-sequencing expressions, that is, without ;
<Algebr>
I assume the same is true for Lists then?
<Algebr>
match [f "hello"; g "bar"]
<Algebr>
[f "hello"; g "bar"]
<Drup>
Algebr: "[f "hello"; g "bar"]" is sugar for f "hello" :: g "bar" :: [] which is just constructor call, which is probably like functions wrt this
<Drup>
flux: everyone, without realizing it.
<flux>
drup, I demand proof ;)
<Drup>
I would be happy to take your code and point it out, but that would take time that I'm not willing to spend
<Drup>
:)
<flux>
simply patch the compiler to reverse the order ;)
yunxing has quit [Remote host closed the connection]
<flux>
and actually I think that case might be something a developer might rely on: all expressions required to evaluate before calling a function should be evaluated before calling it
<flux>
s/might/would/
bernardofpc has quit [Ping timeout: 268 seconds]
Emmanuel` has quit [Quit: Konversation terminated!]
Emmanuel` has joined #ocaml
kamog` has joined #ocaml
Reshi has joined #ocaml
nicholasf has quit [Ping timeout: 252 seconds]
MercurialAlchemi has joined #ocaml
Reshi has quit [Client Quit]
kamog has quit [Ping timeout: 252 seconds]
Reshi has joined #ocaml
Emmanuel` has quit [Quit: Konversation terminated!]
Emmanuel` has joined #ocaml
kamog` has quit [Read error: Connection reset by peer]
kolko has joined #ocaml
Emmanuel` has quit [Quit: Konversation terminated!]
kushal has joined #ocaml
Emmanuel` has joined #ocaml
Reshi has quit [Quit: WeeChat 1.4]
jgjl has joined #ocaml
quater-nyan has quit [Quit: fix config]
nicholasf has joined #ocaml
d0nn1e has quit [Ping timeout: 240 seconds]
d0nn1e has joined #ocaml
zRecursive has left #ocaml ["ERC (IRC client for Emacs 24.5.1)"]
nicholasf has quit []
pyon has joined #ocaml
kushal has quit [Ping timeout: 268 seconds]
Emmanuel` has quit [Ping timeout: 268 seconds]
ygrek has quit [Ping timeout: 240 seconds]
Haudegen has quit [Ping timeout: 276 seconds]
Emmanuel` has joined #ocaml
ygrek has joined #ocaml
BitPuffin|osx has joined #ocaml
Emmanuel` has quit [Quit: Konversation terminated!]
ygrek has quit [Ping timeout: 250 seconds]
Emmanuel` has joined #ocaml
Haudegen has joined #ocaml
pierpa has quit [Ping timeout: 244 seconds]
Simn has joined #ocaml
hunteriam has quit [Quit: Connection closed for inactivity]
Emmanuel` has quit [Quit: Konversation terminated!]
<sspi>
(let's do that again) I'm trying to do a nested functional update, but it's failing with this message: This expression has type Parsetree.structure_item_desc but an expression was expected of type Parsetree.module_binding
silver has joined #ocaml
octachron has joined #ocaml
Emmanuel` has quit [Quit: Konversation terminated!]
<sspi>
where structure_item_desc = | Pstr_module of module_binding (and more obviously)
Emmanuel` has joined #ocaml
yunxing has quit [Remote host closed the connection]
<octachron>
sspi, could you give more context?
Emmanuel` has quit [Quit: Konversation terminated!]
Emmanuel` has joined #ocaml
tane has joined #ocaml
<sspi>
octachron: sure, I'm trying to create a module with several new functions - so I'm trying to use a nested functional update to accomplish this
FreeBirdLjj has quit [Read error: Connection reset by peer]
FreeBirdLjj has joined #ocaml
jgjl has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jgjl has joined #ocaml
<sspi>
octachron: I believe this creates a new module right? in my case I only want to copy and modify an existing one
ARR has joined #ocaml
BitPuffin|osx has quit [Ping timeout: 244 seconds]
Reshi has quit [Ping timeout: 244 seconds]
thizanne has quit [Ping timeout: 276 seconds]
warp has joined #ocaml
ARR has quit [Quit: WeeChat 1.4]
manizzle has joined #ocaml
wolfcore has joined #ocaml
Emmanuel` has quit [Quit: Konversation terminated!]
Emmanuel` has joined #ocaml
Emmanuel` has quit [Quit: Konversation terminated!]
Emmanuel` has joined #ocaml
wolfcore has quit [Ping timeout: 260 seconds]
sepp2k has joined #ocaml
jwatzman|work has joined #ocaml
orbifx has joined #ocaml
<orbifx>
How should a cstruct be constructed?
<orbifx>
create_struct?
manizzle has quit [Ping timeout: 248 seconds]
M-Illandan has joined #ocaml
<hannes>
orbifx: Cstruct.create N (bytes)
<orbifx>
Ok, and how does it get typed? Im using ppx
silver has quit [Quit: rakede]
silver has joined #ocaml
<octachron>
sspi, yes this creates a new module, but copying/updating the module is the same thing as destructuring it, updating the right elemennts and recreating it
lobo has joined #ocaml
<sspi>
octachron: thanks, still I don't get why my nested functional update doesn't work...
<octachron>
nested functional update should work, it just become unwieldy when you have to go through 3 layers
M-Illandan has quit [Quit: node-irc says goodbye]
pierpa has joined #ocaml
dhil has joined #ocaml
BitPuffin has joined #ocaml
yunxing has joined #ocaml
darkf has quit [Quit: Leaving]
yunxing has quit [Ping timeout: 246 seconds]
jwatzman|work has quit [Quit: jwatzman|work]
Emmanuel` has quit [Quit: Konversation terminated!]
Emmanuel` has joined #ocaml
bernardofpc has joined #ocaml
wolfcore has joined #ocaml
<orbifx>
What's the string parameter needed by the cstruct setter?
_andre has joined #ocaml
average has joined #ocaml
average has left #ocaml [#ocaml]
Emmanuel` has quit [Quit: Konversation terminated!]
Emmanuel` has joined #ocaml
<orbifx>
Is it for passing the type?
tane has quit [Quit: Verlassend]
Sorella has joined #ocaml
FreeBirdLjj has quit [Read error: Connection reset by peer]
FreeBirdLjj has joined #ocaml
dhil has quit [Ping timeout: 244 seconds]
seangrove has quit [Ping timeout: 248 seconds]
Emmanuel` has quit [Quit: Konversation terminated!]
Emmanuel` has joined #ocaml
Slice^ has joined #ocaml
jwatzman|work has joined #ocaml
ggole has joined #ocaml
Emmanuel` has quit [Quit: Konversation terminated!]
Emmanuel` has joined #ocaml
AltGr has quit [Remote host closed the connection]
AltGr has joined #ocaml
<orbifx>
Anyone know how to put a cstruct on an output_channel? As binary data that is.
rcabaco has joined #ocaml
rcabaco has quit [Client Quit]
rcabaco has joined #ocaml
kushal has joined #ocaml
Emmanuel` has quit [Quit: Konversation terminated!]
Emmanuel` has joined #ocaml
hxegon has joined #ocaml
Emmanuel` has quit [Quit: Konversation terminated!]
Emmanuel` has joined #ocaml
hxegon has quit [Quit: BRB]
pyon has quit [Quit: Loops are hard, let's GOTO shopping!]
pyon has joined #ocaml
Slice^ has quit [Quit: This computer has gone to sleep]
tennix has quit [Ping timeout: 244 seconds]
sh0t has joined #ocaml
FreeBird_ has joined #ocaml
FreeBird_ has quit [Remote host closed the connection]
tane has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 248 seconds]
hxegon has joined #ocaml
dhil has joined #ocaml
<aantron>
can someone confirm that the OPAM archive is still lagging (so it's not just me)? for example, if you update, do you see package "sequence" version 0.7 available?
<companion_cube>
no, I don't, and it's a bit annoying
copy` has joined #ocaml
<aantron>
alright. what about bisect_ppx 1.0.1, for an older package?
<companion_cube>
nope
<companion_cube>
1.0.0
<aantron>
just want to be sure before i go around bugging people trying to find out where this cron job is..
<aantron>
ok thank you
Emmanuel` has quit [Quit: Konversation terminated!]
nopf has joined #ocaml
Emmanuel` has joined #ocaml
pabs3 has joined #ocaml
struk|desk|away is now known as struk|desk
manizzle has joined #ocaml
kushal has quit [Quit: Leaving]
AltGr has left #ocaml [#ocaml]
Emmanuel` has quit [Quit: Konversation terminated!]
Emmanuel` has joined #ocaml
Emmanuel` has quit [Client Quit]
Emmanuel` has joined #ocaml
tennix has joined #ocaml
Slice^ has joined #ocaml
malc_ has joined #ocaml
Slice^ has quit [Quit: This computer has gone to sleep]
Slice^ has joined #ocaml
struk|desk is now known as struk|desk|away
MercurialAlchemi has quit [Ping timeout: 244 seconds]
Slice^ has quit [Quit: This computer has gone to sleep]
Emmanuel` has quit [Quit: Konversation terminated!]
Emmanuel` has joined #ocaml
jeffmo has joined #ocaml
seangrove has joined #ocaml
Emmanuel` has quit [Quit: Konversation terminated!]
<seangrove>
Heh, that PR is what made me think about investing a bit of time in tyxml finally
<seangrove>
I didn't realize there was anything about conversion
<seangrove>
Also, will tyxml work with Mirage right now without camlp4?
<Drup>
yes
<Drup>
seangrove: I use tyxml in "No."
<Drup>
:)
<seangrove>
Drup: D'oh!
struk|desk|away is now known as struk|desk
<seangrove>
Drup: And what's the best tutorial with conversion examples?
<aantron>
seangrove: i and maybe others will be working on the docs too
<aantron>
im not sure if there is any good tutorial yet
<aantron>
but, what do you mean by conversion?
<aantron>
to convert from existing html to a tyxml "template", you will have to paste the html into a [%tyxml ...] expression
<aantron>
(or whatever the name ends up being)
<seangrove>
aantron: In this case, I just mean, "Here's a small html hello world, here's the equivalent in tyxml, and here's how to output it as an html string, or how to intercept the representation for a custom output"
<seangrove>
aantron: That's when the PR is accepted right? I'm looking at it now
<aantron>
right. the equivalent in tyxml will be just to wrap it in [%tyxml ]
<seangrove>
At using tyxml now*
<aantron>
yeah.
<aantron>
for that i have to defer to Drup
<seangrove>
I'll take a look at No.
Emmanuel` has quit [Quit: Konversation terminated!]
<aantron>
im not sure if there is any "good" way to do it now, except to get an untyped tree using camlp4
<aantron>
(iirc its untyped)
Emmanuel` has joined #ocaml
<Drup>
aantron: well, there is a good example, just write it directly with tyxml
<aantron>
you get the representation as an ocaml value, so no need to intercept it, unless you mean something else
<aantron>
right.
<Drup>
a good way*
<seangrove>
I want to output ReactJS and ReactNative output with tyxml, but not right now (just testing it for static output right now). Is that possible?
<Drup>
I'm pretty sure yes, the question is rather "how easy", which I don't know, because I don't know reactjs
<seangrove>
Drup: It's just a matter of outputting the right ocaml function calls. I'm not really familiar with ppx vs lisp macros
<seangrove>
I assume they're kind of equivalent, so at compile time the tyxml repreentation is desugared into plain ocaml
<Drup>
yes
<seangrove>
So if I have some known-working ocaml/reactjs code, I just have to figure out the function that takes the tyxml representation at compile time and produces the equivalent ocaml/reactjs code
pabs3 has left #ocaml ["Don't rest until the streets are paved in poems."]
<seangrove>
Drup: Thanks!
<seangrove>
(I assume that's just a basic usage example, not an alternative backend output example)
<seangrove>
b
Emmanuel` has quit [Quit: Konversation terminated!]
Emmanuel` has joined #ocaml
<aantron>
seangrove: are both links you sent converters to untyped representations?
<seangrove>
aantron: I'm not 100% what you mean by untyped. The first one (hiccup) is untyped (it's clojure's defactor html-as-datastructures representation), the second one is Elm, which is definitely typed
struktured has quit [Ping timeout: 246 seconds]
<seangrove>
(include attributes, etc.)
<aantron>
seangrove: what i mean is, in the elm representation, are the types just "element" "attribute" "text" or are they "html, which can only have a body and head as children"?
<aantron>
in tyxml parlance, an untyped tree is a tree of (VERY roughly) type tree = Element of tree list | Text of string, whereas a "typed" tree uses phantom types to prevent ill-formed nesting elements and other problems at compile time
<aantron>
Drup: ok :)
<Drup>
or rather, "not very typed"
<Drup>
:D
Emmanuel` has quit [Quit: Konversation terminated!]
Emmanuel` has joined #ocaml
<aantron>
i see
<aantron>
so elm-html just uses value names to hide strings to save you from typos, but otherwise they are "not very typed"
<aantron>
well and shorten the syntax.
<Drup>
and use first class functions
<Drup>
but yes
<seangrove>
aantron: So tyxml uses phantom types (no idea what these are, sounds cool) to prevent e.g. invalid html document structures, like <body><head><title></title></head></body, which is correct syntax, but not a correct html doc
<Drup>
Yes
<Drup>
it also prevents a in a, or other things like that
<Drup>
and which attributes goes with which elements.
<aantron>
the error message isnt particularly pretty
<aantron>
but there tyxml was yelling for putting ul inside ul
<aantron>
(without an intervening li)
<aantron>
and i believe tyxml is fine with html fragments like you suggested, but you can ask (by using types) for docs only
<aantron>
ah wait
<aantron>
that was an ill-formed fragment, so yes tyxml will reject it :)
<seangrove>
aantron: Ill-formed because head can't be inside body, right?
<aantron>
yes
<seangrove>
Heh, that's great
<seangrove>
Ok, so no html->tyxml convertor as of now, I have to hand-type it all out, right?
<aantron>
seangrove: if camlp4 is acceptable, there is that already in tyxml
<aantron>
otherwise, you can either use dev tyxml and switch to this PR branch, otherwise i think you are stuck with typing it, unless Drup can suggest something better
<seangrove>
aantron: Nah, want to avoid camlp4
<aantron>
the PR has a few bugs i know about that i should fix before Drup has time to review it :p
<aantron>
so i dont know if i can fully recommend that option
<aantron>
plus the interface may change somewhat, like the name of the extension point and whatnot
<seangrove>
aantron: I just looked, and I think index.html is only 156 lines, I might be able to just write an emacs macro that gets me something close-to-working
<seangrove>
what's the equivalent for <!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]--> ?
<aantron>
i hope Drup: can answer that more readily
<aantron>
however tyxml supports comments and even if you need a structure like that, that might not obviously map onto tyxml types, tyxml also supports coercions
<aantron>
taking a look
Emmanuel` has quit [Quit: Konversation terminated!]
<aantron>
prints <!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
struk|desk is now known as struk|desk|away
<aantron>
Drup: maybe if i cut markup.ml up to into little packages to separate the html writers (and add a polyglot mode) (perhaps using namespaces? :)), it can be used for tyxml runtime for outputting? then you wouldnt drag int the whole html5 parser, but get spec conformant polyglot output
<larhat>
hi, any js_of_ocaml folks here? or maybe someone can point me to the right direction with my problem? I want to use type_conv deriver with my js_of_ocaml program, but when I'm trying to link deriver via -package ppx_my_conv js_of_ocaml complains about missing primitives in resulting .byte. You can easily reproduce it even with empty file and basic ppx_type_conv: https://gist.github.com/little-arhat/afa365a6d73d2472c896 . Using ppx_deriving_yojson, in c
ygrek has joined #ocaml
<seangrove>
What about the tyxmk\ equiv of <script src="/js/client.js" type="text/javascript"></script> ?
<seangrove>
Yikes, the errors are definitely intimidating for tyxml
<aantron>
script ~a:[a_src "/js/client.js"] (pcdata "foo"), not sure what to do about the type attribute, Drup? also, the output escapes inside script data, this is contrary to the spec
<aantron>
and writing tyxml from scratch is the other use case for the ppx that i was talking about :)
<aantron>
since it would select all these tyxml values automatically whether you were pasting from existing html or not
<smondet_>
larhat: there is an option for js_of_ocaml, I think it is `+weak.js`
slash^ has joined #ocaml
smondet_ is now known as smondet
<seangrove>
Without examples, it's definitely tough. link ~rel:[`Icon] ~href:"/images/apple-icon-57x57.png" ~a:[ a_sizes [(57, 57)]] (); is complainning because I don't have the size format right
<seangrove>
Error: This expression has type (int * int) list but an expression was expected of type [< `Any | `Sizes of (Html5_types.number * Html5_types.number) list ] H.wrap
<seangrove>
shinnya has joined #ocaml
<aantron>
you have to wrap it in `Sizes
<smondet>
larhat: actually the error message tells you :) just add +toplevel.js and +weak.js
<seangrove>
Ah, yup, that did it
<seangrove>
Ok, so when I see the `Any | `SomethingElse, I'll need to tag the data with that
<larhat>
smondet: but why I don't get this error without ppx_type_conv?
<aantron>
right. it might not always be called `Any though, its called `Any in that case because there is a valid value "any"
<aantron>
in tyxml 4.0 some of these are replaced by options.. but tyxml 4.0 will have the ppx, so you should be able to write just html and it should "just" get translated to whatever tyxml actually uses
<seangrove>
aantron: In this case, the rel should be rel="apple-touch-icon", e.g. <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-icon-180x180.png">
<seangrove>
aantron: Yeah, I like that idea. Right now the interface to different Html5 functions seems inconsistent
<aantron>
seangrove: try `Other "apple-touch-icon" instead of `Icon
<aantron>
seangrove: yeah, imo the tyxml interface is a bit too much to remember, in practice you would hope that everything is obviously translated like src becomes a_src, but there are a bunch of exceptions
<aantron>
(a lot of which are exceptions for good reason)
<larhat>
smondet: yes, adding +toplevel.js +weak.js helped, but why linking against ppx_type_conv requires this? I also have 2.0M Mar 8 19:22 core.js now %(
<aantron>
but that they are for good reason does not make them easier to deal with, or the syntax easier to read
seangrove has quit [Remote host closed the connection]
seangrove has joined #ocaml
seangrove has quit [Remote host closed the connection]
seangrove has joined #ocaml
<smondet>
larhat: the ppx-generated functions must use some modules that themselves depend on the `Weak` module
yunxing has joined #ocaml
<smondet>
larhat: by removing the options `--pretty --noinline --sourcemap` you'll get back much lighter JS
<larhat>
yeah, even without +weak I have big js, I remember having much smaller one %) I think, though, - - noinline should get js smaller, since you don't have a lot of duplication due to inlining?
<aantron>
in case of type attributes, since "type" is a common keyword in ocaml, search the page for "_type"
<larhat>
linking againts ppx_sexp_conv increases generated js size from ~9K to 825K %( Linking againts ppx_deriving_yojson increases size "only" from ~9K to 63K. This is without any code generation
* seangrove
sighs
<aantron>
seangrove: did you see the earlier message about `Icon? not sure if you timed out or what
<seangrove>
aantron: I did, thanks!
<aantron>
ok, :)
<seangrove>
But yeah, this is close to impossible to write by hand
<seangrove>
img ~src:"/images/sofuji_black_30.png" ~alt:"RiseOS" errors with some difficult-to-read message
<seangrove>
I'm still on the header of the body T.T
<aantron>
i think we can make tyxml "legendary", with the ppx, and especially if we can hook it up to lambda soup for postprocessing.. imagine [%tyxml ...] $$ "selector" |> iter (add_child [%tyxml ...] or something like that
<aantron>
)*
Emmanuel` has quit [Quit: Konversation terminated!]
Emmanuel` has joined #ocaml
t4nk943 has joined #ocaml
<Drup>
larhat: don't forget to use jsoo_minify
lobo has quit [Quit: WeeChat 1.4]
<Drup>
seangrove: I actually write tyxml by hand all the time, but yes, I understand and I mostly agree
<seangrove>
Drup: What am I missing here?
<larhat>
Drup: thanks! didn't know about that one! but I think, using ppx_type_conv rewriters shouldn't bring too much stuff to bytecode. maybe I should use ppx-rewriter as executable instead
malc_ has quit [Quit: ERC (IRC client for Emacs 25.0.50.2)]
<seangrove>
a ~a:[a_href "/"] [ img ~src:"/images/sofuji_black_30.png" ~alt:"RiseOS"; (pcdata "RiseOS")] -> Error: This expression has type ([< Html5_types.img_attrib ] as 'a, [> Html5_types.img ] as 'b) H.nullary = ?a:'a H.attrib list -> unit -> 'b H.elt but an expression was expected of type 'c H.elt = 'c Html5.M.elt
<aantron>
you need to apply img to ()
<seangrove>
aantron: Yup, that seems to have done it. Bah.
<seangrove>
And I think this will be the last thing for today's experiment: How can I apply inline styles?
<Drup>
a_style "some string"
<aantron>
a_style
<aantron>
&
<aantron>
^ i mean
<Drup>
It's not typed, it's simple :D
<seangrove>
Drup: Ok, so a single semicolon-delimited css string for multiple attrs? Not like `(Sizes ...)?
<aantron>
yes
<aantron>
its just regular syntax for the style attribute, like in html
<seangrove>
Left is the liquid html setup I have before, right is the tyxml rewrite. Looks pretty similar for what I managed to get to :)
<aantron>
nice. is this with the aid of that macro you were talking about writing?
<seangrove>
aantron: That wasn't really useful because of the ad-hoc interaface of tyxml
<seangrove>
I couldn't normalize everything easily
<aantron>
yeah. you could also go for the untyped interface of tyxml :) but yeah i know what you mean with the typed interface. had to do exactly targetting it with the ppx
<Drup>
seangrove: did you noted all the things you considered ad-hoc ?
<Drup>
(I'm in the middle of normalizing things, so it would be helpful)
<aantron>
same here, in case i missed something in the ppx
<aantron>
although Drup, even things like img ~src:... instead of img ~a:[a_src...] are ad-hoc when you're writing a quick script
<Drup>
aantron: I know, but those one are not going to change
<aantron>
yeah. hiding behind my "even" is that this is there for a good reason, so there are a bunch of obviously ad-hoc things that will stay that way
<aantron>
and since these are common there will be a lot of those in any list
iosys has quit [Quit: Leaving...]
<seangrove>
Drup: It was pretty much all of those. Sometimes attrs go into the ~a: part, other times it would fail if there weren't some special attr (html attr, but ocaml arg, blah) outside
ygrek has quit [Ping timeout: 244 seconds]
<aantron>
seangrove: yeah, these are still systematic, but it seems to require reflection on the tyxml signatures to actually discover them. so its unfortunately difficult to target them with a script that could be written relatively quickly :/
Emmanuel` has quit [Quit: Konversation terminated!]
Emmanuel` has joined #ocaml
<seangrove>
aantron: Ultimately, I wouldn't want to write at this level I think. But if the ppx interface is 1. uniform and 2. easy to generate, then I don't care at all :)
iosys has joined #ocaml
<Drup>
seangrove: the thing is that you are not using abstraction/encapsulation at all.
<Drup>
You are using the ocaml language, you could define small functions, widgets, and so on
shinnya has quit [Ping timeout: 244 seconds]
<seangrove>
Drup: Well, I disagree
<seangrove>
*Definitely* OCaml (or clojure, js, etc.) gives you a great to build up nice bigger pieces, but that's orthogonal to the uniformity of an interface
<seangrove>
If I still have to remember the snowflake-like invocation for img vs link vs meta, then the big pieces won't save me while I'm writing them
<Drup>
oh, right, but I was not really talking about that, more about what your code looked like
<seangrove>
Drup: Oh certainly, I was literally just translating an html file
<seangrove>
No abstraction at all :)
<Drup>
about the "snowflake invocation", there is an logic, though
<Drup>
"is an attribute mandatory ? yes => it's a labeled argument"
Anarchos has joined #ocaml
<seangrove>
Drup: Which attributes are mandatory? I have to remember per-tag, basically memorize the spec
<Drup>
No, you just need ^t :D
Emmanuel` has quit [Quit: Konversation terminated!]
Emmanuel` has joined #ocaml
<seangrove>
But I like the idea of having all this type safe, etc. at the bottom, I just want to be able to write things in html quickly (a la JSX) and have it generate the unerlying code
<seangrove>
It could still throw errors on malformed html, but it would be more obvious how to fix them for someone new
<Drup>
Yes, I agree, it should be done in the next release ;)
<seangrove>
\o/
<seangrove>
Really excited about that
<seangrove>
Everyone here is insanely prolific, thanks so much for all of the crazy stuff you provide
<Drup>
well, it's mostly due to aantron :D
<seangrove>
aantron was included in that "everyone here" :)
warp has quit [Ping timeout: 260 seconds]
<aantron>
woot woot.. i mean, jk :p sarcasm, dont want it to come off weird in chat :) a lot of people here (and elsewhere) are doing a lot of awesome stuff, its an exciting time for ocaml
jwatzman|work has quit [Quit: jwatzman|work]
lobo has joined #ocaml
Emmanuel` has quit [Quit: Konversation terminated!]
Emmanuel` has joined #ocaml
ollehar has joined #ocaml
ygrek has joined #ocaml
Emmanuel` has quit [Quit: Konversation terminated!]
Emmanuel` has joined #ocaml
Emmanuel` has quit [Client Quit]
Emmanuel` has joined #ocaml
fraggle_ has quit [Read error: Connection reset by peer]
Emmanuel` has quit [Client Quit]
larhat has quit [Remote host closed the connection]
Emmanuel` has joined #ocaml
octachron has joined #ocaml
Haudegen has quit [Ping timeout: 244 seconds]
<aantron>
btw, seangrove, what did you end up doing for that text preview you were trying to create?
* Anarchos
is recompiling an OS package for ncurses cause opam fails on pkg-config ncurses... So to install merlin i need to recompile an OS package :)
octachron has quit [Ping timeout: 248 seconds]
fraggle_ has joined #ocaml
<seangrove>
aantron: Still procrastinating on it, digging around iOS stuff the past few days
Anarchos has quit [Remote host closed the connection]
malc_ has joined #ocaml
octachron has joined #ocaml
ollehar has quit [Quit: ollehar]
Haudegen has joined #ocaml
Emmanuel` has quit [Quit: Konversation terminated!]
Emmanuel` has joined #ocaml
<seangrove>
aantron: Your suggestion was to intercept Omd's parsing string, to stop after 50 tokens, and then tell it to stop, I believe
Emmanuel` has quit [Quit: Konversation terminated!]
Emmanuel` has joined #ocaml
<seangrove>
aantron: Looking at it, it's really unclear where I could do that. Let me see if I can hack it a bit :)
TheLemonMan has joined #ocaml
sh0t has quit [Ping timeout: 268 seconds]
<seangrove>
Ok, I see, so I can call Omd.of_string, then walk the resulting structure until I hit 50 tokens, and then call Omd.to_html on the sublist I build up
Emmanuel` has quit [Quit: Konversation terminated!]
Emmanuel` has joined #ocaml
<seangrove>
I have a binding of type Omd.element that I want to pattern match off of - how do I know the valid patterns?
<seangrove>
This looks promising, but I don't know where to find Omd.element: `Error: This variant pattern is expected to have type Omd.element. The constructor None does not belong to type Omd.element`
<seangrove>
Quick question: What's the equiv ocaml with a ref of: x = x - 1 ?
<companion_cube>
decr x;
Kakadu has joined #ocaml
<companion_cube>
(the ; is optional, sorry)
BitPuffin has quit [Read error: Connection reset by peer]
Emmanuel` has quit [Quit: Konversation terminated!]
<seangrove>
companion_cube: Thanks! A bit surprises that decr is itself effectful, wouldn't have expected that
Emmanuel` has joined #ocaml
<companion_cube>
you can also write x := !x - 1
<companion_cube>
:)
yunxing has joined #ocaml
<mrvn>
seangrove: incr/decr are quite often used with int refs, so often they made a function for it by default.
Emmanuel` has quit [Client Quit]
Emmanuel` has joined #ocaml
orbifx has quit [Ping timeout: 244 seconds]
yunxing has quit [Remote host closed the connection]
yunxing has joined #ocaml
<seangrove>
mrvn: Yeah, in clojure we have (inc n) (dec n), but they're not side-effecting (the mutation/swap is left at the call-site, rather than the in the function. e.g. (swap! my-int-ref n inc)
<companion_cube>
hope OCaml will have this once multicore lands
<companion_cube>
compare and swap is really cool
<aantron>
seangrove: im only here for a bit, but my suggestion was something else
<aantron>
it was to call Omd.to_html first, then use markup.ml to parse it, and watch the `Text signals it emits
<aantron>
when you git N tokens in the `Text signals, you stop markup.ml's input stream
<aantron>
you also send all of the markup.ml signals to the html writer
<aantron>
stop the signal stream, and the html writer will close any unclosed tags automatically
<aantron>
its a bit hacky, and there may be much better approaches, but it should work
<aantron>
if you want, i can make a gist showing the basics of it when i return
<aantron>
(actually you dont need to do anything special to the input stream, you just stop reading from the signal stream)
slash^ has quit [Read error: Connection reset by peer]
larhat has joined #ocaml
<aantron>
now that i think about it, it should just be a simple filtering between parse_html and write_html, but i may be missing something
rcabaco_ has joined #ocaml
rcabaco_ has quit [Client Quit]
rcabaco_ has joined #ocaml
rcabaco_ has quit [Client Quit]
rcabaco has quit [Ping timeout: 276 seconds]
Emmanuel` has quit [Quit: Konversation terminated!]
Emmanuel` has joined #ocaml
m-x-v has joined #ocaml
Emmanuel` has quit [Quit: Konversation terminated!]
Emmanuel` has joined #ocaml
_andre has quit [Quit: leaving]
dhil has quit [Ping timeout: 260 seconds]
ggole has quit []
Emmanuel` has quit [Quit: Konversation terminated!]
Emmanuel` has joined #ocaml
yunxing has quit [Remote host closed the connection]
m-x-v has quit [Ping timeout: 246 seconds]
Emmanuel` has quit [Quit: Konversation terminated!]
Anarchos has joined #ocaml
<seangrove>
Quick haskell-lens-like question: What's the easiest way to immutable insert an item at the last index of the last sublist?
<seangrove>
e.g. shallow_last_append [[a b] [c d]] e -> [[a b] [c d e]]
Emmanuel` has joined #ocaml
<companion_cube>
no idea, really
yunxing has joined #ocaml
<seangrove>
Bit early as a language use to say for sure, but it *feels* as though OCaml's lack of high-perf immutable datastructures in the core library hurts a lot
<companion_cube>
do you count lenses as such?
<companion_cube>
Map and Set have pretty good performance, too
t4nk943 has left #ocaml [#ocaml]
<seangrove>
companion_cube: Yeah, I suppose a lens-like interface with e.g. clojure's vectors underlying it, so that (update-in my-vector [(count my-vector)] (fun sublist -> (conj sublist my-item))) is easy to write and isn't reconstructing an entire list
<seangrove>
(via structural sharing)
<companion_cube>
ah, yes, a vector
<companion_cube>
there is a HAMT library
d0nn1e has quit [Ping timeout: 248 seconds]
d0nn1e has joined #ocaml
sh0t has joined #ocaml
yunxing has quit [Remote host closed the connection]
Emmanuel` has quit [Quit: Konversation terminated!]
Emmanuel` has joined #ocaml
orbifx has joined #ocaml
lewis1711 has joined #ocaml
<lewis1711>
is there a way to get literal BigInts in ocaml? I couldn't find anything for the BigNum module in core, or the Zarith library
xvw has joined #ocaml
seangrove has quit [Ping timeout: 276 seconds]
orbifx has quit [Ping timeout: 240 seconds]
<zozozo>
lewis1711: what do you want exactly ? arbitrary precision integers ? or juste integers with more than 63 bits ?
<lewis1711>
zozozo, arbitrary precision. for combinatorics stuff
<zozozo>
well, I'd say zarith is a very good choice
<zozozo>
the type Z.t represents arbitrary precision integers
<lewis1711>
I'm specifically after something with literals though, or wondering if there is a way to get them
<zozozo>
what do you mean literals ?
<lewis1711>
like 3.0 is a float literal
<lewis1711>
or 3l is an Int32.t literal (at least in core)
Thooms has joined #ocaml
<zozozo>
still don't see what you mean, sorry
<lewis1711>
it gets tiresome having to type "BigInt.of_string "3"" when you want to use the repl as a calculator
yunxing has joined #ocaml
<zozozo>
ah..
<zozozo>
I don't think there is a way to do that properly except maybe with a ppx, but I don't know that is exists
<zozozo>
I suppose most bigint libraries also provide an 'of_int' function which might be nicer to use than of_string
<companion_cube>
Zarith provides Z.(~$ )
<xvw>
(sorry for the out of subject but is there a way to use merlin for an OCamldoc generator?)
<octachron>
4.03 should also come with better support for custom ppx literals (at least for integer and float)
<lewis1711>
companion_cube, that looks promising, thanks
<companion_cube>
Z.( ~$ 42 + ~$ 33)
<lewis1711>
oh. that looks awful
<companion_cube>
yes, sadly there is no better way afaik
<companion_cube>
(unless you use a ppx)
<zozozo>
well if you only want to do toplevel computations, I'd say python may be nicer
<lewis1711>
I prefer Ocaml. might look into F# though, haven't had great luck with it in linux but "1L" is a literal bigint, which is nice.
MercurialAlchemi has quit [Ping timeout: 276 seconds]
<lewis1711>
sorry, "1I"
julien_t has joined #ocaml
Haudegen has quit [Ping timeout: 246 seconds]
Emmanuel` has quit [Quit: Konversation terminated!]