Safe Haskell | None |
---|---|
Language | Haskell2010 |
Nominal (named) types declaration, instantiation, construction, and access.
Synopsis
- data NominalDecl typ k = NominalDecl {
- _nParams :: Tree (NomVarTypes typ) QVars
- _nScheme :: Scheme (NomVarTypes typ) typ k
- nParams :: forall typ k. Lens' (NominalDecl typ k) (Tree (NomVarTypes typ) QVars)
- nScheme :: forall typ k k. Lens (NominalDecl typ k) (NominalDecl typ k) (Scheme (NomVarTypes typ) typ k) (Scheme (NomVarTypes typ) typ k)
- data family KWitness k :: (Knot -> Type) -> Type
- data NominalInst nomId varTypes k = NominalInst {
- _nId :: nomId
- _nArgs :: Tree varTypes (QVarInstances (GetKnot k))
- nId :: forall nomId varTypes k nomId. Lens (NominalInst nomId varTypes k) (NominalInst nomId varTypes k) nomId nomId
- nArgs :: forall nomId varTypes k varTypes k. Lens (NominalInst nomId varTypes k) (NominalInst nomId varTypes k) (Tree varTypes (QVarInstances (GetKnot k))) (Tree varTypes (QVarInstances (GetKnot k)))
- data ToNom nomId term k = ToNom {}
- tnId :: forall nomId term k nomId. Lens (ToNom nomId term k) (ToNom nomId term k) nomId nomId
- tnVal :: forall nomId term k term k. Lens (ToNom nomId term k) (ToNom nomId term k) ((#) k term) ((#) k term)
- newtype FromNom nomId (term :: Knot -> *) (k :: Knot) = FromNom nomId
- _FromNom :: forall nomId term k nomId term k. Iso (FromNom nomId term k) (FromNom nomId term k) nomId nomId
- class HasNominalInst nomId typ where
- nominalInst :: Prism' (Tree typ k) (Tree (NominalInst nomId (NomVarTypes typ)) k)
- type family NomVarTypes (t :: Knot -> Type) :: Knot -> Type
- class MonadNominals nomId typ m where
- getNominalDecl :: nomId -> m (Tree (LoadedNominalDecl typ) (UVarOf m))
- data LoadedNominalDecl typ v
- loadNominalDecl :: forall m typ. (Monad m, KTraversable (NomVarTypes typ), KNodesConstraint (NomVarTypes typ) (Unify m), HasScheme (NomVarTypes typ) m typ) => Tree Pure (NominalDecl typ) -> m (Tree (LoadedNominalDecl typ) (UVarOf m))
Documentation
data NominalDecl typ k Source #
A declaration of a nominal type.
NominalDecl | |
|
Instances
nParams :: forall typ k. Lens' (NominalDecl typ k) (Tree (NomVarTypes typ) QVars) Source #
nScheme :: forall typ k k. Lens (NominalDecl typ k) (NominalDecl typ k) (Scheme (NomVarTypes typ) typ k) (Scheme (NomVarTypes typ) typ k) Source #
data family KWitness k :: (Knot -> Type) -> Type Source #
KWitness k n
is a witness that n
is a node of k
Instances
data NominalInst nomId varTypes k Source #
An instantiation of a nominal type
NominalInst | |
|
Instances
KNodes v => KNodes (NominalInst n v) Source # | |
Defined in AST.Term.Nominal type KNodesConstraint (NominalInst n v) c :: Constraint Source # data KWitness (NominalInst n v) a :: Type Source # kLiftConstraint :: KNodesConstraint (NominalInst n v) c => KWitness (NominalInst n v) n0 -> Proxy c -> (c n0 -> r) -> r Source # | |
KFunctor v => KFunctor (NominalInst n v) Source # | |
Defined in AST.Term.Nominal mapK :: (forall (n0 :: Knot -> Type). KWitness (NominalInst n v) n0 -> Tree p n0 -> Tree q n0) -> Tree (NominalInst n v) p -> Tree (NominalInst n v) q Source # | |
KFoldable v => KFoldable (NominalInst n v) Source # | |
Defined in AST.Term.Nominal | |
KTraversable v => KTraversable (NominalInst n v) Source # | |
Defined in AST.Term.Nominal sequenceK :: Applicative f => Tree (NominalInst n v) (ContainedK f p) -> f (Tree (NominalInst n v) p) Source # | |
(Eq nomId, ZipMatch varTypes, KTraversable varTypes, KNodesConstraint varTypes ZipMatch, KNodesConstraint varTypes OrdQVar) => ZipMatch (NominalInst nomId varTypes) Source # | |
Defined in AST.Term.Nominal zipMatch :: Tree (NominalInst nomId varTypes) p -> Tree (NominalInst nomId varTypes) q -> Maybe (Tree (NominalInst nomId varTypes) (Product p q)) Source # | |
Constraints (NominalInst nomId varTypes k) Eq => Eq (NominalInst nomId varTypes k) Source # | |
Defined in AST.Term.Nominal (==) :: NominalInst nomId varTypes k -> NominalInst nomId varTypes k -> Bool # (/=) :: NominalInst nomId varTypes k -> NominalInst nomId varTypes k -> Bool # | |
Constraints (NominalInst nomId varTypes k) Ord => Ord (NominalInst nomId varTypes k) Source # | |
Defined in AST.Term.Nominal compare :: NominalInst nomId varTypes k -> NominalInst nomId varTypes k -> Ordering # (<) :: NominalInst nomId varTypes k -> NominalInst nomId varTypes k -> Bool # (<=) :: NominalInst nomId varTypes k -> NominalInst nomId varTypes k -> Bool # (>) :: NominalInst nomId varTypes k -> NominalInst nomId varTypes k -> Bool # (>=) :: NominalInst nomId varTypes k -> NominalInst nomId varTypes k -> Bool # max :: NominalInst nomId varTypes k -> NominalInst nomId varTypes k -> NominalInst nomId varTypes k # min :: NominalInst nomId varTypes k -> NominalInst nomId varTypes k -> NominalInst nomId varTypes k # | |
Constraints (NominalInst nomId varTypes k) Show => Show (NominalInst nomId varTypes k) Source # | |
Defined in AST.Term.Nominal showsPrec :: Int -> NominalInst nomId varTypes k -> ShowS # show :: NominalInst nomId varTypes k -> String # showList :: [NominalInst nomId varTypes k] -> ShowS # | |
Generic (NominalInst nomId varTypes k) Source # | |
Defined in AST.Term.Nominal type Rep (NominalInst nomId varTypes k) :: Type -> Type # from :: NominalInst nomId varTypes k -> Rep (NominalInst nomId varTypes k) x # to :: Rep (NominalInst nomId varTypes k) x -> NominalInst nomId varTypes k # | |
Constraints (NominalInst nomId varTypes k) Binary => Binary (NominalInst nomId varTypes k) Source # | |
Defined in AST.Term.Nominal put :: NominalInst nomId varTypes k -> Put # get :: Get (NominalInst nomId varTypes k) # putList :: [NominalInst nomId varTypes k] -> Put # | |
Constraints (NominalInst nomId varTypes k) NFData => NFData (NominalInst nomId varTypes k) Source # | |
Defined in AST.Term.Nominal rnf :: NominalInst nomId varTypes k -> () # | |
(Pretty nomId, KApply varTypes, KFoldable varTypes, KNodesConstraint varTypes (PrettyConstraints k)) => Pretty (NominalInst nomId varTypes k) Source # | |
Defined in AST.Term.Nominal pPrintPrec :: PrettyLevel -> Rational -> NominalInst nomId varTypes k -> Doc # pPrint :: NominalInst nomId varTypes k -> Doc # pPrintList :: PrettyLevel -> [NominalInst nomId varTypes k] -> Doc # | |
data KWitness (NominalInst n v) c Source # | |
Defined in AST.Term.Nominal | |
type KNodesConstraint (NominalInst n v) c Source # | |
Defined in AST.Term.Nominal | |
type Rep (NominalInst nomId varTypes k) Source # | |
Defined in AST.Term.Nominal type Rep (NominalInst nomId varTypes k) = D1 (MetaData "NominalInst" "AST.Term.Nominal" "syntax-tree-0.1.0.0-8tfou50n4eQ4Iq1dis9DWN" False) (C1 (MetaCons "NominalInst" PrefixI True) (S1 (MetaSel (Just "_nId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 nomId) :*: S1 (MetaSel (Just "_nArgs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Tree varTypes (QVarInstances (GetKnot k)))))) |
nId :: forall nomId varTypes k nomId. Lens (NominalInst nomId varTypes k) (NominalInst nomId varTypes k) nomId nomId Source #
nArgs :: forall nomId varTypes k varTypes k. Lens (NominalInst nomId varTypes k) (NominalInst nomId varTypes k) (Tree varTypes (QVarInstances (GetKnot k))) (Tree varTypes (QVarInstances (GetKnot k))) Source #
data ToNom nomId term k Source #
Nominal data constructor.
Wrap content with a data constructor (analogues to a data constructor of a Haskell `newtype`'s).
Introduces the nominal's foralled type variables into the value's scope.
Instances
(MonadScopeLevel m, MonadNominals nomId (TypeOf expr) m, KTraversable (NomVarTypes (TypeOf expr)), KNodesConstraint (NomVarTypes (TypeOf expr)) (Unify m), Unify m (TypeOf expr), HasInferredType expr, Infer m expr) => Infer m (ToNom nomId expr) Source # | |
Defined in AST.Term.Nominal inferBody :: Tree (ToNom nomId expr) (InferChild m k) -> m (Tree (ToNom nomId expr) k, Tree (InferOf (ToNom nomId expr)) (UVarOf m)) Source # inferContext :: Proxy m -> Proxy (ToNom nomId expr) -> Dict (KNodesConstraint (ToNom nomId expr) (Infer m), KNodesConstraint (InferOf (ToNom nomId expr)) (Unify m)) Source # | |
KNodes (ToNom nomId term) Source # | |
Defined in AST.Term.Nominal type KNodesConstraint (ToNom nomId term) c :: Constraint Source # kLiftConstraint :: KNodesConstraint (ToNom nomId term) c => KWitness (ToNom nomId term) n -> Proxy c -> (c n -> r) -> r Source # | |
Monoid nomId => KPointed (ToNom nomId term) Source # | |
KFunctor (ToNom nomId term) Source # | |
Semigroup nomId => KApply (ToNom nomId term) Source # | |
KFoldable (ToNom nomId term) Source # | |
KTraversable (ToNom nomId term) Source # | |
Defined in AST.Term.Nominal sequenceK :: Applicative f => Tree (ToNom nomId term) (ContainedK f p) -> f (Tree (ToNom nomId term) p) Source # | |
Constraints (ToNom nomId term k) Eq => Eq (ToNom nomId term k) Source # | |
Constraints (ToNom nomId term k) Ord => Ord (ToNom nomId term k) Source # | |
Defined in AST.Term.Nominal compare :: ToNom nomId term k -> ToNom nomId term k -> Ordering # (<) :: ToNom nomId term k -> ToNom nomId term k -> Bool # (<=) :: ToNom nomId term k -> ToNom nomId term k -> Bool # (>) :: ToNom nomId term k -> ToNom nomId term k -> Bool # (>=) :: ToNom nomId term k -> ToNom nomId term k -> Bool # max :: ToNom nomId term k -> ToNom nomId term k -> ToNom nomId term k # min :: ToNom nomId term k -> ToNom nomId term k -> ToNom nomId term k # | |
Constraints (ToNom nomId term k) Show => Show (ToNom nomId term k) Source # | |
Generic (ToNom nomId term k) Source # | |
Constraints (ToNom nomId term k) Binary => Binary (ToNom nomId term k) Source # | |
Constraints (ToNom nomId term k) NFData => NFData (ToNom nomId term k) Source # | |
Defined in AST.Term.Nominal | |
Constraints (ToNom nomId term k) Pretty => Pretty (ToNom nomId term k) Source # | |
Defined in AST.Term.Nominal pPrintPrec :: PrettyLevel -> Rational -> ToNom nomId term k -> Doc # pPrint :: ToNom nomId term k -> Doc # pPrintList :: PrettyLevel -> [ToNom nomId term k] -> Doc # | |
data KWitness (ToNom nomId term) node Source # | |
Defined in AST.Term.Nominal | |
type InferOf (ToNom n e) Source # | |
Defined in AST.Term.Nominal | |
type KNodesConstraint (ToNom nomId term) constraint Source # | |
Defined in AST.Term.Nominal | |
type Rep (ToNom nomId term k) Source # | |
Defined in AST.Term.Nominal type Rep (ToNom nomId term k) = D1 (MetaData "ToNom" "AST.Term.Nominal" "syntax-tree-0.1.0.0-8tfou50n4eQ4Iq1dis9DWN" False) (C1 (MetaCons "ToNom" PrefixI True) (S1 (MetaSel (Just "_tnId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 nomId) :*: S1 (MetaSel (Just "_tnVal") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (k # term)))) |
tnId :: forall nomId term k nomId. Lens (ToNom nomId term k) (ToNom nomId term k) nomId nomId Source #
tnVal :: forall nomId term k term k. Lens (ToNom nomId term k) (ToNom nomId term k) ((#) k term) ((#) k term) Source #
newtype FromNom nomId (term :: Knot -> *) (k :: Knot) Source #
Access the data in a nominally typed value.
Analogues to a getter of a Haskell `newtype`.
FromNom nomId |
Instances
(Infer m expr, HasNominalInst nomId (TypeOf expr), MonadNominals nomId (TypeOf expr) m, KTraversable (NomVarTypes (TypeOf expr)), KNodesConstraint (NomVarTypes (TypeOf expr)) (Unify m), Unify m (TypeOf expr)) => Infer m (FromNom nomId expr) Source # | |
Defined in AST.Term.Nominal inferBody :: Tree (FromNom nomId expr) (InferChild m k) -> m (Tree (FromNom nomId expr) k, Tree (InferOf (FromNom nomId expr)) (UVarOf m)) Source # inferContext :: Proxy m -> Proxy (FromNom nomId expr) -> Dict (KNodesConstraint (FromNom nomId expr) (Infer m), KNodesConstraint (InferOf (FromNom nomId expr)) (Unify m)) Source # | |
KNodes (FromNom nomId term) Source # | |
Defined in AST.Term.Nominal type KNodesConstraint (FromNom nomId term) c :: Constraint Source # kLiftConstraint :: KNodesConstraint (FromNom nomId term) c => KWitness (FromNom nomId term) n -> Proxy c -> (c n -> r) -> r Source # | |
Monoid nomId => KPointed (FromNom nomId term) Source # | |
KFunctor (FromNom nomId term) Source # | |
Semigroup nomId => KApply (FromNom nomId term) Source # | |
KFoldable (FromNom nomId term) Source # | |
KTraversable (FromNom nomId term) Source # | |
Defined in AST.Term.Nominal sequenceK :: Applicative f => Tree (FromNom nomId term) (ContainedK f p) -> f (Tree (FromNom nomId term) p) Source # | |
Eq nomId => Eq (FromNom nomId term k) Source # | |
Ord nomId => Ord (FromNom nomId term k) Source # | |
Defined in AST.Term.Nominal compare :: FromNom nomId term k -> FromNom nomId term k -> Ordering # (<) :: FromNom nomId term k -> FromNom nomId term k -> Bool # (<=) :: FromNom nomId term k -> FromNom nomId term k -> Bool # (>) :: FromNom nomId term k -> FromNom nomId term k -> Bool # (>=) :: FromNom nomId term k -> FromNom nomId term k -> Bool # max :: FromNom nomId term k -> FromNom nomId term k -> FromNom nomId term k # min :: FromNom nomId term k -> FromNom nomId term k -> FromNom nomId term k # | |
Show nomId => Show (FromNom nomId term k) Source # | |
Generic (FromNom nomId term k) Source # | |
Binary nomId => Binary (FromNom nomId term k) Source # | |
NFData nomId => NFData (FromNom nomId term k) Source # | |
Defined in AST.Term.Nominal | |
data KWitness (FromNom nomId term) node Source # | |
Defined in AST.Term.Nominal | |
type InferOf (FromNom n e) Source # | |
Defined in AST.Term.Nominal | |
type KNodesConstraint (FromNom nomId term) constraint Source # | |
Defined in AST.Term.Nominal | |
type Rep (FromNom nomId term k) Source # | |
Defined in AST.Term.Nominal |
_FromNom :: forall nomId term k nomId term k. Iso (FromNom nomId term k) (FromNom nomId term k) nomId nomId Source #
class HasNominalInst nomId typ where Source #
nominalInst :: Prism' (Tree typ k) (Tree (NominalInst nomId (NomVarTypes typ)) k) Source #
class MonadNominals nomId typ m where Source #
getNominalDecl :: nomId -> m (Tree (LoadedNominalDecl typ) (UVarOf m)) Source #
data LoadedNominalDecl typ v Source #
A nominal declaration loaded into scope in an inference monad.
Instances
loadNominalDecl :: forall m typ. (Monad m, KTraversable (NomVarTypes typ), KNodesConstraint (NomVarTypes typ) (Unify m), HasScheme (NomVarTypes typ) m typ) => Tree Pure (NominalDecl typ) -> m (Tree (LoadedNominalDecl typ) (UVarOf m)) Source #