<Corbin>
I am in awe of Printf.printf's magical type-sensing powers. I want to imagine something similar: I have functions with signatures that might vary a little; say, they take one or more ints and return an int. Is there a good idiom for managing this sort of function with unknown signature?
<d_bot>
<EduardoRFS> Corbin: GADTs?
dhil has joined #ocaml
bartholin has joined #ocaml
<Corbin>
Not exactly. I guess that I should pick up where I stopped talking with ccube yesterday. I have expressions that might operate on ints or floats; they might have type `int -> int` or `int -> int -> int`. I know that I could enumerate specific types which are okay, and create a sort of calling-convention interface; but I'm interested in whether there's any other techniques, including magic.
<Corbin>
GADTs could work, but I'd have to be more rigorous about knowing the types of my expressions, which is (to use some local slang) a total bummer.
vicfred has quit [Quit: Leaving]
mro has joined #ocaml
<d_bot>
<octachron> Taking a list or arrays of integers sounds like the simpler solution.
<d_bot>
<octachron> (There is no magic beyond the syntax in Format or Printf)
gravicappa has quit [Ping timeout: 268 seconds]
olle has joined #ocaml
glassofethanol has joined #ocaml
Tuplanolla has joined #ocaml
mro has quit [Quit: Leaving...]
nd__ has joined #ocaml
<nd__>
Aloha… I updated opam to `v2.1.0` and the init script slows down my zsh tremendously. Anyone else experiencing this?
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
<d_bot>
<Kakadu> @Corbin: you may try to google Oleg's "unusual polymorphism"
mro has quit [Ping timeout: 256 seconds]
mro has joined #ocaml
mro has quit [Ping timeout: 268 seconds]
labor[m] has quit [Quit: Bridge terminating on SIGTERM]
krnkktz has quit [Quit: Bridge terminating on SIGTERM]
fluxm has quit [Quit: Bridge terminating on SIGTERM]
inkbottle[m] has quit [Quit: Bridge terminating on SIGTERM]
smondet[m] has quit [Quit: Bridge terminating on SIGTERM]
brettgilio has quit [Quit: Bridge terminating on SIGTERM]
schube[m] has quit [Quit: Bridge terminating on SIGTERM]
marinelli[m] has quit [Quit: Bridge terminating on SIGTERM]
mewfree[m] has quit [Quit: Bridge terminating on SIGTERM]
<olle>
How come OCaml didn't adapt the keyword forall?
krnkktz has joined #ocaml
fluxm has joined #ocaml
brettgilio has joined #ocaml
labor[m] has joined #ocaml
inkbottle[m] has joined #ocaml
mewfree[m] has joined #ocaml
smondet[m] has joined #ocaml
schube[m] has joined #ocaml
marinelli[m] has joined #ocaml
mro has joined #ocaml
<d_bot>
<Alistair> Because OCaml only supports Rank-1 polymorphism, hence the `forall` is implicit
berberman has quit [Ping timeout: 240 seconds]
berberman has joined #ocaml
troydm has quit [Quit: What is Hope? That all of your wishes and all of your dreams come true? To turn back time because things were not supposed to happen like that (C) Rau Le Creuset]
troydm has joined #ocaml
<olle>
Ali, no, sometime's you have to manually add the 'a . 'a thing
<olle>
the dot
<d_bot>
<Alistair> Yes, but you asked why we don't have the `forall` keyword?
<d_bot>
<Drup> Because people don't like keywords
cedric has joined #ocaml
<d_bot>
<Drup> so `.` was the chosen piece of syntax
<d_bot>
<Alistair> Especially when they don't clarify anything ^
<d_bot>
<Drup> Well, in this case, anything is clearer than `.`
<olle>
Yeah, dot is weird
<olle>
"People" don't like keywords?
<olle>
Xavier?
<d_bot>
<Alistair> I think it's rather natural, standard quantifier notation is usually `Quantifier vars. term`
<olle>
In which context? Ali
<d_bot>
<Alistair> Since a `forall` keyword wouldn't add any additional information (since core types don't support existential quantifiers), then a natural reduced syntax would be `vars. term`
<olle>
"natural"...
<d_bot>
<Alistair> Type theory, first-order (and higher-order) logic
mro has quit [Remote host closed the connection]
<olle>
So, how many other usages do '.' have in that context?
<olle>
Because in OCaml it's already record field access.
<olle>
And module access.
mro has joined #ocaml
<d_bot>
<Alistair> In types? none. In other things e.g. expressions, etc, `.` is used rather often. Field resolution (as in records and modules). Used as an operator for composition in Haskell
<olle>
I rest my case xD
mro has quit [Remote host closed the connection]
favonia has quit [Ping timeout: 258 seconds]
mro has joined #ocaml
Guest3131 has quit [Ping timeout: 265 seconds]
Anarchos has joined #ocaml
<Anarchos>
hello, how to submit a patch for /opam/src_ext/dune-local/src/dune_filesystem_stubs/readdir.c ?
gravicappa has joined #ocaml
mro has quit [Read error: Connection reset by peer]
mro has joined #ocaml
olle has quit [Remote host closed the connection]
olle has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro_ has joined #ocaml
mro has quit [Ping timeout: 252 seconds]
mbuf has quit [Quit: Leaving]
mro_ has quit [Remote host closed the connection]
kakadu_ has joined #ocaml
kakadu_ is now known as Kakadu
Kakadu has quit [Client Quit]
Kakadu has joined #ocaml
<d_bot>
<Kakadu> let' s imagine someone want to put pure functional program into FPGA. After CPSing non tailrec functions and defunctionalization the final program blows up in size. What could be the ideas to do something differently to get a smaller programs?
<d_bot>
<ggole> Optimise the defunctionalisation so you don't get huge cases?
<d_bot>
<Kakadu> Maybe... Are there any smart words in particular that I should google?
<d_bot>
<ggole> There are a few defunctionalising compilers that use dataflow analysis for this purpose. MLton and GRIN are the ones I would look at.
<vsiles>
is there a way to track down all the `match x with | A -> .. | _ -> ..` statements for a specific type ?
<vsiles>
I'd like to add a new constructor to the type, and want to be sure I update all the right places, so I'm looking for the _ -> catch all
<d_bot>
<antron> @vsiles there is grep, and another way is to rename the `A` constructor to force errors at all patterns
<vsiles>
that would force errors to all patterns whenre A is, not all patterns of the type
<vsiles>
maybe there's a compiler warning, I'll check the list
<vsiles>
4 Fragile pattern matching: matching that will remain complete even if additional constructors are added to one of the variant types matched.
<vsiles>
maybe that one
<d_bot>
<ggole> You can comment out the definition of the entire type containing A, changing it to something like `type t = BreakPlease`
<vsiles>
not bad :D
<d_bot>
<ggole> It might be possible to get merlin to do this for you... `merlin-occurrences` doesn't quite fit the bill though
<d_bot>
<ggole> It shows occurrences of an individual constructor or type constructor
<d_bot>
<ggole> On a more speculative note, I've considered the idea of a 'new constructor' annotation that gets the compiler to spit out a list of the places which silently range over the annotated constructor (or field)
<d_bot>
<ggole> Might be handy for this kind of thing
<vsiles>
looks like we don't have a lot of fragile pattern matching anyway. I might just remove them and enable the warning altogether
<d_bot>
<ggole> Oh hey, another idea; put `[@deprecated]` on each constructor
<d_bot>
<ggole> But this will mark construction too
<vsiles>
(I'm confused, warning 4 is not what I'm looking for :p)
waleee has joined #ocaml
<vsiles>
I think I'll try you BreakPlease idea :)
oni123 has joined #ocaml
<vsiles>
hmm no, I'm getting only a few errors at a time (like only the one in the same file)
oni123 has quit [Quit: Client closed]
zebrag has joined #ocaml
favonia has joined #ocaml
mbuf has joined #ocaml
glassofethanol has quit [Quit: leaving]
Kakadu has quit [Remote host closed the connection]
<Anarchos>
vsiles or look for ' _ -> ' ?
nd___ has joined #ocaml
nd__ has quit [Ping timeout: 245 seconds]
nd___ has quit [Ping timeout: 250 seconds]
cedric has quit [Quit: Konversation terminated!]
nd__ has joined #ocaml
olle has quit [Ping timeout: 250 seconds]
mbuf has quit [Quit: Leaving]
waleee has quit [Ping timeout: 240 seconds]
<Corbin>
Kakadu: Thanks, that was good reading.
<Corbin>
I decided to modify my desires somewhat. To have a concrete goal: I have a small applicative DSL describing functions R * R * R -> R, and a wrapper around that which describes functions R * R -> R * R * R * R. I will simply specialize everything for these cases, and worry about generalities at the next design step.
<Corbin>
I'm trying to make a raytracer faster in the long term by specializing it to low-level code. For reasons, I thought that OCaml would be a good target; I wanted to use the compiler and runtime. The first signature is signed distance functions in 3D, and the second is pixel colors in 2D.
waleee has joined #ocaml
olle has joined #ocaml
vicfred has joined #ocaml
waleee has quit [Quit: WeeChat 3.2]
waleee has joined #ocaml
vicfred has quit [Ping timeout: 258 seconds]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
<companion_cube>
if you do numerics, be sure to use bigarrays and not arrays
<Anarchos>
companion_cube i am just reinstalling all my ocaml ecosystem, i will resume my work on my math verifier soon
<companion_cube>
good luck
<Anarchos>
companion_cube for the reinstallation ? or for my verifier ?
<companion_cube>
the verifier :p
<Anarchos>
companion_cube the verifier is almost finisshed
gravicappa has quit [Ping timeout: 268 seconds]
<Anarchos>
octachron I used your trick to use a local compiler, but when i do 'opam switch MYSWITCH' i get the error : Can not set external switch '/Data1/INFORMATIQUE/OCAML/ocaml' globally.
Serpent7776 has quit [Quit: leaving]
gravicappa has joined #ocaml
vicfred has joined #ocaml
gravicappa has quit [Ping timeout: 265 seconds]
olle has quit [Ping timeout: 240 seconds]
dhil has quit [Ping timeout: 240 seconds]
bartholin has quit [Quit: Leaving]
Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]
<d_bot>
<Et7f3> Is their a function that does like `Unix.open_process_args_in` (it avoid invoking shell) but does the lookup in `PATH` or if need to do that ourself ?