lift-type 0.1.1.0 → 0.1.1.1
raw patch · 4 files changed
+19/−5 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- lift-type.cabal +1/−1
- src/LiftType.hs +7/−3
- test/Spec.hs +7/−1
ChangeLog.md view
@@ -1,5 +1,9 @@ # Changelog for lift-typeable +## 0.1.1.1++- Fix lifting the `Data.Kind.Type` into a `TemplateHaskell.Type` [#9](https://github.com/parsonsmatt/lift-type/pull/9)+ ## 0.1.1.0 - Cleanup and a slight performance improvement [#7](https://github.com/parsonsmatt/lift-type/pull/7)
lift-type.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.12 name: lift-type-version: 0.1.1.0+version: 0.1.1.1 description: Lift your types from a Typeable constraint to a Template Haskell type synopsis: Lift a type from a Typeable constraint to a Template Haskell type homepage: https://github.com/parsonsmatt/lift-type#readme
src/LiftType.hs view
@@ -1,9 +1,11 @@ {-# LANGUAGE AllowAmbiguousTypes #-}+{-# LANGUAGE GADTs #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeInType #-}+{-# LANGUAGE TypeOperators #-} -- | Template Haskell has a class 'Lift' that allows you to promote values -- from Haskell-land into the land of metaprogramming - 'Q'.@@ -23,9 +25,8 @@ -- @since 0.1.0.0 module LiftType where -import Control.Applicative-import Data.Char import Data.Foldable (asum)+import qualified Data.Kind as Kind import Data.Maybe (fromMaybe) import Language.Haskell.TH.Syntax import Text.Read (readMaybe)@@ -44,7 +45,10 @@ typeRepToType (SomeTypeRep a) = go a where go :: forall k (a :: k). TypeRep a -> Type- go tr =+ go tr+ | Just HRefl <- eqTypeRep (typeRep @Kind.Type) tr+ = ConT ''Kind.Type+ | otherwise = case tr of Con tyCon -> mk tyCon
test/Spec.hs view
@@ -1,12 +1,18 @@-{-# language TemplateHaskell, DataKinds, TypeApplications #-}+{-# language MagicHash, TemplateHaskell, DataKinds, TypeApplications #-}+ module Main where import LiftType import Data.Proxy+import Data.Kind+import GHC.Exts main :: IO () main = do let+ type_ = Proxy :: Proxy $(liftTypeQ @Type)+ type_' = Proxy :: Proxy $(liftTypeQ @TYPE)+ word# = Proxy :: Proxy $(liftTypeQ @Word#) bool = Proxy :: Proxy $(liftTypeQ @Bool) true = Proxy :: Proxy $(liftTypeQ @'True) three = Proxy :: Proxy $(liftTypeQ @3)