News for hackers. Stuff that matters.
Re:Open-sourcing Facebook Infer: Identify bugs before you ship by pcwalton on Thursday June 11, 2015 @02:20PM (#9701347)
Re:Open-sourcing Facebook Infer: Identify bugs before you ship by tikhonj on Thursday June 11, 2015 @02:44PM (#9701476)
On the flipside, Haskell just got pattern synonyms[1] which are incredibly useful for being able to refactor and work with abstract types.

It also has view patterns which are quite useful. I don't know how to replicate that in OCaml.

Combining the two lets types expose fairly sophisticated interfaces as normal patterns, which is incredibly useful for things like graphs.

[1]: https://downloads.haskell.org/~ghc/latest/docs/html/users_gu...

Re:Open-sourcing Facebook Infer: Identify bugs before you ship by barosl on Thursday June 11, 2015 @03:03PM (#9701617)
I'm mildly surprised, why isn't this a thing in Haskell? Can't it be easily added, considering an or pattern is trivially expanded to two (or more) patterns?
Re:Open-sourcing Facebook Infer: Identify bugs before you ship by dragonwriter on Thursday June 11, 2015 @04:34PM (#9702211)
> Can't it be easily added, considering an or pattern is trivially expanded to two (or more) patterns?

At least limited support has been done as a library providing a quasiquoter [0], and there is an open ticket for it as a ghc feature. [1]

[0] https://hackage.haskell.org/package/OrPatterns-0.1/docs/OrPa...

[1] https://ghc.haskell.org/trac/ghc/ticket/3919

Re:Open-sourcing Facebook Infer: Identify bugs before you ship by marijn on Thursday June 11, 2015 @03:44PM (#9701858)
I've been surprised/annoyed by this as well. My conclusion was that there are no practical problems that would make this hard, and it is most likely held back simply by the theoretical trivialness of it (what academic wants to work on something that doesn't make a good paper?).
Re:Open-sourcing Facebook Infer: Identify bugs before you ship by pcwalton on Thursday June 11, 2015 @04:16PM (#9702091)
I've heard that or-patterns can result in superlinear blowup in the number of cases, which is why Haskell compilers have not implemented it so far.
Re:Open-sourcing Facebook Infer: Identify bugs before you ship by thoughtpolice on Thursday June 11, 2015 @07:57PM (#9703193)
As far as I know, that's never really been a reason as to why we haven't implemented it in GHC. It's much more likely just that nobody has ever gotten around to implementing it. Shouldn't be especially hard, I imagine.
Re:Open-sourcing Facebook Infer: Identify bugs before you ship by gohrt on Thursday June 11, 2015 @08:46PM (#9703367)
How so? There's one case per branch. It's no more blowup than writing out the branches by hand would be.