<bluestorm>
it's mostly a comprehension-based syntax for Queries, wich aims at providing nicer way to express queries than plain SQL
<bluestorm>
and it is composable
<bluestorm>
(you can create views from simpler views and value from simpler values)
<bluestorm>
I think it's quite usable right now for simple queries, but it's probably not ready for heavy use
<bluestorm>
(and I excpect user to ask for more features : right now it doesn't support SORT BY and ORDER BY, though it's probably not very difficult to add)
<flx__>
group by? offset? yes, tons of features are waiting to get in :)
<bluestorm>
I do have group by
<bluestorm>
and that was a non-trivial one
<flx__>
I'll try to make use of that lib at some point
<thelema_>
blue: have you ever looked at DBIx::Class?
<flx__>
the other library for composable sql queries for ocaml was slightly too limited
<bluestorm>
actually it should not be very complicated to add sort_by / order_by / limit / offset, as their semantic and typing is quite simple
<bluestorm>
(especially limit/offset)
<bluestorm>
flx__: I'm interested in your needs if you know what you have in mind
<bluestorm>
However, macaque was designed to help ocsigen developpment, and internally they have dead-simple queries
<bluestorm>
(the "SELECT row FROM table WHERE login = ... AND pass = ..." kind)
<flx__>
bluestorm, I'll let you know once I get there
<flx__>
perhaps I'll port the one app to use that.. if I remember what the app was :)
<flx__>
bluestorm, is there an easy/reasonable way to use autoincrementing primary keys?
<bluestorm>
anyway, I'm runtime-compatible with PG'OCaml so you can always fall back on them if you lack a specific feature
<bluestorm>
hm
<bluestorm>
I suspect there may not be right now
<flx__>
well, that can be quite important for certain applications
<bluestorm>
you mean, auto-increment at table insertion ?
<bluestorm>
agreed
<flx__>
at row insretion, yes
<bluestorm>
I'll see for that
<bluestorm>
I have to go know
<bluestorm>
err
thrasibule has joined #ocaml
<bluestorm>
-k
<bluestorm>
thelema_: I must confess I haven't; macaque points however are to provide strongly typed query construction (with a comprehension syntax, that was the internship topic), wich I doubt they provide
<flx__>
indeed query composition is interesting for me
<flx__>
and pgocaml doesn't provide that
<flx__>
although I've thought about using some macro preprocessor to overcome that problem
<flx__>
(actually it'd be almost best of the both worlds: construct queries compile-time from fragments and get compile-time guarantees that they work)
<flx__>
of course, such composition would not allow dynamically constructing sql-queries perhaps per the user request
<flx__>
bluestorm, big applauds for writing such a comprehensive README! well, atlest it looks comprehensive :)
Makoryu has quit [Remote closed the connection]
<thelema_>
bluestorm: just in terms of design / interface / common optimizations, I find it useful to look at where others have gone, and the solutions they've made
thrasibule has quit [Read error: 60 (Operation timed out)]
thrasibule has joined #ocaml
onigiri has quit [Read error: 110 (Connection timed out)]
Beelsebob has quit [Read error: 104 (Connection reset by peer)]
eyda|mon has joined #ocaml
sramsay has joined #ocaml
sramsay has quit [Client Quit]
Cromulent has joined #ocaml
Alpounet has quit [Read error: 131 (Connection reset by peer)]
Beelsebob has joined #ocaml
<orbitz>
Any sugestions for how to design code to turn multiple lines in a file to a single record? right now i have a stream for eading lines and then i wrap that stream in another for turning those lines into records, and the code is like a big ugly FSM wher ei build the record into a tuple first then finaly construct the record at the end
Cromulent has quit []
thelema__ has joined #ocaml
thelema_ has quit [Read error: 104 (Connection reset by peer)]
<bluestorm>
orbitz: do you know your record structure in advance ?
slash_ has joined #ocaml
<bluestorm>
if you do, you could have the record parsing routine actually drive the input process
<bluestorm>
instead of being driven by the lines you get in
<bluestorm>
(that must be one of those push/pull debates)
<orbitz>
bluestorm: I know what i'm looking for, but some elements are optional, and the existenc eof othe relements necesistates the existence of other oens
BiDOrD has quit [Read error: 110 (Connection timed out)]
<orbitz>
righ tnow my method is almost 200 line sof code, and that is only handling 8 input elements
<orbitz>
(i would consider that nasty)
BiDOrD has joined #ocaml
<orbitz>
however, that 200 lines IMO may be longer than what iw ould writ ein Python, but i think it has stronger validation
<bluestorm>
orbitz: what's almost certain is that, if you want to, you can do as untyped as Python
<orbitz>
bluestorm: what do you mean?
<bluestorm>
well you can always choose a less typed road, if it makes what you're doing easier
<orbitz>
bluestorm: in this case I'm mostly doing this to play with Ocaml, but my gut tells me i'm doing this wrong
<bluestorm>
maybe showing your code and the grammar you're parsing would help
<orbitz>
it's close to 200 lines, but it's all a fairly repetitive pattern, can i post it on pastebin and see if there is anything obviously wrong?
<bluestorm>
well I've got a first proposition, but I haven't read the whole thing
<orbitz>
lay it on me bluestorm
<bluestorm>
create a temporary record with options types instead of the real thing
<bluestorm>
(record type)
<bluestorm>
then use the { foo with bar = baz } syntax
<orbitz>
ok
<bluestorm>
instead of the quite repetitive tuple update
<orbitz>
yeah the tuplething is nasty
<bluestorm>
you could even have a local type (using a local module) but it's a bit heavier syntaxically and not really worth it
<orbitz>
so each element will be ina option in this case, then make a funciton to convert temp record t final record
<bluestorm>
that's the idea
<orbitz>
that's a great idea thanks
<orbitz>
anything else
<orbitz>
?
<orbitz>
that will cut down on quite a few lines and nastyness
<bluestorm>
(you could also do with an object instead of a record, wich wouldn't require a type declaration, but that's just cosmetic and sticking with records is simpler)
<bluestorm>
does your startWith function actually eat the line in case of matching ?
<orbitz>
no
<bluestorm>
(I was thinking of the stream data structure, wich has a neat syntax for recursive descent parsers with destructive matching)
<bluestorm>
the other generic idea in those case is to create a sum type with is dual to your record type, something like { a : foo; b : bar } -> A of foo | B of bar
<bluestorm>
then parse the file as a list of that sum type, and reconstruct the records afterwards
<bluestorm>
but I'm not sure that would fit well in your case
<bluestorm>
I think just having that { foo with bar = baz } update syntax will make your parser nice to read
<orbitz>
why are they called sum types or product types?
<orbitz>
bluestorm: yes i think that will give methe most bang for my buck
<orbitz>
thank you
<bluestorm>
product type, think of cartesian product
<bluestorm>
('a * 'b) has an element of 'a _and_ and element of 'b
<bluestorm>
whereas A of 'a | B of 'b has an element of 'a _or (exclusive)_ an element of 'b
<bluestorm>
think disjoint sum of two sets
Anarchos has joined #ocaml
<bluestorm>
(actually the mathematical idea are more general than just set operations)
Alpounet has joined #ocaml
thrasibule has quit [Read error: 104 (Connection reset by peer)]
thrasibule has joined #ocaml
Modius has quit ["I'm big in Japan"]
Anarchos has quit ["Vision[0.9.7-H-090423]: i've been blurred!"]
eyda|mon has quit ["But I was gone already."]
Yoric[DT] has quit [Read error: 110 (Connection timed out)]
Yoric[DT] has joined #ocaml
thrasibule has quit [Read error: 104 (Connection reset by peer)]
thrasibule has joined #ocaml
Associat0r has joined #ocaml
thrasibule_ has joined #ocaml
thrasibule has quit [Read error: 104 (Connection reset by peer)]
Anarchos has joined #ocaml
f[x] has quit [Read error: 110 (Connection timed out)]
blue_prawn has joined #ocaml
Yoric[DT] has quit [Read error: 110 (Connection timed out)]
Associat0r has quit []
Yoric[DT] has joined #ocaml
mbishop_ has joined #ocaml
Alpounet has quit ["Leaving"]
Beelsebob1 has joined #ocaml
Beelsebob has quit [Read error: 60 (Operation timed out)]
mbishop has quit [Read error: 113 (No route to host)]
jeddhaberstro has joined #ocaml
jeddhaberstro has quit [Client Quit]
jeddhaberstro has joined #ocaml
svenl has quit [Read error: 104 (Connection reset by peer)]
Yoric[DT] has quit ["Ex-Chat"]
Beelsebob1 has quit [Read error: 104 (Connection reset by peer)]
Beelsebob has joined #ocaml
thrasibule_ has quit ["No Ping reply in 90 seconds."]
thrasibule has joined #ocaml
bluestorm has quit [Remote closed the connection]
Anarchos has quit ["Vision[0.9.7-H-090423]: i've been blurred!"]
ulfdoz has quit [Read error: 110 (Connection timed out)]
marmottine has quit ["mv marmotine Laurie"]
psnively has joined #ocaml
svenl has joined #ocaml
Beelsebob has quit ["Leaving."]
blue_prawn has quit ["Client exiting"]
onigiri has joined #ocaml
psnively has quit []
slash_ has quit [Client Quit]
thrasibule has quit ["No Ping reply in 90 seconds."]