HNHacker News
TopNewBestAskShowJobs

gcanti

111 karma · joined August 4, 2014

giulio.canti@gmail.com
submissionscomments
gcanti··on Curry-Howard, the Ontological Ultimate
Unfortunately I do not know so well Haskell to give you an answer. I was referring to this:

> I think this is because there is yet to be a language that makes expressing complex types easy.

Since I'm obliged to use a dynamic language (JavaScript) I'm looking for a solution in it. And in JavaScript is really easy to express a complex type, say "the set of all the even integers between 2 and 14 but 10", using runtime checking to enforce the constraints. Is it simple in Haskell to define such a set in its type system?

gcanti··on Curry-Howard, the Ontological Ultimate
Probably you are right, but for a library I think it should be an obligation to provide 100% coverage. For a generic program, maybe I sould provide 100% coverage at least of the "critical paths".
gcanti··on Curry-Howard, the Ontological Ultimate
> I'm generally a proponent of "strongly typed" languages. But I do worry about the cognition overhead the syntax causes, and I do wonder if there is a "better way".

What about dynamic language + runtime type checking + (nearly) 100% test coverage? You get the flexibility of a dynamic language and the safety of a static type language (in fact you get more, since runtime type checking is more powerful).

gcanti··on ReactJS for Stupid People
I think there is no "proper" difference. For what I understand it's only a practical way to have a segregated state only the component is interested of. React.js is a valuable precursor but I hope we'll have something different soon.
gcanti··on Transducers for JavaScript
> "comprehensible" is a relative thing

I agree and I hope my pragmatic side will be disproved soon :)

gcanti··on Transducers for JavaScript
When I see concepts like transducers I'm always torn in two:

my theoretical side is really excited: reducing (pun intended) a bunch of different operations to a minimal set of basic, composable operations is an awesome intellectual challenge. I imagine how succinct, reusable and multipurpose could become my code.

my pragmatic side is skeptic: in functional programming it's a little step to end up with incomprehensible code, for me and my coworkers:

    var inc = function(n) { return n + 1; };
    var isEven = function(n) { return n % 2 == 0; };
    var xf = comp(map(inc), filter(isEven));
    console.log(into([], xf, [0,1,2,3,4])); // [2,4]
vs

    var inc = function(n) { return n + 1; };
    var isEven = function(n) { return n % 2 == 0; };
    [0,1,2,3,4].map(inc).filter(isEven); // [2,4]
The latter is comprehensible by everyone (and no additional library). Ok you iterate twice but if you really (REALLY) have performance problems, maybe you'd end up with something like this:

    var input = [0,1,2,3,4];
    var output = [];
    var x;
    for (var i = 0, len = input.length ; i < len ; i++ ) {
      x = input[i] + 1; // map
      if (x % 2 == 0) ouput.push(x); // filter
    }
gcanti··on Elixir Release v1.0.0
I am very happy, I can not wait to get my hands on
gcanti··on Show HN: Taxa – A tiny language inside JavaScript to enforce type signatures
Lately I've seen on HN a few attempts to add runtime type checking to JavaScript. I'm happy with that, as in my experience adding a bunch of asserts in strategic places can really speed up prototyping and development, you become more confident, and chances are that you can catch bugs earlier. In the same vein I wrote a library that adds runtime type checking based on type combinators [1], check it out, we can share some ideas.

[1] https://github.com/gcanti/tcomb

gcanti··on React Components
Thank you! author here :)

in the next few days I hope to add more constraints. My main concern about react-bootstrap is the massive use of `transferPropsTo`, from what I understand is a deprecated method

gcanti··on What if your domain model could validate the UI for free?
> Looks like there's a typo

Good catch! thank you, I'll fix that asap.

As you've pointed out, I am excited by the opportunity to implement this cycle

    Domain (tcomb.js) --> UI generation (React.js, with validated props)
            ^                                  |
            |                                  |
            |                                  |
            +-------------------------- Input validation
Some example off the top of my head

    |     T    | input                  |
    +----------+------------------------+
    | Str, Num | textbox, textarea      |
    | enums    | select, radio          |
    | struct   | form                   |
    | list(T)  | table of T (recursion) |
← PreviousPage 2 of 2