ungadtagger: Abstract GADTs from typelevel tags
UnGADTagger encapsulates abstraction-from-GADT-tag workflow by utilizing existentials, rank2-types and kind polymorphism.
An example:
# LANGUAGE GADTs, DataKinds, KindSignatures, LambdaCase #
import Data.GADT.Untagged
data Tag = A | B
data Gadt :: Tag -> * where
ConA :: String -> Gadt A
ConB :: [Gadt A] -> Gadt B
ConC :: Integer -> Gadt B
foo :: something -> [Untagged Gadt] -> String
foo _ = quux
where
quux = concat . map baz
baz x = match x $ \case
ConA s -> s
ConB xs -> quux (map untag xs)
ConC i -> show i
test = foo "some cfg for e.g." (xs ++ ys)
where
xs = map untag [ConA "A1..", ConA "A2.."]
ys = map untag [ConB [ConA "A3.."], ConC 456]
-- > "A1..A2..A3..456"
Downloads
- ungadtagger-1.0.0.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
| Versions [RSS] | 1.0.0 |
|---|---|
| Dependencies | base (>=4 && <5) [details] |
| License | BSD-3-Clause |
| Copyright | (c) 2012 Andriy Polishchuk |
| Author | Andriy Polishchuk |
| Maintainer | Andriy Polishchuk <andriy.s.polishchuk@gmail.com> |
| Category | Data |
| Home page | http://github.com/andriyp/ungadtagger |
| Bug tracker | http://github.com/andriyp/ungadtagger/issues |
| Source repo | head: git clone git://github.com/andriyp/ungadtagger.git |
| Uploaded | by AndriyPolishchuk at 2012-09-30T07:20:26Z |
| Distributions | NixOS:1.0.0 |
| Reverse Dependencies | 1 direct, 0 indirect [details] |
| Downloads | 1300 total (3 in the last 30 days) |
| Rating | (no votes yet) [estimated by Bayesian average] |
| Your Rating | |
| Status | Docs uploaded by user Build status unknown [no reports yet] |