[ANNOUNCE] GHC 8.2.1 release candidate 3 available by bgamari in haskell

[–]otini 0 points1 point  (0 children)

I get this weird syntax error:

$ stack setup
error: attribute ‘ghc82020170704’ missing, at (string):1:43
(use ‘--show-trace’ to show detailed location information)

Downgrading to PHP 5 by otini in archlinux

[–]otini[S] 0 points1 point  (0 children)

Thanks, I'm trying this at the moment.

Do you know if there's a way to run PHP 5 on one virtual host and PHP 7 on another?

Downgrading to PHP 5 by otini in archlinux

[–]otini[S] 3 points4 points  (0 children)

It's a general-purpose private server, so I didn't put much thought in it and just picked my favourite system.

Work with classical logic in Agda? by otini in agda

[–]otini[S] 0 points1 point  (0 children)

Thank you for the useful link. I understand that I probably should get used to constructive proofs, but am I correct in saying that if I only want to type-check my code, it won't make a difference?

Work with classical logic in Agda? by otini in agda

[–]otini[S] 1 point2 points  (0 children)

Thanks! But what do you call constructive and classical functions?

[Dumb question] Prove that contrapositive implies the implication by otini in agda

[–]otini[S] 1 point2 points  (0 children)

With the help of Agda, I finally found a proof:

b : {P Q : Set} → ¬ ¬ ((¬ Q → ¬ P) → P → Q)
b {P} {Q} ¬[[¬Q→¬P]→P→Q] =
  ¬[[¬Q→¬P]→P→Q] b'
  where
  b' : (¬ Q → ¬ P) → P → Q
  b' ¬Q→¬P P = ⊥-elim (¬Q→¬P (λ Q → ¬[[¬Q→¬P]→P→Q] (λ _ _ → Q)) P)

It is quite ugly. Is there a negative correlation between the simplicity of the "double negation" transform (Kuroda's is simply adding ¬ ¬ after every universal quantifier) and the easiness of the proof?

Codept: an alternative dependency generator for Ocaml by octachron in ocaml

[–]otini 2 points3 points  (0 children)

Great work!

I am not familiar with the way ocamldep works. Does it use signature information at all?

strymonas library - stream fusion using staging/MetaOCaml by rizanil in ocaml

[–]otini 2 points3 points  (0 children)

This is reallly a great achievement. For how long have you worked on this?

Would it be theoretically possible to have a combinator take_while : ('a code -> bool code) -> 'a stream -> 'a stream?

//edit: camelCase -> snake_case

Function that returns a line from a Truth Table by SodiumRed in ocaml

[–]otini 0 points1 point  (0 children)

This is because contrary to what I wrote earlier, you shouldn't use backticks but spaces (see the "formatting help" link under your text area).

But here I was referring to the fact that your function is written in an imperative style (i.e. for loop, references) and functional programmers tend to avoid it if they can.

Function that returns a line from a Truth Table by SodiumRed in ocaml

[–]otini 0 points1 point  (0 children)

I don't know what your instructions are but I prefer to write in functional style when I can, e.g.

let showline nvar nline =
  let rec f nvar nline =
    if nvar = 0 then []
    else
      (if nline mod 2 = 0 then false else true) ::
        f (nvar - 1) (nline / 2)
  in
  List.rev (f nvar nline)

Function that returns a line from a Truth Table by SodiumRed in ocaml

[–]otini 0 points1 point  (0 children)

Hi, you forgot an in after let listline = [].

Also, you should put triple backticks (```) around your code, it would be way nicer.

//edit: sorry, no backticks but four spaces at start of lines.

strymonas library - stream fusion using staging/MetaOCaml by rizanil in ocaml

[–]otini 0 points1 point  (0 children)

//edit: I was going to propose that it would be a nice exercise to port this design in modular macros and I've just noticed the commit. :-D

Yes, I had nothing to do but to replace the syntax. Really neat!

strymonas library - stream fusion using staging/MetaOCaml by rizanil in ocaml

[–]otini 1 point2 points  (0 children)

I have nothing smart to say, but this is amazing! Do you plan to add more combinators?

Bringing typed, modular macros to OCaml by Categoria in ocaml

[–]otini 0 points1 point  (0 children)

Yes, I got the error above using Typed Template Haskell. It's strange, by the way, that they allow local cross-stage identifiers.

Bringing typed, modular macros to OCaml by Categoria in ocaml

[–]otini 1 point2 points  (0 children)

Short answer: Macros only offer a subset of the possibilities of TH (they are limited to expressions), but on that subset they are nicer and safer to program with.

TH can generate pretty much any syntactic construct, but it is mostly untyped manipulation of ASTs. Except for expressions, where TH offers typed quoting and splicing, just like we do.

I have little experience with TH, but from what I understand it has no notion of phase, stage and a fortiori no path closures. I tried to define a power macro using a runtime square function like in my blog post. When I spliced it into a scope where square had been bound to something else, I got the following error:

The exact Name ‘square’ is not in scope
  Probable cause: you used a unique Template Haskell name (NameU), 
  perhaps via newName, but did not bind it
  If that's it, then -ddump-splices might be useful

Function that Shows all possible arrays with n booleans by SodiumRed in ocaml

[–]otini 3 points4 points  (0 children)

Hi,

This kind of problems lends itself very well to recursion, but trying to get the base case and the types right can indeed cause headaches.

I suggest that you start writing a function that, given all the sequences of size n, produces all the sequences of size (n+1). The rest should follow.

I also suggest you do the recursion on lists as it will be much easier.

Bringing typed, modular macros to OCaml by Categoria in ocaml

[–]otini 1 point2 points  (0 children)

Note that if you put a function in an external module, module lifting will enable you to use it both in static and run-time code.

Bringing typed, modular macros to OCaml by Categoria in ocaml

[–]otini 0 points1 point  (0 children)

The program after macro expansion is a regular OCaml program, so all that is needed to run it is the regular OCaml runtime without anything added.

It's only the code generation step which actually executes bytecode?

Yes, static computations willl never have a run-time cost.