summaryrefslogtreecommitdiff
path: root/testsuite/tests/patsyn/should_run/T14228.hs
blob: 18cddd26bc20a2450add7f4dd08a07fec71d7b2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{-# LANGUAGE UnboxedSums #-}
{-# LANGUAGE PatternSynonyms #-}
module Main where

type Maybe' t = (# t | () #)

pattern Just' :: a -> Maybe' a
pattern Just' x = (# x | #)

pattern Nothing' :: Maybe' a
pattern Nothing' = (# | () #)

foo x = case x of
  Nothing' -> putStrLn "nothing"
  Just' _ -> putStrLn "just"

main = do
  putStrLn "Nothing'"
  foo Nothing'

  putStrLn "Just'"
  foo (Just' "hello")