language-Modula2 0.1.4 → 0.1.4.1
raw patch · 12 files changed
+40/−27 lines, 12 filesdep ~filepathdep ~template-haskellPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: filepath, template-haskell
API changes (from Hackage documentation)
- Language.Modula2.AST: Case :: f (CaseLabels l l f' f') -> ZipList (f (CaseLabels l l f' f')) -> f (StatementSequence l l f' f') -> Case λ l (f' :: Type -> Type) (f :: Type -> TYPE LiftedRep)
+ Language.Modula2.AST: Case :: f (CaseLabels l l f' f') -> ZipList (f (CaseLabels l l f' f')) -> f (StatementSequence l l f' f') -> Case λ l (f' :: Type -> Type) (f :: Type -> Type)
- Language.Modula2.AST: data Block λ l (f' :: Type -> Type) (f :: Type -> Type)
+ Language.Modula2.AST: data () => Block λ l (f' :: Type -> Type) (f :: Type -> Type)
- Language.Modula2.AST: data Case λ l (f' :: Type -> Type) (f :: Type -> TYPE LiftedRep)
+ Language.Modula2.AST: data () => Case λ l (f' :: Type -> Type) (f :: Type -> Type)
- Language.Modula2.AST: data CaseLabels λ l (f' :: Type -> Type) (f :: Type -> Type)
+ Language.Modula2.AST: data () => CaseLabels λ l (f' :: Type -> Type) (f :: Type -> Type)
- Language.Modula2.AST: data ConditionalBranch λ l (f' :: Type -> Type) (f :: Type -> Type)
+ Language.Modula2.AST: data () => ConditionalBranch λ l (f' :: Type -> Type) (f :: Type -> Type)
- Language.Modula2.AST: data Declaration (full :: Bool) λ l (f' :: * -> *) (f :: * -> *)
+ Language.Modula2.AST: data Declaration (full :: Bool) λ l (f' :: Type -> Type) (f :: Type -> Type)
- Language.Modula2.AST: data Element λ l (f' :: Type -> Type) (f :: Type -> Type)
+ Language.Modula2.AST: data () => Element λ l (f' :: Type -> Type) (f :: Type -> Type)
- Language.Modula2.AST: data FPSection λ l (f' :: Type -> Type) (f :: Type -> Type)
+ Language.Modula2.AST: data () => FPSection λ l (f' :: Type -> Type) (f :: Type -> Type)
- Language.Modula2.AST: data FormalParameters λ l (f' :: Type -> Type) (f :: Type -> Type)
+ Language.Modula2.AST: data () => FormalParameters λ l (f' :: Type -> Type) (f :: Type -> Type)
- Language.Modula2.AST: data RelOp
+ Language.Modula2.AST: data () => RelOp
- Language.Modula2.AST: data Value λ l (f' :: Type -> Type) (f :: Type -> Type)
+ Language.Modula2.AST: data () => Value λ l (f' :: Type -> Type) (f :: Type -> Type)
- Language.Modula2.AST: newtype StatementSequence λ l (f' :: Type -> Type) (f :: Type -> Type)
+ Language.Modula2.AST: newtype () => StatementSequence λ l (f' :: Type -> Type) (f :: Type -> Type)
- Language.Modula2.Abstract: class Wirthy l where {
+ Language.Modula2.Abstract: class () => Wirthy l where {
- Language.Modula2.Abstract: data RelOp
+ Language.Modula2.Abstract: data () => RelOp
- Language.Modula2.Abstract: data WirthySubsetOf l
+ Language.Modula2.Abstract: data () => WirthySubsetOf l
- Language.Modula2.Abstract: newtype Maybe3 (f :: k -> k1 -> k2 -> Type) (a :: k) (b :: k1) (c :: k2)
+ Language.Modula2.Abstract: newtype () => Maybe3 (f :: k -> k1 -> k2 -> Type) (a :: k) (b :: k1) (c :: k2)
- Language.Modula2.Abstract: type Definition l = (d :: * -> (* -> *) -> (* -> *) -> *) | d -> l;
+ Language.Modula2.Abstract: type Definition l = (d :: Type -> (Type -> Type) -> (Type -> Type) -> Type) | d -> l;
- Language.Modula2.Abstract: type Variant l = (v :: * -> (* -> *) -> (* -> *) -> *) | v -> l;
+ Language.Modula2.Abstract: type Variant l = (v :: Type -> (Type -> Type) -> (Type -> Type) -> Type) | v -> l;
- Language.Modula2.ConstantFolder: data ConstantFold
+ Language.Modula2.ConstantFolder: data () => ConstantFold
- Language.Modula2.ConstantFolder: data InhCF l
+ Language.Modula2.ConstantFolder: data () => InhCF l
- Language.Modula2.ConstantFolder: data SynCF a
+ Language.Modula2.ConstantFolder: data () => SynCF a
- Language.Modula2.ConstantFolder: data SynCFDesignator l
+ Language.Modula2.ConstantFolder: data () => SynCFDesignator l
- Language.Modula2.ConstantFolder: data SynCFExp λ l
+ Language.Modula2.ConstantFolder: data () => SynCFExp λ l
- Language.Modula2.ConstantFolder: data SynCFMod l a
+ Language.Modula2.ConstantFolder: data () => SynCFMod l a
- Language.Modula2.Grammar: data Lexeme
+ Language.Modula2.Grammar: data () => Lexeme
- Language.Modula2.Grammar: newtype ParsedLexemes
+ Language.Modula2.Grammar: newtype () => ParsedLexemes
- Language.Modula2.ISO.AST: data Declaration (full :: Bool) λ l (f' :: * -> *) (f :: * -> *)
+ Language.Modula2.ISO.AST: data Declaration (full :: Bool) λ l (f' :: Type -> Type) (f :: Type -> Type)
- Language.Modula2.ISO.Abstract: type AddressedIdent l = (d :: * -> (* -> *) -> (* -> *) -> *) | d -> l;
+ Language.Modula2.ISO.Abstract: type AddressedIdent l = (d :: Type -> (Type -> Type) -> (Type -> Type) -> Type) | d -> l;
- Language.Modula2.ISO.Abstract: type Item l = (i :: * -> (* -> *) -> (* -> *) -> *) | i -> l;
+ Language.Modula2.ISO.Abstract: type Item l = (i :: Type -> (Type -> Type) -> (Type -> Type) -> Type) | i -> l;
- Language.Modula2.ISO.ConstantFolder: data ConstantFold
+ Language.Modula2.ISO.ConstantFolder: data () => ConstantFold
Files
- CHANGELOG.md +5/−0
- app/Parse.hs +4/−3
- language-Modula2.cabal +5/−5
- src/Language/Modula2.hs +2/−1
- src/Language/Modula2/AST.hs +3/−2
- src/Language/Modula2/Abstract.hs +3/−2
- src/Language/Modula2/ConstantFolder.hs +4/−3
- src/Language/Modula2/ISO/AST.hs +3/−2
- src/Language/Modula2/ISO/Abstract.hs +3/−2
- src/Language/Modula2/ISO/ConstantFolder.hs +4/−3
- src/Language/Modula2/ISO/Pretty.hs +2/−2
- src/Language/Modula2/Pretty.hs +2/−2
CHANGELOG.md view
@@ -1,5 +1,10 @@ # Revision history for language-Modula2 +## 0.1.4.1 -- 2024-04-27++* Fixed deprecation warnings+* Bumped the upper bound of `filepath`+ ## 0.1.4 -- 2023-09-26 * Using `OverloadedRecordDot` (GHC >= 9.2) instead of field accessors unsupported by GHC 9.6
app/Parse.hs view
@@ -1,4 +1,5 @@-{-# LANGUAGE FlexibleContexts, FlexibleInstances, RankNTypes, RecordWildCards, ScopedTypeVariables, TypeFamilies #-}+{-# LANGUAGE FlexibleContexts, FlexibleInstances, RankNTypes, RecordWildCards,+ ScopedTypeVariables, TypeFamilies, TypeOperators #-} module Main where @@ -22,8 +23,8 @@ import qualified Transformation.Full as Full import Transformation.AG.Generics (Auto) -import Data.Text.Prettyprint.Doc (Pretty(pretty))-import Data.Text.Prettyprint.Doc.Util (putDocW)+import Prettyprinter (Pretty(pretty))+import Prettyprinter.Util (putDocW) import Control.Monad import Data.Data (Data)
language-Modula2.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.4 name: language-Modula2-version: 0.1.4+version: 0.1.4.1 synopsis: Parser, pretty-printer, and more for the Modula-2 programming language description: The library and the executable supports two versions of the Modula-2 programming language: as described by the@@ -24,10 +24,10 @@ Language.Modula2.ISO.Abstract, Language.Modula2.ISO.AST, Language.Modula2.ISO.Grammar, Language.Modula2.ISO.Pretty, Language.Modula2.ISO.ConstantFolder -- other-modules:- build-depends: base >= 4.16 && < 5, text < 3, containers >= 0.5 && < 1.0, filepath < 1.5, directory < 1.4,+ build-depends: base >= 4.16 && < 5, text < 3, containers >= 0.5 && < 1.0, filepath < 1.6, directory < 1.4, parsers >= 0.12.7 && < 0.13, input-parsers >= 0.2.2 && < 0.4, prettyprinter >= 1.2.1 && < 1.8, rank2classes >= 1.3 && < 1.6, grammatical-parsers >= 0.7 && < 0.8, deep-transformations == 0.2.*,- template-haskell >= 2.11 && < 2.21,+ template-haskell >= 2.11 && < 2.22, language-oberon >= 0.3 && < 0.4 hs-source-dirs: src default-language: Haskell2010@@ -37,7 +37,7 @@ -- other-modules: other-extensions: RankNTypes, RecordWildCards, ScopedTypeVariables, FlexibleInstances, DeriveDataTypeable build-depends: base >= 4.7 && < 5, text, either == 5.*, containers >= 0.5 && < 1.0,- repr-tree-syb < 0.2, filepath < 1.5, prettyprinter,+ repr-tree-syb < 0.2, filepath < 1.6, prettyprinter, rank2classes, grammatical-parsers, deep-transformations, optparse-applicative, language-oberon >= 0.3 && < 0.4,@@ -47,7 +47,7 @@ test-suite examples type: exitcode-stdio-1.0 build-depends: base >= 4.7 && < 5, text, grammatical-parsers,- either == 5.*, directory < 2, filepath < 1.5, prettyprinter,+ either == 5.*, directory < 2, filepath < 1.6, prettyprinter, deep-transformations, tasty >= 0.7, tasty-hunit, language-oberon >= 0.3 && < 0.4,
src/Language/Modula2.hs view
@@ -1,4 +1,5 @@-{-# Language FlexibleContexts, GADTs, OverloadedStrings, ScopedTypeVariables, StandaloneDeriving, TypeFamilies #-}+{-# Language FlexibleContexts, GADTs, OverloadedStrings,+ ScopedTypeVariables, StandaloneDeriving, TypeFamilies, TypeOperators #-} -- | The programming language Modula-2
src/Language/Modula2/AST.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE DeriveDataTypeable, FlexibleContexts, FlexibleInstances, GADTs, DataKinds, InstanceSigs, KindSignatures, MultiParamTypeClasses, UndecidableInstances,- ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TypeFamilies #-}+ ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TypeFamilies, TypeOperators #-} {-# OPTIONS_GHC -Wno-simplifiable-class-constraints #-} -- | Concrete data types for Modula-2 constructs that make up its Abstract Syntax Tree. Every data type from this@@ -19,6 +19,7 @@ import Control.Monad (forM, mapM) import Data.Coerce (coerce) import Data.Data (Data, Typeable)+import qualified Data.Kind as K (Type) import Data.List.NonEmpty import Data.Text (Text) @@ -264,7 +265,7 @@ Show (f (Abstract.Declaration l l f' f')), Show (f (Abstract.Definition l l f' f')), Show (f (Abstract.Block l l f' f'))) => Show (Module λ l f' f) -data Declaration (full :: Bool) λ l (f' :: * -> *) (f :: * -> *) where+data Declaration (full :: Bool) λ l (f' :: K.Type -> K.Type) (f :: K.Type -> K.Type) where ConstantDeclaration :: Abstract.IdentDef l -> f (Abstract.ConstExpression l l f' f') -> Declaration x λ l f' f TypeDeclaration :: Abstract.IdentDef l -> f (Abstract.Type l l f' f') -> Declaration x λ l f' f OpaqueTypeDeclaration :: Abstract.IdentDef l -> Declaration False λ l f' f
src/Language/Modula2/Abstract.hs view
@@ -9,6 +9,7 @@ RelOp(..), WirthySubsetOf(..), Maybe3(..), just3, maybe3, nothing3) where import Data.Data (Data, Typeable)+import qualified Data.Kind as K (Type) import Data.List.NonEmpty import Data.Text (Text) @@ -26,8 +27,8 @@ -- * @f@ wraps all direct children of the node. class Wirthy l => Modula2 l where type Export l = x | x -> l- type Definition l = (d :: * -> (* -> *) -> (* -> *) -> *) | d -> l- type Variant l = (v :: * -> (* -> *) -> (* -> *) -> *) | v -> l+ type Definition l = (d :: K.Type -> (K.Type -> K.Type) -> (K.Type -> K.Type) -> K.Type) | d -> l+ type Variant l = (v :: K.Type -> (K.Type -> K.Type) -> (K.Type -> K.Type) -> K.Type) | v -> l -- Module definitionModule :: Ident -> [Import l'] -> Maybe (Export l') -> [f (Definition l' l' f' f')] -> Module l l' f' f
src/Language/Modula2/ConstantFolder.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE DataKinds, DeriveGeneric, DuplicateRecordFields, FlexibleContexts, FlexibleInstances, InstanceSigs, MultiParamTypeClasses, OverloadedRecordDot, OverloadedStrings, RankNTypes,- ScopedTypeVariables, TypeApplications, TypeFamilies, UndecidableInstances #-}+ ScopedTypeVariables, TypeApplications, TypeFamilies, TypeOperators, UndecidableInstances #-} -- | The main export of this module is the function 'foldConstants' that folds the constants in a Modula-2 AST using -- an attribute grammar. Other exports are helper functions and attribute types that can be reused for other languages@@ -20,6 +20,7 @@ import Data.Functor.Identity (Identity(..)) import Data.Int (Int32) import Data.Foldable (fold)+import Data.Kind (Type) import Data.List.NonEmpty (NonEmpty((:|)), toList) import Data.Map.Lazy (Map) import qualified Data.Map.Lazy as Map@@ -27,7 +28,7 @@ import qualified Data.Text as Text import Foreign.Storable (sizeOf) import GHC.Generics (Generic)-import Data.Text.Prettyprint.Doc (Pretty)+import Prettyprinter (Pretty) import qualified Rank2 import qualified Transformation@@ -209,7 +210,7 @@ argValues = (snd <$>) . foldedValue . syn <$> getZipList args synthesis t (pos, self) (InhCF environment currMod) synthesized = fromOberon (synthesis t (pos, toOberon self) (InhCF environment currMod) $ toOberon synthesized)- where fromJust3 :: forall f a (b :: * -> *) (c :: * -> *). Oberon.Abstract.Maybe3 f a b c -> f a b c+ where fromJust3 :: forall f a (b :: Type -> Type) (c :: Type -> Type). Oberon.Abstract.Maybe3 f a b c -> f a b c fromJust3 (Oberon.Abstract.Maybe3 Nothing) = error ("Modula-2 expression cannot be converted to Oberon at " ++ show pos) fromJust3 (Oberon.Abstract.Maybe3 (Just e)) = e
src/Language/Modula2/ISO/AST.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE DataKinds, DeriveDataTypeable, FlexibleContexts, FlexibleInstances, GADTs, KindSignatures, InstanceSigs, MultiParamTypeClasses, UndecidableInstances,- ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TypeFamilies #-}+ ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TypeFamilies, TypeOperators #-} {-# OPTIONS_GHC -Wno-simplifiable-class-constraints #-} -- | ISO Modula-2 Abstract Syntax Tree definitions@@ -11,6 +11,7 @@ import Control.Monad (forM, mapM) import Data.Coerce (coerce) import Data.Data (Data, Typeable)+import qualified Data.Kind as K (Type) import Data.List.NonEmpty import Data.Text (Text) @@ -274,7 +275,7 @@ single = Single repeated = Repeated -data Declaration (full :: Bool) λ l (f' :: * -> *) (f :: * -> *) where+data Declaration (full :: Bool) λ l (f' :: K.Type -> K.Type) (f :: K.Type -> K.Type) where ConstantDeclaration :: Abstract.IdentDef l -> f (Abstract.ConstExpression l l f' f') -> Declaration x λ l f' f TypeDeclaration :: Abstract.IdentDef l -> f (Abstract.Type l l f' f') -> Declaration x λ l f' f OpaqueTypeDeclaration :: Abstract.IdentDef l -> Declaration False λ l f' f
src/Language/Modula2/ISO/Abstract.hs view
@@ -7,6 +7,7 @@ module Language.Modula2.ISO.Abstract (Modula2(..)) where import Data.Data (Data, Typeable)+import qualified Data.Kind as K (Type) import Data.List.NonEmpty import Data.Text (Text) @@ -15,8 +16,8 @@ -- | The additional finally-tagless associated types and methods relevant to the ISO Modula-2 language. class Report.Modula2 l => Modula2 l where- type AddressedIdent l = (d :: * -> (* -> *) -> (* -> *) -> *) | d -> l- type Item l = (i :: * -> (* -> *) -> (* -> *) -> *) | i -> l+ type AddressedIdent l = (d :: K.Type -> (K.Type -> K.Type) -> (K.Type -> K.Type) -> K.Type) | d -> l+ type Item l = (i :: K.Type -> (K.Type -> K.Type) -> (K.Type -> K.Type) -> K.Type) | i -> l -- Declaration emptyVariant :: Variant l l' f' f
src/Language/Modula2/ISO/ConstantFolder.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE DataKinds, DuplicateRecordFields, FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, OverloadedRecordDot, OverloadedStrings, RankNTypes,- ScopedTypeVariables, TypeApplications, TypeFamilies, UndecidableInstances #-}+ ScopedTypeVariables, TypeApplications, TypeFamilies, TypeOperators, UndecidableInstances #-} -- | The main export of this module is the function 'foldConstants' that folds the constants in an ISO Modula-2 AST -- using an attribute grammar. Other exports are helper functions and attribute types that can be reused for other@@ -17,6 +17,7 @@ import Data.Functor.Identity (Identity(..)) import Data.Int (Int32) import Data.Foldable (fold)+import qualified Data.Kind as K (Type) import Data.List.NonEmpty (toList) import Data.Map.Lazy (Map) import Data.Maybe (fromMaybe)@@ -24,7 +25,7 @@ import Data.Semigroup (Semigroup(..)) import qualified Data.Text as Text import Foreign.Storable (sizeOf)-import Data.Text.Prettyprint.Doc (Pretty)+import Prettyprinter (Pretty) import qualified Rank2 import qualified Transformation@@ -203,7 +204,7 @@ foldedValue= Nothing} synthesis t (pos, self) (InhCF environment currMod) synthesized = fromReport (synthesis t (pos, toReport self) (InhCF environment currMod) $ toReport synthesized)- where fromJust :: forall f a (b :: * -> *) (c :: * -> *). Oberon.Abstract.Maybe3 f a b c -> f a b c+ where fromJust :: forall f a (b :: K.Type -> K.Type) (c :: K.Type -> K.Type). Oberon.Abstract.Maybe3 f a b c -> f a b c fromJust (Oberon.Abstract.Maybe3 Nothing) = error ("Modula-2 expression cannot be converted from ISO to Report at " ++ show pos) fromJust (Oberon.Abstract.Maybe3 (Just e)) = e
src/Language/Modula2/ISO/Pretty.hs view
@@ -12,8 +12,8 @@ import Data.List (intersperse) import Data.List.NonEmpty (NonEmpty((:|)), fromList, toList) import qualified Data.Text as Text-import Data.Text.Prettyprint.Doc-import Data.Text.Prettyprint.Doc.Render.Text (renderStrict)+import Prettyprinter+import Prettyprinter.Render.Text (renderStrict) import qualified Language.Oberon.Abstract import qualified Language.Oberon.AST
src/Language/Modula2/Pretty.hs view
@@ -11,8 +11,8 @@ import Data.List (intersperse) import Data.List.NonEmpty (NonEmpty((:|)), fromList, toList) import qualified Data.Text as Text-import Data.Text.Prettyprint.Doc-import Data.Text.Prettyprint.Doc.Render.Text (renderStrict)+import Prettyprinter+import Prettyprinter.Render.Text (renderStrict) import Numeric (showHex, showOct) import qualified Language.Oberon.Abstract