Last active
December 20, 2018 16:23
-
-
Save haitlahcen/1dcc8363cef48e554685f1ee8aded69b to your computer and use it in GitHub Desktop.
ViewPattern + PatternSynonyms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pattern (:-) :: Char -> T.Text -> T.Text | |
| pattern x :- xs <- (T.uncons -> Just (x, xs)) | |
| where x :- xs = T.cons x xs | |
| infixr 5 :- | |
| -- No need for (Just (x, (Just (y, ys)), it automatically uncons + desugar | |
| t :: T.Text -> T.Text | |
| t (x :- y :- ys) = ys | |
| t _ = "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment