typerbole 0.0.0.4 → 0.0.0.5
raw patch · 4 files changed
+12/−58 lines, 4 filesdep ~basedep ~megaparsecdep ~template-haskell
Dependency ranges changed: base, megaparsec, template-haskell, th-lift
Files
- src/Calculi/Lambda/Cube/TH.hs +6/−0
- src/Compiler/Typesystem/Hask.hs +0/−52
- src/Control/Typecheckable.hs +1/−0
- typerbole.cabal +5/−6
src/Calculi/Lambda/Cube/TH.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} module Calculi.Lambda.Cube.TH ( -- sfo sf@@ -11,12 +12,17 @@ import qualified Compiler.Typesystem.SystemF as SF import qualified Compiler.Typesystem.SimplyTyped as STLC import Text.Megaparsec+import Text.Megaparsec.Error import Calculi.Lambda.Cube import Data.List import Control.Monad -- | Lambda Cube parsec type.+#if __GLASGOW_HASKELL__ >= 800+type LCParsec = Parsec Dec String+#else type LCParsec = Parsec String+#endif -- | SystemFOmega with mono and poly types represented as strings. -- type StringSFO = SFO.SystemFOmega String String (Maybe (STLC.SimplyTyped String)) -- | SystemF with mono and poly types represented as strings.
− src/Compiler/Typesystem/Hask.hs
@@ -1,52 +0,0 @@-{-|- Re-export of the type expression AST exposed by TemplateHaskell with instances- of `SimpleType`, `HigherOrder`, and `Polymorphic`.--}-module Compiler.Typesystem.Hask (- Type(..)- , Name(..)-) where--import Language.Haskell.TH.Syntax as TH (Type(..), Name(..), TyVarBndr(..))-import Calculi.Lambda.Cube.HigherOrder-import Calculi.Lambda.Cube.Polymorphic-import Calculi.Lambda.Cube.SimpleType-import Control.Typecheckable-import qualified Data.Set as Set-import Data.Semigroup--instance SimpleType Type where-- type MonoType Type = Name-- abstract a b = (ArrowT `AppT` a) `AppT` b-- reify ((ArrowT `AppT` a) `AppT` b) = Just (a, b)- reify _ = Nothing-- mono = ConT-- bases = \case- ForallT binds _ texpr -> bases texpr- AppT arg ret -> bases arg <> bases ret- SigT texpr _ -> bases texpr- a -> Set.singleton a-- equivalent = areAlphaEquivalent--instance Polymorphic Type where-- type PolyType Type = Name-- substitutions = curry $ \case- (ForallT _ _ texpr1, texpr2) -> substitutions texpr1 texpr2- (texpr1 , ForallT _ _ texpr2) -> substitutions texpr1 texpr2- (SigT texpr1 _ , texpr2) -> substitutions texpr1 texpr2- (texpr1 , SigT texpr2 _) -> substitutions texpr1 texpr2- (VarT v1 , VarT v2) -> Right [Mutual v1 v2]- (VarT v , texpr) -> Right [Substitution texpr v]- (texpr , VarT v) -> Right [Substitution texpr v]- (AppT arg1 ret1 , AppT arg2 ret2) -> substitutions arg1 arg2 <><> substitutions ret1 ret2- (texpr1 , texpr2)- | texpr1 == texpr2 -> Right []- | otherwise -> Left [(texpr1, texpr2)]
src/Control/Typecheckable.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FlexibleContexts #-} {-|
typerbole.cabal view
@@ -1,5 +1,5 @@ name: typerbole-version: 0.0.0.4+version: 0.0.0.5 synopsis: A typeystems library with exaggerated claims description: Please see README.md license: BSD3@@ -36,13 +36,12 @@ , Calculi.Lambda.Cube.HigherOrder , Calculi.Lambda.Cube.Dependent , Calculi.Lambda.Cube.TH- , Compiler.Typesystem.Hask , Compiler.Typesystem.SystemF , Compiler.Typesystem.SystemFOmega , Compiler.Typesystem.SimplyTyped , Control.Typecheckable , Data.Graph.Inductive.Helper- build-depends: base >= 4.7 && < 4.9+ build-depends: base >= 4.7 && < 5 , containers >= 0.5 && < 0.6 , data-ordlist , either@@ -54,9 +53,9 @@ , mtl , generic-random == 0.1.1.0 , lens- , template-haskell < 2.11- , th-lift >= 0.7 && < 0.8- , megaparsec < 5+ , template-haskell+ , th-lift+ , megaparsec , safe ghc-options: -Wall -fno-warn-type-defaults