packages feed

open-typerep-0.3.3: open-typerep.cabal

name:                open-typerep
version:             0.3.3
synopsis:            Open type representations and dynamic types
description:         This package uses Data Types à la Carte to provide open type representations
                     and dynamic types/coercions for open type universes.
                     .
                     Example 1 (dynamic types):
                     .
                     > type MyUniverse = IntType :+: BoolType
                     >
                     > hlist :: [Dynamic MyUniverse]
                     > hlist = [toDyn True, toDyn (1 :: Int)]
                     .
                     > *Main> hlist
                     > [True,1]
                     .
                     Note that if we were using "Data.Dynamic", it would just print
                     .
                     > [<<Bool>>,<<Int>>]
                     .
                     Example 2 (dynamically typed addition):
                     .
                     > addDyn :: (TypeEq ts ts, PWitness Num ts ts) => Dynamic ts -> Dynamic ts -> Maybe (Dynamic ts)
                     > addDyn (Dyn ta a) (Dyn tb b) = do
                     >     Dict <- typeEq ta tb
                     >     Dict <- pwit pNum ta
                     >     return (Dyn ta (a+b))
                     .
                     "Data.Dynamic" could only do this monomorphically, for one 'Num' type at a
                     time.
author:              Emil Axelsson
maintainer:          emax@chalmers.se
copyright:           Copyright (c) 2014, Emil Axelsson
license:             BSD3
license-file:        LICENSE
homepage:            https://github.com/emilaxelsson/open-typerep
bug-reports:         https://github.com/emilaxelsson/open-typerep/issues
category:            Dependent Types
stability:           experimental
build-type:          Simple
cabal-version:       >=1.10

extra-source-files:
  examples/*.hs

source-repository head
  type:     git
  location: https://github.com/emilaxelsson/open-typerep

library
  hs-source-dirs: src

  exposed-modules:
    Data.TypeRep.Internal
    Data.TypeRep
    Data.TypeRep.VarArg

  other-modules:
    Data.TypeRep.Sub

  build-depends:
    base        >=4 && <5,
    constraints >=0.3,
    mtl         >=2.2.1,
      -- Smallest version that has Control.Monad.Except
    syntactic   >=3,
    tagged      >=0.4

  default-language: Haskell2010

  default-extensions:
    ConstraintKinds
    FlexibleContexts
    FlexibleInstances
    GADTs
    MultiParamTypeClasses
    Rank2Types
    ScopedTypeVariables
    TypeFamilies
    TypeOperators

  other-extensions:
    UndecidableInstances,
    OverlappingInstances

test-suite examples
  type: exitcode-stdio-1.0

  hs-source-dirs: examples

  main-is: Simple.hs

  default-language: Haskell2010

  build-depends:
    open-typerep,
    base

  default-language: Haskell2010

  default-extensions:
    FlexibleContexts
    GADTs
    TypeOperators

benchmark dynamic-bench
  type: exitcode-stdio-1.0

  hs-source-dirs: benchmarks

  main-is: Dynamic.hs

  build-depends:
    base,
    criterion >= 1,
    open-typerep

  default-language: Haskell2010

  default-extensions:
    FlexibleInstances
    GADTs
    MultiParamTypeClasses
    TypeOperators

  other-extensions:
    TemplateHaskell