News for hackers. Stuff that matters.
Re:The Early History of F# [pdf] by Tarean on Friday January 11, 2019 @09:54AM (#18883907)
Pattern synonyms are really expressive but the complex version is kinda headache inducing:

http://hackage.haskell.org/package/lens-4.17/docs/src/Contro...

This creates a bidirectional pattern synonym - you can both match and construct values with it:

    foo :: Cons' s Char => s -> s
    foo (a :< b) = 'c' :< b
    foo other = other
Pattern synonyms make completeness checking undecidable so you need to give manual hints to get a nice api. It also wreaks cost models - is foo O(1) or O(n)?

There are no comments on this comment yet.