blob: 3e87bfc07821c8e48f43a12849661f4c4ee1f113 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
{-# LANGUAGE LinearTypes #-}
{-# LANGUAGE PatternSynonyms #-}
module LinearPatSyn where
-- Linearity and pattern synonyms should eventually play well together, but it
-- seems to require changes to the desugarer. So currently pattern synonyms are
-- disallowed in linear patterns.
pattern P :: b %1 -> a %1 -> (a, b)
pattern P y x = (x, y)
s :: (a, b) %1 -> (b, a)
s (P y x) = (y, x)
|