ungadtagger: Abstract GADTs from typelevel tags

[ bsd3, data, library ] [ Propose Tags ] [ Report a vulnerability ]

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"

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

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 1265 total (1 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]