1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
{-# LANGUAGE PatternSynonyms, BangPatterns, PolyKinds, DataKinds, GADTs,
FlexibleContexts, ViewPatterns #-}
{-# LANGUAGE ExplicitForAll #-}
pattern Single x <- [x]
single :: [a] -> Maybe a
single (Single x) = Just x
single _ = Nothing
pattern Single :: a -> [a]
pattern Single x = [x]
pattern Single :: () => (Show a) => a -> [a]
pattern Single x = [x]
f :: (Show a) => [a] -> a
f (Single x) = x
pattern SinglePair :: (a, a) -> [(a, a)]
pattern SinglePair x = [x]
f :: (Show a) => [(a, a)] -> String
f (SinglePair x) = show x
pattern Q = D
pattern C :: a -> X Maybe (Maybe a)
pattern C x = Y (Just x)
pattern Syn :: forall a b c . () => () => Int
pattern C :: (Show (a, Bool)) => a -> X Maybe (Maybe (a, Bool))
pattern C x = Y (Just (x, True))
pattern P :: T Bool b
pattern P <- MkT True
pattern D :: a -> T (Maybe a) Bool
pattern D x = MkT (Just x)
pattern P a b = Just (a, b)
pattern Single x = [x]
pattern a :+: b = (a, b)
pattern P x <- MkT 42 x
pattern P x y <- MkT x y
pattern P x <- MkT (f -> True) x
data T where
MkT :: b -> (b -> Bool) -> T
pattern P x f <- MkT x f
pattern Single x <- [x]
pattern P <- Just True
pattern P = 42
pattern P = ()
pattern Single x <- [x]
|