PatternSyns

Safe Haskell | Safe-Inferred
Language | Haskell2010

PatternSyns

Description

Testing some pattern synonyms

Synopsis

- data FooType x = FooCtor x
- pattern Foo :: x -> FooType x
- pattern Bar :: x -> FooType (FooType x)
- pattern (:<->) :: x1 -> x2 -> (FooType x1, FooType (FooType x2))
- data BlubType = forall x.Show x => BlubCtor x
- pattern Blub :: () => Show x => x -> BlubType
- data (a :: *) >< b = Empty
- pattern E :: a >< b
- pattern PatWithExplicitSig :: Eq somex => somex -> FooType somex

# Documentation

data FooType x #

FooType doc

Constructors

FooCtor x |

pattern Foo :: x -> FooType x #

Pattern synonym for `Foo` x

pattern Bar :: x -> FooType (FooType x) #

Pattern synonym for `Bar` x

pattern (:<->) :: x1 -> x2 -> (FooType x1, FooType (FooType x2)) #

Pattern synonym for (`:<->`)

data BlubType #

BlubType is existentially quantified

Constructors

forall x.Show x => BlubCtor x |

pattern Blub :: () => Show x => x -> BlubType #

Pattern synonym for `Blub` x

data (a :: *) >< b #

Doc for (`><`)

Constructors

Empty |

pattern E :: a >< b #

Pattern for `Empty`

pattern PatWithExplicitSig :: Eq somex => somex -> FooType somex #

Earlier ghc versions didn't allow explicit signatures on pattern synonyms.