Hacker News new | ask | show | jobs
by afraca 2487 days ago
I applaud Microsoft for popularizing gradual typing , bringing types to the js world is an enormous task, both technical and (js-)societal.

Regarding your syntax criticism: I quite agree. I really really like the path chosen by Haskell. Types are obviously a major part of Haskell, but there you just separate the type signature from the implementation.

  emap :: (DynGraph gr) => (b -> c) -> gr a b -> gr a c
  emap f = gmap (\(p,v,l,s)->(map1 f p,v,l,map1 f s))
    where
      map1 g = map (first g)
(Of course there are other helping things like type synonyms, which TS also supports)

  type UPath   = [UNode]
2 comments

I don't find that remotely readable. By that I mean that nothing in the code gives me the slightest inkling of what kind of command I would type or button I would click, expecting this code to run in response.
There are a lot of languages where even if you don't know that language, you can figure out what's happening. I have no idea what your example is supposed to do.
That's because it's taken from a library that deals with graphs[1]. I had to look it up, because I had no idea what it does either and I know Haskell. Here's a better example of what he meant in Elm, a language that looks a lot like Haskell: https://github.com/bryanjenningz/25-elm-examples/blob/master...

[1]: http://hackage.haskell.org/package/fgl-5.7.0.1/docs/Data-Gra...