th-tc 0.2.0.0 → 0.2.1.0
raw patch · 2 files changed
+6/−28 lines, 2 filesdep +th-orphansPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: th-orphans
API changes (from Hackage documentation)
- Language.Haskell.TH.Typecheck: instance Language.Haskell.TH.Syntax.Quasi m => Language.Haskell.TH.Syntax.Quasi (Control.Monad.Trans.State.Lazy.StateT s m)
Files
- src/Language/Haskell/TH/Typecheck.hs +4/−27
- th-tc.cabal +2/−1
src/Language/Haskell/TH/Typecheck.hs view
@@ -34,13 +34,14 @@ import Control.Lens import Control.Monad.State.Class import Control.Monad.Trans-import Control.Monad.Trans.State (StateT, evalStateT, liftCatch)+import Control.Monad.Trans.State (StateT, evalStateT) import Data.Foldable import Data.List as L import Data.Maybe import Data.Map as M import Data.Set as S import Language.Haskell.TH+import Language.Haskell.TH.Instances () -- Quasi StateT import Language.Haskell.TH.Syntax hiding (lift) import Numeric.Natural @@ -101,31 +102,6 @@ -- @m ~ 'StateT' 'TcScope' 'Q'@ type MonadTc m = (Quasi m, MonadState TcScope m) -instance Quasi m => Quasi (StateT s m) where- qNewName = lift . qNewName- qReport = (lift .) . qReport- qRecover m r = liftCatch (\m r -> qRecover m $ r ()) m (const r)- qLookupName = (lift .) . qLookupName- qReify = lift . qReify- qReifyFixity = lift . qReifyFixity- qReifyInstances = (lift .) . qReifyInstances- qReifyRoles = lift . qReifyRoles- qReifyAnnotations = lift . qReifyAnnotations- qReifyModule = lift . qReifyModule- qReifyConStrictness = lift . qReifyConStrictness- qLocation = lift qLocation- qRunIO = lift . qRunIO- qAddDependentFile = lift . qAddDependentFile- qAddTempFile = lift . qAddTempFile- qAddTopDecls = lift . qAddTopDecls- qAddForeignFilePath = (lift .) . qAddForeignFilePath- qAddModFinalizer = lift . qAddModFinalizer- qAddCorePlugin = lift . qAddCorePlugin- qGetQ = lift qGetQ- qPutQ = lift . qPutQ- qIsExtEnabled = lift . qIsExtEnabled- qExtsEnabled = lift qExtsEnabled- -- | Execute a typechecker computation. Unificational variables will not persist -- between different 'runTc' blocks. runTc :: Monad m => StateT TcScope m a -> m a@@ -262,7 +238,8 @@ zonkTV tv ty = do isUnifTV tv >>= \case True -> case ty of- VarT tv' | tv == tv' -> tcFail $ "Attempted to zonk a tyvar with itself: " ++ show tv+ VarT tv' | tv == tv'+ -> tcFail $ "Attempted to zonk a tyvar with itself: " ++ show tv _ -> pure () False -> tcFail $ "Attempted to zonk a skolem " ++ show tv use (tsZonkedVars . at tv) >>= \case
th-tc.cabal view
@@ -1,5 +1,5 @@ name: th-tc-version: 0.2.0.0+version: 0.2.1.0 synopsis: Typechecking in Template Haskell description: Typechecking in Template Haskell. homepage: https://github.com/mniip/th-tc@@ -16,6 +16,7 @@ exposed-modules: Language.Haskell.TH.Typecheck build-depends: base >=4.12 && <4.13 , template-haskell >= 2.14+ , th-orphans >= 0.11 , containers >= 0.6 , lens >= 4.0 , transformers >= 0.5