types-compat (empty) → 0.1.0
raw patch · 6 files changed
+121/−0 lines, 6 filesdep +basedep +taggedsetup-changed
Dependencies added: base, tagged
Files
- LICENSE +20/−0
- Setup.hs +2/−0
- src/Data/Proxy/Compat.hs +5/−0
- src/Data/Typeable/Compat.hs +22/−0
- src/GHC/TypeLits/Compat.hs +48/−0
- types-compat.cabal +24/−0
+ LICENSE view
@@ -0,0 +1,20 @@+Copyright (c) 2015 HirotomoMoriwaki++Permission is hereby granted, free of charge, to any person obtaining+a copy of this software and associated documentation files (the+"Software"), to deal in the Software without restriction, including+without limitation the rights to use, copy, modify, merge, publish,+distribute, sublicense, and/or sell copies of the Software, and to+permit persons to whom the Software is furnished to do so, subject to+the following conditions:++The above copyright notice and this permission notice shall be included+in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ src/Data/Proxy/Compat.hs view
@@ -0,0 +1,5 @@+module Data.Proxy.Compat+ ( Proxy(..), asProxyTypeOf+ ) where++import Data.Proxy
+ src/Data/Typeable/Compat.hs view
@@ -0,0 +1,22 @@+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE CPP #-}++module Data.Typeable.Compat+ ( Typeable, typeOf+ , cast, gcast+ , TypeRep, showsTypeRep+ , TyCon, tyConString, tyConPackage, tyConModule, tyConName+ , mkTyCon3, mkTyConApp, mkAppTy, mkFunTy+ , splitTyConApp, funResultTy, typeRepTyCon, typeRepArgs+ , typeRep+ , Proxy(..)+ ) where++import Data.Typeable++#if !MIN_VERSION_base(4,7,0)+import Data.Proxy.Compat++typeRep :: forall proxy a. Typeable a => proxy a -> TypeRep+typeRep _ = typeOf (undefined :: a)+#endif
+ src/GHC/TypeLits/Compat.hs view
@@ -0,0 +1,48 @@+{-# LANGUAGE ExistentialQuantification #-}+{-# LANGUAGE UndecidableInstances #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE ExplicitNamespaces #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE KindSignatures #-}+{-# LANGUAGE Rank2Types #-}+{-# LANGUAGE PolyKinds #-}+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE CPP #-}++module GHC.TypeLits.Compat+ ( -- * Kinds+ Nat, Symbol+ -- * Linking type and value level+ , KnownNat, natVal+ , KnownSymbol, symbolVal+ , type (<=)+ , type (<=?)+ , type (+)+ , type (*)+ , type (^)+ ) where++import GHC.TypeLits++#if __GLASGOW_HASKELL__ < 707+data Proxy k = Proxy++class SingI n => KnownNat (n :: Nat) where+ natSing :: Sing n++instance SingRep n Integer => KnownNat n where+ natSing = sing++natVal :: forall n proxy. KnownNat n => proxy n -> Integer+natVal _ = fromSing (natSing :: Sing n)++class SingI n => KnownSymbol (n :: Symbol) where+ symbolSing :: Sing n++instance SingRep n String => KnownSymbol n where+ symbolSing = sing++symbolVal :: forall n proxy. KnownSymbol n => proxy n -> String+symbolVal _ = fromSing (symbolSing :: Sing n)+#endif
+ types-compat.cabal view
@@ -0,0 +1,24 @@+name: types-compat+version: 0.1.0+synopsis: ghc-7.6/7.8 compatible GHC.TypeLits, Data.Typeable and Data.Proxy.+license: MIT+license-file: LICENSE+author: HirotomoMoriwaki<philopon.dependence@gmail.com>+maintainer: HirotomoMoriwaki<philopon.dependence@gmail.com>+Homepage: https://github.com/philopon/apiary+Bug-reports: https://github.com/philopon/apiary/issues+copyright: (c) 2015 Hirotomo Moriwaki+category: Compatibility+build-type: Simple+cabal-version: >=1.10++library+ exposed-modules: GHC.TypeLits.Compat+ Data.Typeable.Compat+ Data.Proxy.Compat+ build-depends: base >=4.6 && <4.8+ if impl(ghc < 7.8)+ build-depends: tagged >= 0.7 && <0.8+ hs-source-dirs: src+ ghc-options: -Wall -O2+ default-language: Haskell2010