ungadtagger: Abstract GADTs from typelevel tags

[ bsd3, data, library ] [ Propose 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
    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)
    xs = map untag [ConA "A1..", ConA "A2.."]
    ys = map untag [ConB [ConA "A3.."], ConC 456]

-- > "A1..A2..A3..456"
Versions [faq] 1.0.0
Dependencies base (==4.*) [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 Sun Sep 30 07:20:26 UTC 2012
Distributions NixOS:1.0.0
Downloads 662 total (7 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs uploaded by user
Build status unknown [no reports yet]




Maintainer's Corner

For package maintainers and hackage trustees