Add a testcase for PatternSynonym decls (needs fixing)

pull/287/head
Lennart Spitzner 2020-03-21 21:43:45 +01:00
parent 2d07900005
commit b546b514b0
1 changed files with 20 additions and 0 deletions

View File

@ -126,6 +126,26 @@ pattern myLeftVariableName `MyInfixPatternMatcher` myRightVariableName <-
pattern J :: a -> Maybe a
pattern J x = Just x
#test pattern synonym multiple cases
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ViewPatterns #-}
pattern Signed x <- (asSigned -> x) where
Signed (Neg x) = -x
Signed Zero = 0
Signed (Pos x) = x
#test pattern synonym multiple cases with comments
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ViewPatterns #-}
pattern Signed x <- (asSigned -> x) where
Signed (Neg x) = -x -- negative comment
Signed Zero = 0 -- zero comment
Signed (Pos x) = x -- positive comment
#test Pattern synonym types multiple names
{-# LANGUAGE PatternSynonyms #-}
pattern J, K :: a -> Maybe a
#test Pattern synonym type sig wrapped
{-# LANGUAGE PatternSynonyms #-}
pattern LongMatcher