-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pattern Synonyms for Return
and :>>=
#17
Comments
Return
and `Return
and :>>=
Looks intriguing! Is it really necessary for the pattern synonym to be all caps? Since which version of GHC are pattern synonyms supported? I would like to add a conditional to keep backwards compatibility with older compilers. |
The names I chose are tentative due to a chronic lack of imagination, conditional usage in #if __GLASGOW_HASKELL__ >= 710
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ViewPatterns #-}
#endif #if __GLASGOW_HASKELL__ >= 710
-- * Pattern Synonyms
, pattern Wrapped
, pattern Unwrapped
#endif (note #if __GLASGOW_HASKELL__ >= 710
pattern Wrapped a <- (view _Wrapped -> a) where
Wrapped a = review _Wrapped a
pattern Unwrapped a <- (view _Unwrapped -> a) where
Unwrapped a = review _Unwrapped a
#endif |
They may be made (explicitly) bidirectional like the |
Hm, I would very much like to name the patterns |
|
Any more thoughts about introducing pattern synonyms? |
It seems that pattern synonyms would only be useful for |
Bikeshed names.
The text was updated successfully, but these errors were encountered: