int-index / union

Extensible type-safe unions for Haskell
BSD 3-Clause "New" or "Revised" License
32 stars 2 forks source link

Pattern synonyms #8

Open int-index opened 6 years ago

int-index commented 6 years ago

U1, U2, U3, U4, ... U16 for Union OU1, OU2, OU3, OU4, ... OU16 for OpenUnion

Generate via TH, taking the amount as a parameter.

int-index commented 6 years ago

Type-indexed patterns:

f = OpenUnion '[Integer, Bool, Char] -> r
f = \case
  OU (a :: Integer) -> ...
  OU (b :: Bool) -> ...
  OU (c :: Char) -> ...