packages feed

typecheck-plugin-nat-simple 0.1.0.6 → 0.1.0.7

raw patch · 4 files changed

+18/−4 lines, 4 files

Files

src/Plugin/TypeCheck/Nat/Simple.hs view
@@ -27,8 +27,9 @@ --   >		=<< (,) <$> (givens =<< decodeAll gs) <*> (wanted =<< decode w)  plugin :: Plugin-plugin = typeCheckWith @L "Plugin.TypeCheck.Nat.Simple" \occ gs _ w -> do+plugin = typeCheckWith @L "Plugin.TypeCheck.Nat.Simple" \occ gs d w -> do 	tell @L $ "givens: " .+. fromSDoc (ppr gs)+	tell @L $ "derived: " .+. fromSDoc (ppr d) 	tell @L $ "wanted: " .+. fromSDoc (ppr w) 	uncurry canDerive 		=<< (,) <$> (givens =<< decodeAll occ gs) <*> (wanted =<< decode occ w)
src/Plugin/TypeCheck/Nat/Simple/TypeCheckWith.hs view
@@ -7,7 +7,7 @@  import GHC.Plugins ( 	Plugin(..), defaultPlugin, Expr(..), mkUnivCo,-	Outputable, ppr, text )+	Outputable, ppr, text, (<+>) ) import GHC.Tc.Plugin (TcPluginM, tcPluginTrace) import GHC.Tc.Types (TcPlugin(..), TcPluginResult(..)) import GHC.Tc.Types.Constraint (Ct)@@ -35,6 +35,9 @@ solve hd ck gs ds ws = do 	occ <- lookupOrdCondCompare 	let	(rs, lgs) = gatherSuccess $ result hd (ck occ) gs ds <$> ws+	tcPluginTrace hd $ "given:" <+> ppr gs+	tcPluginTrace hd $ "derived:" <+> ppr ds+	tcPluginTrace hd $ "wanted:" <+> ppr ws 	TcPluginOk rs [] <$ tcPluginTrace hd (ppr lgs)  result :: (Monoid s, IsSDoc e) =>
test/log.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE DataKinds, TypeOperators #-} {-# LANGUAGE GADTs #-}+{-# LANGUAGE AllowAmbiguousTypes #-} {-# OPTIONS_GHC -Wall -fno-warn-tabs -fplugin=Plugin.TypeCheck.Nat.Simple #-}  import GHC.TypeNats@@ -7,6 +8,15 @@  foo :: 1 <= n => Proxy (n - 1 + 1) -> Proxy (n + 1 - 1) foo = id++bar :: 1 <= a => Proxy (a + 1 - 1) -> Proxy (a - 1 + 1)+bar = id++baz :: 1 <= b => Proxy (a + b) -> Proxy ((a + 1) + (b - 1))+baz = id++hoge :: Proxy (a - 1) -> Proxy (a - 1)+hoge = id  main :: IO () main = putStrLn "test log"
typecheck-plugin-nat-simple.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 9d3e7b7255f2ce97474e8b3dbff13024a62015ddc7be0b9dd257e53422ce1268+-- hash: 7c7a77c61a65eb7d1ae7ea587abd73eedd98ba5f304d8c1af71be691bfc1810b  name:           typecheck-plugin-nat-simple-version:        0.1.0.6+version:        0.1.0.7 synopsis:       Simple type check plugin which calculate addition, subtraction and less-or-equal-than description:    Please see the README on GitHub at <https://github.com/YoshikuniJujo/typecheck-plugin-nat-simple#readme> category:       Compiler Plugin