-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | PureScript Programming Language Abstract Syntax Tree -- -- Defines the underlying syntax of the PureScript Programming Language. @package purescript-ast @version 0.1.1.0 -- | Fresh variable supply module Control.Monad.Supply newtype SupplyT m a SupplyT :: StateT Integer m a -> SupplyT m a [unSupplyT] :: SupplyT m a -> StateT Integer m a runSupplyT :: Integer -> SupplyT m a -> m (a, Integer) evalSupplyT :: Functor m => Integer -> SupplyT m a -> m a type Supply = SupplyT Identity runSupply :: Integer -> Supply a -> (a, Integer) evalSupply :: Integer -> Supply a -> a instance GHC.Base.MonadPlus m => GHC.Base.MonadPlus (Control.Monad.Supply.SupplyT m) instance GHC.Base.MonadPlus m => GHC.Base.Alternative (Control.Monad.Supply.SupplyT m) instance Control.Monad.Reader.Class.MonadReader r m => Control.Monad.Reader.Class.MonadReader r (Control.Monad.Supply.SupplyT m) instance Control.Monad.Writer.Class.MonadWriter w m => Control.Monad.Writer.Class.MonadWriter w (Control.Monad.Supply.SupplyT m) instance Control.Monad.Error.Class.MonadError e m => Control.Monad.Error.Class.MonadError e (Control.Monad.Supply.SupplyT m) instance Control.Monad.Trans.Class.MonadTrans Control.Monad.Supply.SupplyT instance GHC.Base.Monad m => GHC.Base.Monad (Control.Monad.Supply.SupplyT m) instance GHC.Base.Monad m => GHC.Base.Applicative (Control.Monad.Supply.SupplyT m) instance GHC.Base.Functor m => GHC.Base.Functor (Control.Monad.Supply.SupplyT m) -- | A class for monads supporting a supply of fresh names module Control.Monad.Supply.Class class Monad m => MonadSupply m fresh :: MonadSupply m => m Integer peek :: MonadSupply m => m Integer fresh :: (MonadSupply m, MonadTrans t, MonadSupply n, m ~ t n) => m Integer peek :: (MonadSupply m, MonadTrans t, MonadSupply n, m ~ t n) => m Integer freshName :: MonadSupply m => m Text instance GHC.Base.Monad m => Control.Monad.Supply.Class.MonadSupply (Control.Monad.Supply.SupplyT m) instance Control.Monad.Supply.Class.MonadSupply m => Control.Monad.Supply.Class.MonadSupply (Control.Monad.Trans.State.Lazy.StateT s m) instance (GHC.Base.Monoid w, Control.Monad.Supply.Class.MonadSupply m) => Control.Monad.Supply.Class.MonadSupply (Control.Monad.Trans.Writer.Lazy.WriterT w m) -- | Defines the types of source code comments module Language.PureScript.Comments data Comment LineComment :: Text -> Comment BlockComment :: Text -> Comment instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Comments.Comment instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Comments.Comment instance GHC.Generics.Generic Language.PureScript.Comments.Comment instance GHC.Classes.Ord Language.PureScript.Comments.Comment instance GHC.Classes.Eq Language.PureScript.Comments.Comment instance GHC.Show.Show Language.PureScript.Comments.Comment instance Control.DeepSeq.NFData Language.PureScript.Comments.Comment instance Codec.Serialise.Class.Serialise Language.PureScript.Comments.Comment -- | Source position information module Language.PureScript.AST.SourcePos -- | Source annotation - position information and comments. type SourceAnn = (SourceSpan, [Comment]) -- | Source position information data SourcePos SourcePos :: Int -> Int -> SourcePos -- | Line number [sourcePosLine] :: SourcePos -> Int -- | Column number [sourcePosColumn] :: SourcePos -> Int displaySourcePos :: SourcePos -> Text displaySourcePosShort :: SourcePos -> Text data SourceSpan SourceSpan :: String -> SourcePos -> SourcePos -> SourceSpan -- | Source name [spanName] :: SourceSpan -> String -- | Start of the span [spanStart] :: SourceSpan -> SourcePos -- | End of the span [spanEnd] :: SourceSpan -> SourcePos displayStartEndPos :: SourceSpan -> Text displayStartEndPosShort :: SourceSpan -> Text displaySourceSpan :: FilePath -> SourceSpan -> Text internalModuleSourceSpan :: String -> SourceSpan nullSourceSpan :: SourceSpan nullSourceAnn :: SourceAnn pattern NullSourceSpan :: SourceSpan pattern NullSourceAnn :: SourceAnn nonEmptySpan :: SourceAnn -> Maybe SourceSpan widenSourceSpan :: SourceSpan -> SourceSpan -> SourceSpan widenSourceAnn :: SourceAnn -> SourceAnn -> SourceAnn instance Codec.Serialise.Class.Serialise Language.PureScript.AST.SourcePos.SourcePos instance Control.DeepSeq.NFData Language.PureScript.AST.SourcePos.SourcePos instance GHC.Generics.Generic Language.PureScript.AST.SourcePos.SourcePos instance GHC.Classes.Ord Language.PureScript.AST.SourcePos.SourcePos instance GHC.Classes.Eq Language.PureScript.AST.SourcePos.SourcePos instance GHC.Show.Show Language.PureScript.AST.SourcePos.SourcePos instance Codec.Serialise.Class.Serialise Language.PureScript.AST.SourcePos.SourceSpan instance Control.DeepSeq.NFData Language.PureScript.AST.SourcePos.SourceSpan instance GHC.Generics.Generic Language.PureScript.AST.SourcePos.SourceSpan instance GHC.Classes.Ord Language.PureScript.AST.SourcePos.SourceSpan instance GHC.Classes.Eq Language.PureScript.AST.SourcePos.SourceSpan instance GHC.Show.Show Language.PureScript.AST.SourcePos.SourceSpan instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.AST.SourcePos.SourceSpan instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.AST.SourcePos.SourceSpan instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.AST.SourcePos.SourcePos instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.AST.SourcePos.SourcePos module Language.PureScript.Crash -- | A compatibility wrapper for the GHC.Stack.HasCallStack -- constraint. type HasCallStack = HasCallStack -- | Exit with an error message and a crash report link. internalError :: HasCallStack => String -> a -- | Operators fixity and associativity module Language.PureScript.AST.Operators -- | A precedence level for an infix operator type Precedence = Integer -- | Associativity for infix operators data Associativity Infixl :: Associativity Infixr :: Associativity Infix :: Associativity showAssoc :: Associativity -> String readAssoc :: String -> Associativity -- | Fixity data for infix operators data Fixity Fixity :: Associativity -> Precedence -> Fixity instance GHC.Generics.Generic Language.PureScript.AST.Operators.Associativity instance GHC.Classes.Ord Language.PureScript.AST.Operators.Associativity instance GHC.Classes.Eq Language.PureScript.AST.Operators.Associativity instance GHC.Show.Show Language.PureScript.AST.Operators.Associativity instance GHC.Generics.Generic Language.PureScript.AST.Operators.Fixity instance GHC.Classes.Ord Language.PureScript.AST.Operators.Fixity instance GHC.Classes.Eq Language.PureScript.AST.Operators.Fixity instance GHC.Show.Show Language.PureScript.AST.Operators.Fixity instance Control.DeepSeq.NFData Language.PureScript.AST.Operators.Fixity instance Codec.Serialise.Class.Serialise Language.PureScript.AST.Operators.Fixity instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.AST.Operators.Fixity instance Control.DeepSeq.NFData Language.PureScript.AST.Operators.Associativity instance Codec.Serialise.Class.Serialise Language.PureScript.AST.Operators.Associativity instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.AST.Operators.Associativity instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.AST.Operators.Associativity -- | Data types for names module Language.PureScript.Names -- | A sum of the possible name types, useful for error and lint messages. data Name IdentName :: Ident -> Name ValOpName :: OpName 'ValueOpName -> Name TyName :: ProperName 'TypeName -> Name TyOpName :: OpName 'TypeOpName -> Name DctorName :: ProperName 'ConstructorName -> Name TyClassName :: ProperName 'ClassName -> Name ModName :: ModuleName -> Name getIdentName :: Name -> Maybe Ident getValOpName :: Name -> Maybe (OpName 'ValueOpName) getTypeName :: Name -> Maybe (ProperName 'TypeName) getTypeOpName :: Name -> Maybe (OpName 'TypeOpName) getDctorName :: Name -> Maybe (ProperName 'ConstructorName) getClassName :: Name -> Maybe (ProperName 'ClassName) getModName :: Name -> Maybe ModuleName -- | Names for value identifiers data Ident -- | An alphanumeric identifier Ident :: Text -> Ident -- | A generated name for an identifier GenIdent :: Maybe Text -> Integer -> Ident -- | A generated name used only for type-checking UnusedIdent :: Ident runIdent :: Ident -> Text showIdent :: Ident -> Text freshIdent :: MonadSupply m => Text -> m Ident freshIdent' :: MonadSupply m => m Ident -- | Operator alias names. newtype OpName (a :: OpNameType) OpName :: Text -> OpName (a :: OpNameType) [runOpName] :: OpName (a :: OpNameType) -> Text showOp :: OpName a -> Text -- | The closed set of operator alias types. data OpNameType ValueOpName :: OpNameType TypeOpName :: OpNameType AnyOpName :: OpNameType eraseOpName :: OpName a -> OpName 'AnyOpName coerceOpName :: OpName a -> OpName b -- | Proper names, i.e. capitalized names for e.g. module names, type//data -- constructors. newtype ProperName (a :: ProperNameType) ProperName :: Text -> ProperName (a :: ProperNameType) [runProperName] :: ProperName (a :: ProperNameType) -> Text -- | The closed set of proper name types. data ProperNameType TypeName :: ProperNameType ConstructorName :: ProperNameType ClassName :: ProperNameType Namespace :: ProperNameType -- | Coerces a ProperName from one ProperNameType to another. This should -- be used with care, and is primarily used to convert ClassNames into -- TypeNames after classes have been desugared. coerceProperName :: ProperName a -> ProperName b -- | Module names newtype ModuleName ModuleName :: Text -> ModuleName runModuleName :: ModuleName -> Text moduleNameFromString :: Text -> ModuleName isBuiltinModuleName :: ModuleName -> Bool -- | A qualified name, i.e. a name with an optional module name data Qualified a Qualified :: Maybe ModuleName -> a -> Qualified a showQualified :: (a -> Text) -> Qualified a -> Text getQual :: Qualified a -> Maybe ModuleName -- | Provide a default module name, if a name is unqualified qualify :: ModuleName -> Qualified a -> (ModuleName, a) -- | Makes a qualified value from a name and module name. mkQualified :: a -> ModuleName -> Qualified a -- | Remove the module name from a qualified name disqualify :: Qualified a -> a -- | Remove the qualification from a value when it is qualified with a -- particular module name. disqualifyFor :: Maybe ModuleName -> Qualified a -> Maybe a -- | Checks whether a qualified value is actually qualified with a module -- reference isQualified :: Qualified a -> Bool -- | Checks whether a qualified value is not actually qualified with a -- module reference isUnqualified :: Qualified a -> Bool -- | Checks whether a qualified value is qualified with a particular module isQualifiedWith :: ModuleName -> Qualified a -> Bool instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Names.Ident instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Names.Ident instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Names.ModuleName instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Names.ModuleName instance Data.Aeson.Types.ToJSON.ToJSONKey Language.PureScript.Names.ModuleName instance Data.Aeson.Types.FromJSON.FromJSONKey Language.PureScript.Names.ModuleName instance Data.Aeson.Types.ToJSON.ToJSON a => Data.Aeson.Types.ToJSON.ToJSON (Language.PureScript.Names.Qualified a) instance Data.Aeson.Types.FromJSON.FromJSON a => Data.Aeson.Types.FromJSON.FromJSON (Language.PureScript.Names.Qualified a) instance GHC.Generics.Generic Language.PureScript.Names.Ident instance GHC.Classes.Ord Language.PureScript.Names.Ident instance GHC.Classes.Eq Language.PureScript.Names.Ident instance GHC.Show.Show Language.PureScript.Names.Ident instance GHC.Generics.Generic (Language.PureScript.Names.OpName a) instance GHC.Classes.Ord (Language.PureScript.Names.OpName a) instance GHC.Classes.Eq (Language.PureScript.Names.OpName a) instance GHC.Show.Show (Language.PureScript.Names.OpName a) instance GHC.Generics.Generic (Language.PureScript.Names.ProperName a) instance GHC.Classes.Ord (Language.PureScript.Names.ProperName a) instance GHC.Classes.Eq (Language.PureScript.Names.ProperName a) instance GHC.Show.Show (Language.PureScript.Names.ProperName a) instance Codec.Serialise.Class.Serialise Language.PureScript.Names.ModuleName instance GHC.Generics.Generic Language.PureScript.Names.ModuleName instance GHC.Classes.Ord Language.PureScript.Names.ModuleName instance GHC.Classes.Eq Language.PureScript.Names.ModuleName instance GHC.Show.Show Language.PureScript.Names.ModuleName instance GHC.Generics.Generic Language.PureScript.Names.Name instance GHC.Show.Show Language.PureScript.Names.Name instance GHC.Classes.Ord Language.PureScript.Names.Name instance GHC.Classes.Eq Language.PureScript.Names.Name instance GHC.Generics.Generic (Language.PureScript.Names.Qualified a) instance Data.Traversable.Traversable Language.PureScript.Names.Qualified instance Data.Foldable.Foldable Language.PureScript.Names.Qualified instance GHC.Base.Functor Language.PureScript.Names.Qualified instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.Names.Qualified a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.Names.Qualified a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.Names.Qualified a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.PureScript.Names.Qualified a) instance Codec.Serialise.Class.Serialise a => Codec.Serialise.Class.Serialise (Language.PureScript.Names.Qualified a) instance Control.DeepSeq.NFData Language.PureScript.Names.Name instance Codec.Serialise.Class.Serialise Language.PureScript.Names.Name instance Control.DeepSeq.NFData Language.PureScript.Names.ModuleName instance Control.DeepSeq.NFData (Language.PureScript.Names.ProperName a) instance Codec.Serialise.Class.Serialise (Language.PureScript.Names.ProperName a) instance Data.Aeson.Types.ToJSON.ToJSON (Language.PureScript.Names.ProperName a) instance Data.Aeson.Types.FromJSON.FromJSON (Language.PureScript.Names.ProperName a) instance Control.DeepSeq.NFData (Language.PureScript.Names.OpName a) instance Codec.Serialise.Class.Serialise (Language.PureScript.Names.OpName a) instance Data.Aeson.Types.ToJSON.ToJSON (Language.PureScript.Names.OpName a) instance Data.Aeson.Types.FromJSON.FromJSON (Language.PureScript.Names.OpName a) instance Control.DeepSeq.NFData Language.PureScript.Names.Ident instance Codec.Serialise.Class.Serialise Language.PureScript.Names.Ident -- | Various constants which refer to things in Prim module Language.PureScript.Constants.Prim undefined :: forall a. IsString a => a partial :: forall a. IsString a => a pattern Prim :: ModuleName pattern Partial :: Qualified (ProperName 'ClassName) pattern Record :: Qualified (ProperName 'TypeName) pattern Type :: Qualified (ProperName 'TypeName) pattern Constraint :: Qualified (ProperName 'TypeName) pattern Function :: Qualified (ProperName 'TypeName) pattern Array :: Qualified (ProperName 'TypeName) pattern Row :: Qualified (ProperName 'TypeName) pattern PrimBoolean :: ModuleName booleanTrue :: Qualified (ProperName 'TypeName) booleanFalse :: Qualified (ProperName 'TypeName) pattern PrimCoerce :: ModuleName pattern Coercible :: Qualified (ProperName 'ClassName) pattern PrimOrdering :: ModuleName orderingLT :: Qualified (ProperName 'TypeName) orderingEQ :: Qualified (ProperName 'TypeName) orderingGT :: Qualified (ProperName 'TypeName) pattern PrimRow :: ModuleName pattern RowUnion :: Qualified (ProperName 'ClassName) pattern RowNub :: Qualified (ProperName 'ClassName) pattern RowCons :: Qualified (ProperName 'ClassName) pattern RowLacks :: Qualified (ProperName 'ClassName) pattern PrimRowList :: ModuleName pattern RowToList :: Qualified (ProperName 'ClassName) pattern RowListNil :: Qualified (ProperName 'TypeName) pattern RowListCons :: Qualified (ProperName 'TypeName) pattern PrimSymbol :: ModuleName pattern SymbolCompare :: Qualified (ProperName 'ClassName) pattern SymbolAppend :: Qualified (ProperName 'ClassName) pattern SymbolCons :: Qualified (ProperName 'ClassName) pattern PrimTypeError :: ModuleName pattern Fail :: Qualified (ProperName 'ClassName) pattern Warn :: Qualified (ProperName 'ClassName) primModules :: [ModuleName] typ :: forall a. IsString a => a kindBoolean :: forall a. IsString a => a kindOrdering :: forall a. IsString a => a kindRowList :: forall a. IsString a => a symbol :: forall a. IsString a => a doc :: forall a. IsString a => a row :: forall a. IsString a => a constraint :: forall a. IsString a => a prim :: forall a. IsString a => a moduleBoolean :: forall a. IsString a => a moduleCoerce :: forall a. IsString a => a moduleOrdering :: forall a. IsString a => a moduleRow :: forall a. IsString a => a moduleRowList :: forall a. IsString a => a moduleSymbol :: forall a. IsString a => a typeError :: forall a. IsString a => a module Language.PureScript.PSString -- | Strings in PureScript are sequences of UTF-16 code units, which do not -- necessarily represent UTF-16 encoded text. For example, it is -- permissible for a string to contain *lone surrogates,* i.e. characters -- in the range U+D800 to U+DFFF which do not appear as a part of a -- surrogate pair. -- -- The Show instance for PSString produces a string literal which would -- represent the same data were it inserted into a PureScript source -- file. -- -- Because JSON parsers vary wildly in terms of how they deal with lone -- surrogates in JSON strings, the ToJSON instance for PSString produces -- JSON strings where that would be safe (i.e. when there are no lone -- surrogates), and arrays of UTF-16 code units (integers) otherwise. data PSString toUTF16CodeUnits :: PSString -> [Word16] -- | Attempt to decode a PSString as UTF-16 text. This will fail (returning -- Nothing) if the argument contains lone surrogates. decodeString :: PSString -> Maybe Text -- | Decode a PSString as UTF-16. Lone surrogates in the input are -- represented in the output with the Left constructor; characters which -- were successfully decoded are represented with the Right constructor. decodeStringEither :: PSString -> [Either Word16 Char] -- | Decode a PSString as UTF-16 text. Lone surrogates will be replaced -- with U+FFFD REPLACEMENT CHARACTER decodeStringWithReplacement :: PSString -> String -- | Pretty print a PSString, using PureScript escape sequences. prettyPrintString :: PSString -> Text -- | Pretty print a PSString, using JavaScript escape sequences. Intended -- for use in compiled JS output. prettyPrintStringJS :: PSString -> Text mkString :: Text -> PSString instance GHC.Generics.Generic Language.PureScript.PSString.PSString instance GHC.Base.Monoid Language.PureScript.PSString.PSString instance GHC.Base.Semigroup Language.PureScript.PSString.PSString instance GHC.Classes.Ord Language.PureScript.PSString.PSString instance GHC.Classes.Eq Language.PureScript.PSString.PSString instance Control.DeepSeq.NFData Language.PureScript.PSString.PSString instance Codec.Serialise.Class.Serialise Language.PureScript.PSString.PSString instance GHC.Show.Show Language.PureScript.PSString.PSString instance Data.String.IsString Language.PureScript.PSString.PSString instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.PSString.PSString instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.PSString.PSString module Language.PureScript.Label -- | Labels are used as record keys and row entry names. Labels newtype -- PSString because records are indexable by PureScript strings at -- runtime. newtype Label Label :: PSString -> Label [runLabel] :: Label -> PSString instance GHC.Generics.Generic Language.PureScript.Label.Label instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Label.Label instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Label.Label instance GHC.Base.Monoid Language.PureScript.Label.Label instance GHC.Base.Semigroup Language.PureScript.Label.Label instance Data.String.IsString Language.PureScript.Label.Label instance GHC.Classes.Ord Language.PureScript.Label.Label instance GHC.Classes.Eq Language.PureScript.Label.Label instance GHC.Show.Show Language.PureScript.Label.Label instance Control.DeepSeq.NFData Language.PureScript.Label.Label instance Codec.Serialise.Class.Serialise Language.PureScript.Label.Label -- | The core functional representation for literal values. module Language.PureScript.AST.Literals -- | Data type for literal values. Parameterised so it can be used for -- Exprs and Binders. data Literal a -- | A numeric literal NumericLiteral :: Either Integer Double -> Literal a -- | A string literal StringLiteral :: PSString -> Literal a -- | A character literal CharLiteral :: Char -> Literal a -- | A boolean literal BooleanLiteral :: Bool -> Literal a -- | An array literal ArrayLiteral :: [a] -> Literal a -- | An object literal ObjectLiteral :: [(PSString, a)] -> Literal a instance GHC.Base.Functor Language.PureScript.AST.Literals.Literal instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.AST.Literals.Literal a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Language.PureScript.AST.Literals.Literal a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Language.PureScript.AST.Literals.Literal a) -- | Data types for roles. module Language.PureScript.Roles -- | The role of a type constructor's parameter. data Role -- | This parameter's identity affects the representation of the type it is -- parameterising. Nominal :: Role -- | This parameter's representation affects the representation of the type -- it is parameterising. Representational :: Role -- | This parameter has no effect on the representation of the type it is -- parameterising. Phantom :: Role displayRole :: Role -> Text instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Roles.Role instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Roles.Role instance GHC.Generics.Generic Language.PureScript.Roles.Role instance GHC.Classes.Ord Language.PureScript.Roles.Role instance GHC.Classes.Eq Language.PureScript.Roles.Role instance GHC.Show.Show Language.PureScript.Roles.Role instance Control.DeepSeq.NFData Language.PureScript.Roles.Role instance Codec.Serialise.Class.Serialise Language.PureScript.Roles.Role -- | Common functions for implementing generic traversals module Language.PureScript.Traversals fstM :: Functor f => (a -> f c) -> (a, b) -> f (c, b) sndM :: Functor f => (b -> f c) -> (a, b) -> f (a, c) thirdM :: Functor f => (c -> f d) -> (a, b, c) -> f (a, b, d) pairM :: Applicative f => (a -> f c) -> (b -> f d) -> (a, b) -> f (c, d) maybeM :: Applicative f => (a -> f b) -> Maybe a -> f (Maybe b) eitherM :: Applicative f => (a -> f c) -> (b -> f d) -> Either a b -> f (Either c d) defS :: Monad m => st -> val -> m (st, val) -- | Data types for types module Language.PureScript.Types type SourceType = Type SourceAnn type SourceConstraint = Constraint SourceAnn -- | An identifier for the scope of a skolem variable newtype SkolemScope SkolemScope :: Int -> SkolemScope [runSkolemScope] :: SkolemScope -> Int -- | The type of types data Type a -- | A unification variable of type Type TUnknown :: a -> Int -> Type a -- | A named type variable TypeVar :: a -> Text -> Type a -- | A type-level string TypeLevelString :: a -> PSString -> Type a -- | A type wildcard, as would appear in a partial type synonym TypeWildcard :: a -> Maybe Text -> Type a -- | A type constructor TypeConstructor :: a -> Qualified (ProperName 'TypeName) -> Type a -- | A type operator. This will be desugared into a type constructor during -- the "operators" phase of desugaring. TypeOp :: a -> Qualified (OpName 'TypeOpName) -> Type a -- | A type application TypeApp :: a -> Type a -> Type a -> Type a -- | Explicit kind application KindApp :: a -> Type a -> Type a -> Type a -- | Forall quantifier ForAll :: a -> Text -> Maybe (Type a) -> Type a -> Maybe SkolemScope -> Type a -- | A type with a set of type class constraints ConstrainedType :: a -> Constraint a -> Type a -> Type a -- | A skolem constant Skolem :: a -> Text -> Maybe (Type a) -> Int -> SkolemScope -> Type a -- | An empty row REmpty :: a -> Type a -- | A non-empty row RCons :: a -> Label -> Type a -> Type a -> Type a -- | A type with a kind annotation KindedType :: a -> Type a -> Type a -> Type a -- | Binary operator application. During the rebracketing phase of -- desugaring, this data constructor will be removed. BinaryNoParensType :: a -> Type a -> Type a -> Type a -> Type a -- | Explicit parentheses. During the rebracketing phase of desugaring, -- this data constructor will be removed. -- -- Note: although it seems this constructor is not used, it _is_ useful, -- since it prevents certain traversals from matching. ParensInType :: a -> Type a -> Type a srcTUnknown :: Int -> SourceType srcTypeVar :: Text -> SourceType srcTypeLevelString :: PSString -> SourceType srcTypeWildcard :: SourceType srcTypeConstructor :: Qualified (ProperName 'TypeName) -> SourceType srcTypeOp :: Qualified (OpName 'TypeOpName) -> SourceType srcTypeApp :: SourceType -> SourceType -> SourceType srcKindApp :: SourceType -> SourceType -> SourceType srcForAll :: Text -> Maybe SourceType -> SourceType -> Maybe SkolemScope -> SourceType srcConstrainedType :: SourceConstraint -> SourceType -> SourceType srcREmpty :: SourceType srcRCons :: Label -> SourceType -> SourceType -> SourceType srcKindedType :: SourceType -> SourceType -> SourceType srcBinaryNoParensType :: SourceType -> SourceType -> SourceType -> SourceType srcParensInType :: SourceType -> SourceType pattern REmptyKinded :: forall a. a -> Maybe (Type a) -> Type a toREmptyKinded :: forall a. Type a -> Maybe (a, Maybe (Type a)) isREmpty :: forall a. Type a -> Bool -- | Additional data relevant to type class constraints data ConstraintData -- | Data to accompany a Partial constraint generated by the exhaustivity -- checker. It contains (rendered) binder information for those binders -- which were not matched, and a flag indicating whether the list was -- truncated or not. Note: we use Text here because using -- Binder would introduce a cyclic dependency in the module -- graph. PartialConstraintData :: [[Text]] -> Bool -> ConstraintData -- | A typeclass constraint data Constraint a Constraint :: a -> Qualified (ProperName 'ClassName) -> [Type a] -> [Type a] -> Maybe ConstraintData -> Constraint a -- | constraint annotation [constraintAnn] :: Constraint a -> a -- | constraint class name [constraintClass] :: Constraint a -> Qualified (ProperName 'ClassName) -- | kind arguments [constraintKindArgs] :: Constraint a -> [Type a] -- | type arguments [constraintArgs] :: Constraint a -> [Type a] -- | additional data relevant to this constraint [constraintData] :: Constraint a -> Maybe ConstraintData srcConstraint :: Qualified (ProperName 'ClassName) -> [SourceType] -> [SourceType] -> Maybe ConstraintData -> SourceConstraint mapConstraintArgs :: ([Type a] -> [Type a]) -> Constraint a -> Constraint a overConstraintArgs :: Functor f => ([Type a] -> f [Type a]) -> Constraint a -> f (Constraint a) mapConstraintKindArgs :: ([Type a] -> [Type a]) -> Constraint a -> Constraint a overConstraintKindArgs :: Functor f => ([Type a] -> f [Type a]) -> Constraint a -> f (Constraint a) mapConstraintArgsAll :: ([Type a] -> [Type a]) -> Constraint a -> Constraint a overConstraintArgsAll :: Applicative f => ([Type a] -> f [Type a]) -> Constraint a -> f (Constraint a) constraintDataToJSON :: ConstraintData -> Value constraintToJSON :: (a -> Value) -> Constraint a -> Value typeToJSON :: forall a. (a -> Value) -> Type a -> Value constraintDataFromJSON :: Value -> Parser ConstraintData constraintFromJSON :: forall a. Parser a -> (Value -> Parser a) -> Value -> Parser (Constraint a) typeFromJSON :: forall a. Parser a -> (Value -> Parser a) -> Value -> Parser (Type a) data RowListItem a RowListItem :: a -> Label -> Type a -> RowListItem a [rowListAnn] :: RowListItem a -> a [rowListLabel] :: RowListItem a -> Label [rowListType] :: RowListItem a -> Type a srcRowListItem :: Label -> SourceType -> RowListItem SourceAnn -- | Convert a row to a list of pairs of labels and types rowToList :: Type a -> ([RowListItem a], Type a) -- | Convert a row to a list of pairs of labels and types, sorted by the -- labels. rowToSortedList :: Type a -> ([RowListItem a], Type a) -- | Convert a list of labels and types to a row rowFromList :: ([RowListItem a], Type a) -> Type a -- | Align two rows of types, splitting them into three parts: -- -- -- -- Note: importantly, we preserve the order of the types with a given -- label. alignRowsWith :: (Type a -> Type a -> r) -> Type a -> Type a -> ([r], (([RowListItem a], Type a), ([RowListItem a], Type a))) -- | Check whether a type is a monotype isMonoType :: Type a -> Bool -- | Universally quantify a type mkForAll :: [(a, (Text, Maybe (Type a)))] -> Type a -> Type a -- | Replace a type variable, taking into account variable shadowing replaceTypeVars :: Text -> Type a -> Type a -> Type a -- | Replace named type variables with types replaceAllTypeVars :: [(Text, Type a)] -> Type a -> Type a -- | Collect all type variables appearing in a type usedTypeVariables :: Type a -> [Text] -- | Collect all free type variables appearing in a type freeTypeVariables :: Type a -> [Text] -- | Collect a complete set of kind-annotated quantifiers at the front of a -- type. completeBinderList :: Type a -> Maybe ([(a, (Text, Type a))], Type a) -- | Universally quantify over all type variables appearing free in a type quantify :: Type a -> Type a -- | Move all universal quantifiers to the front of a type moveQuantifiersToFront :: Type a -> Type a -- | Check if a type contains wildcards containsWildcards :: Type a -> Bool -- | Check if a type contains forall containsForAll :: Type a -> Bool unknowns :: Type a -> IntSet containsUnknowns :: Type a -> Bool eraseKindApps :: Type a -> Type a eraseForAllKindAnnotations :: Type a -> Type a unapplyTypes :: Type a -> (Type a, [Type a], [Type a]) unapplyConstraints :: Type a -> ([Constraint a], Type a) everywhereOnTypes :: (Type a -> Type a) -> Type a -> Type a everywhereOnTypesTopDown :: (Type a -> Type a) -> Type a -> Type a everywhereOnTypesM :: Monad m => (Type a -> m (Type a)) -> Type a -> m (Type a) everywhereWithScopeOnTypesM :: Monad m => Set Text -> (Set Text -> Type a -> m (Type a)) -> Type a -> m (Type a) everywhereOnTypesTopDownM :: Monad m => (Type a -> m (Type a)) -> Type a -> m (Type a) everythingOnTypes :: (r -> r -> r) -> (Type a -> r) -> Type a -> r everythingWithContextOnTypes :: s -> r -> (r -> r -> r) -> (s -> Type a -> (s, r)) -> Type a -> r annForType :: Lens' (Type a) a getAnnForType :: Type a -> a setAnnForType :: a -> Type a -> Type a eqType :: Type a -> Type b -> Bool eqMaybeType :: Maybe (Type a) -> Maybe (Type b) -> Bool compareType :: Type a -> Type b -> Ordering compareMaybeType :: Maybe (Type a) -> Maybe (Type b) -> Ordering eqConstraint :: Constraint a -> Constraint b -> Bool compareConstraint :: Constraint a -> Constraint b -> Ordering instance GHC.Generics.Generic Language.PureScript.Types.SkolemScope instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Types.SkolemScope instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Types.SkolemScope instance GHC.Classes.Ord Language.PureScript.Types.SkolemScope instance GHC.Classes.Eq Language.PureScript.Types.SkolemScope instance GHC.Show.Show Language.PureScript.Types.SkolemScope instance GHC.Generics.Generic Language.PureScript.Types.ConstraintData instance GHC.Classes.Ord Language.PureScript.Types.ConstraintData instance GHC.Classes.Eq Language.PureScript.Types.ConstraintData instance GHC.Show.Show Language.PureScript.Types.ConstraintData instance Data.Traversable.Traversable Language.PureScript.Types.Type instance Data.Foldable.Foldable Language.PureScript.Types.Type instance GHC.Base.Functor Language.PureScript.Types.Type instance GHC.Generics.Generic (Language.PureScript.Types.Type a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.Types.Type a) instance Data.Traversable.Traversable Language.PureScript.Types.Constraint instance Data.Foldable.Foldable Language.PureScript.Types.Constraint instance GHC.Base.Functor Language.PureScript.Types.Constraint instance GHC.Generics.Generic (Language.PureScript.Types.Constraint a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.Types.Constraint a) instance Data.Traversable.Traversable Language.PureScript.Types.RowListItem instance Data.Foldable.Foldable Language.PureScript.Types.RowListItem instance GHC.Base.Functor Language.PureScript.Types.RowListItem instance GHC.Generics.Generic (Language.PureScript.Types.RowListItem a) instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.Types.RowListItem a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.PureScript.Types.Type a) instance Codec.Serialise.Class.Serialise a => Codec.Serialise.Class.Serialise (Language.PureScript.Types.Type a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Language.PureScript.Types.Constraint a) instance Codec.Serialise.Class.Serialise a => Codec.Serialise.Class.Serialise (Language.PureScript.Types.Constraint a) instance Data.Aeson.Types.ToJSON.ToJSON a => Data.Aeson.Types.ToJSON.ToJSON (Language.PureScript.Types.Type a) instance Data.Aeson.Types.ToJSON.ToJSON a => Data.Aeson.Types.ToJSON.ToJSON (Language.PureScript.Types.Constraint a) instance Data.Aeson.Types.FromJSON.FromJSON (Language.PureScript.Types.Type Language.PureScript.AST.SourcePos.SourceAnn) instance Data.Aeson.Types.FromJSON.FromJSON (Language.PureScript.Types.Type ()) instance Data.Aeson.Types.FromJSON.FromJSON a => Data.Aeson.Types.FromJSON.FromJSON (Language.PureScript.Types.Type a) instance Data.Aeson.Types.FromJSON.FromJSON (Language.PureScript.Types.Constraint Language.PureScript.AST.SourcePos.SourceAnn) instance Data.Aeson.Types.FromJSON.FromJSON (Language.PureScript.Types.Constraint ()) instance Data.Aeson.Types.FromJSON.FromJSON a => Data.Aeson.Types.FromJSON.FromJSON (Language.PureScript.Types.Constraint a) instance GHC.Classes.Eq (Language.PureScript.Types.Type a) instance GHC.Classes.Ord (Language.PureScript.Types.Type a) instance GHC.Classes.Eq (Language.PureScript.Types.Constraint a) instance GHC.Classes.Ord (Language.PureScript.Types.Constraint a) instance Control.DeepSeq.NFData Language.PureScript.Types.ConstraintData instance Codec.Serialise.Class.Serialise Language.PureScript.Types.ConstraintData instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Types.ConstraintData instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Types.ConstraintData instance Control.DeepSeq.NFData Language.PureScript.Types.SkolemScope instance Codec.Serialise.Class.Serialise Language.PureScript.Types.SkolemScope module Language.PureScript.TypeClassDictionaries data TypeClassDictionaryInScope v TypeClassDictionaryInScope :: [Qualified Ident] -> Integer -> v -> [(Qualified (ProperName 'ClassName), Integer)] -> Qualified (ProperName 'ClassName) -> [(Text, SourceType)] -> [SourceType] -> [SourceType] -> Maybe [SourceConstraint] -> TypeClassDictionaryInScope v -- | The instance chain [tcdChain] :: TypeClassDictionaryInScope v -> [Qualified Ident] -- | Index of the instance chain [tcdIndex] :: TypeClassDictionaryInScope v -> Integer -- | The value with which the dictionary can be accessed at runtime [tcdValue] :: TypeClassDictionaryInScope v -> v -- | How to obtain this instance via superclass relationships [tcdPath] :: TypeClassDictionaryInScope v -> [(Qualified (ProperName 'ClassName), Integer)] -- | The name of the type class to which this type class instance applies [tcdClassName] :: TypeClassDictionaryInScope v -> Qualified (ProperName 'ClassName) -- | Quantification of type variables in the instance head and dependencies [tcdForAll] :: TypeClassDictionaryInScope v -> [(Text, SourceType)] -- | The kinds to which this type class instance applies [tcdInstanceKinds] :: TypeClassDictionaryInScope v -> [SourceType] -- | The types to which this type class instance applies [tcdInstanceTypes] :: TypeClassDictionaryInScope v -> [SourceType] -- | Type class dependencies which must be satisfied to construct this -- dictionary [tcdDependencies] :: TypeClassDictionaryInScope v -> Maybe [SourceConstraint] type NamedDict = TypeClassDictionaryInScope (Qualified Ident) -- | Generate a name for a superclass reference which can be used in -- generated code. superclassName :: Qualified (ProperName 'ClassName) -> Integer -> Text instance GHC.Generics.Generic (Language.PureScript.TypeClassDictionaries.TypeClassDictionaryInScope v) instance Data.Traversable.Traversable Language.PureScript.TypeClassDictionaries.TypeClassDictionaryInScope instance Data.Foldable.Foldable Language.PureScript.TypeClassDictionaries.TypeClassDictionaryInScope instance GHC.Base.Functor Language.PureScript.TypeClassDictionaries.TypeClassDictionaryInScope instance GHC.Show.Show v => GHC.Show.Show (Language.PureScript.TypeClassDictionaries.TypeClassDictionaryInScope v) instance Control.DeepSeq.NFData v => Control.DeepSeq.NFData (Language.PureScript.TypeClassDictionaries.TypeClassDictionaryInScope v) module Language.PureScript.Environment -- | The Environment defines all values and types which are -- currently in scope: data Environment Environment :: Map (Qualified Ident) (SourceType, NameKind, NameVisibility) -> Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) -> Map (Qualified (ProperName 'ConstructorName)) (DataDeclType, ProperName 'TypeName, SourceType, [Ident]) -> Map (Qualified (ProperName 'TypeName)) [Role] -> Map (Qualified (ProperName 'TypeName)) ([(Text, Maybe SourceType)], SourceType) -> Map (Maybe ModuleName) (Map (Qualified (ProperName 'ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict))) -> Map (Qualified (ProperName 'ClassName)) TypeClassData -> Environment -- | Values currently in scope [names] :: Environment -> Map (Qualified Ident) (SourceType, NameKind, NameVisibility) -- | Type names currently in scope [types] :: Environment -> Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) -- | Data constructors currently in scope, along with their associated type -- constructor name, argument types and return type. [dataConstructors] :: Environment -> Map (Qualified (ProperName 'ConstructorName)) (DataDeclType, ProperName 'TypeName, SourceType, [Ident]) -- | Explicit role declarations currently in scope. Note that this field is -- only used to store declared roles temporarily until they can be -- checked; to find a type's real checked and/or inferred roles, refer to -- the TypeKind in the types field. [roleDeclarations] :: Environment -> Map (Qualified (ProperName 'TypeName)) [Role] -- | Type synonyms currently in scope [typeSynonyms] :: Environment -> Map (Qualified (ProperName 'TypeName)) ([(Text, Maybe SourceType)], SourceType) -- | Available type class dictionaries. When looking up Nothing in -- the outer map, this returns the map of type class dictionaries in -- local scope (ie dictionaries brought in by a constrained type). [typeClassDictionaries] :: Environment -> Map (Maybe ModuleName) (Map (Qualified (ProperName 'ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict))) -- | Type classes [typeClasses] :: Environment -> Map (Qualified (ProperName 'ClassName)) TypeClassData -- | Information about a type class data TypeClassData TypeClassData :: [(Text, Maybe SourceType)] -> [(Ident, SourceType)] -> [SourceConstraint] -> [FunctionalDependency] -> Set Int -> Set (Set Int) -> Bool -> TypeClassData -- | A list of type argument names, and their kinds, where kind annotations -- were provided. [typeClassArguments] :: TypeClassData -> [(Text, Maybe SourceType)] -- | A list of type class members and their types. Type arguments listed -- above are considered bound in these types. [typeClassMembers] :: TypeClassData -> [(Ident, SourceType)] -- | A list of superclasses of this type class. Type arguments listed above -- are considered bound in the types appearing in these constraints. [typeClassSuperclasses] :: TypeClassData -> [SourceConstraint] -- | A list of functional dependencies for the type arguments of this -- class. [typeClassDependencies] :: TypeClassData -> [FunctionalDependency] -- | A set of indexes of type argument that are fully determined by other -- arguments via functional dependencies. This can be computed from both -- typeClassArguments and typeClassDependencies. [typeClassDeterminedArguments] :: TypeClassData -> Set Int -- | A sets of arguments that can be used to infer all other arguments. [typeClassCoveringSets] :: TypeClassData -> Set (Set Int) -- | Whether or not dictionaries for this type class are necessarily empty. [typeClassIsEmpty] :: TypeClassData -> Bool -- | A functional dependency indicates a relationship between two sets of -- type arguments in a class declaration. data FunctionalDependency FunctionalDependency :: [Int] -> [Int] -> FunctionalDependency -- | the type arguments which determine the determined type arguments [fdDeterminers] :: FunctionalDependency -> [Int] -- | the determined type arguments [fdDetermined] :: FunctionalDependency -> [Int] -- | The initial environment with no values and only the default javascript -- types defined initEnvironment :: Environment -- | A constructor for TypeClassData that computes which type class -- arguments are fully determined and argument covering sets. Fully -- determined means that this argument cannot be used when selecting a -- type class instance. A covering set is a minimal collection of -- arguments that can be used to find an instance and therefore determine -- all other type arguments. -- -- An example of the difference between determined and fully determined -- would be with the class: ```class C a b c | a -> b, b -> a, b -- -> c``` In this case, a must differ when b -- differs, and vice versa - each is determined by the other. Both -- a and b can be used in selecting a type class -- instance. However, c cannot - it is fully determined by -- a and b. -- -- Define a graph of type class arguments with edges being fundep -- determiners to determined. Each argument also has a self looping edge. -- An argument is fully determined if doesn't appear at the start of a -- path of strongly connected components. An argument is not fully -- determined otherwise. -- -- The way we compute this is by saying: an argument X is fully -- determined if there are arguments that determine X that X does not -- determine. This is the same thing: everything X determines includes -- everything in its SCC, and everything determining X is either before -- it in an SCC path, or in the same SCC. makeTypeClassData :: [(Text, Maybe SourceType)] -> [(Ident, SourceType)] -> [SourceConstraint] -> [FunctionalDependency] -> Bool -> TypeClassData -- | The visibility of a name in scope data NameVisibility -- | The name is defined in the current binding group, but is not visible Undefined :: NameVisibility -- | The name is defined in the another binding group, or has been made -- visible by a function binder Defined :: NameVisibility -- | A flag for whether a name is for an private or public value - only -- public values will be included in a generated externs file. data NameKind -- | A private value introduced as an artifact of code generation (class -- instances, class member accessors, etc.) Private :: NameKind -- | A public value for a module member or foreign import declaration Public :: NameKind -- | A name for member introduced by foreign import External :: NameKind -- | The kinds of a type data TypeKind -- | Data type DataType :: DataDeclType -> [(Text, Maybe SourceType, Role)] -> [(ProperName 'ConstructorName, [SourceType])] -> TypeKind -- | Type synonym TypeSynonym :: TypeKind -- | Foreign data ExternData :: [Role] -> TypeKind -- | A local type variable LocalTypeVariable :: TypeKind -- | A scoped type variable ScopedTypeVar :: TypeKind -- | The type ('data' or 'newtype') of a data type declaration data DataDeclType -- | A standard data constructor Data :: DataDeclType -- | A newtype constructor Newtype :: DataDeclType showDataDeclType :: DataDeclType -> Text -- | Construct a ProperName in the Prim module primName :: Text -> Qualified (ProperName a) -- | Construct a ProperName in the Prim.NAME module. primSubName :: Text -> Text -> Qualified (ProperName a) primKind :: Text -> SourceType primSubKind :: Text -> Text -> SourceType -- | Kind of ground types kindType :: SourceType kindConstraint :: SourceType isKindType :: Type a -> Bool kindSymbol :: SourceType kindDoc :: SourceType kindBoolean :: SourceType kindOrdering :: SourceType kindRowList :: SourceType -> SourceType kindRow :: SourceType -> SourceType kindOfREmpty :: SourceType -- | Construct a type in the Prim module primTy :: Text -> SourceType -- | Type constructor for functions tyFunction :: SourceType -- | Type constructor for strings tyString :: SourceType -- | Type constructor for strings tyChar :: SourceType -- | Type constructor for numbers tyNumber :: SourceType -- | Type constructor for integers tyInt :: SourceType -- | Type constructor for booleans tyBoolean :: SourceType -- | Type constructor for arrays tyArray :: SourceType -- | Type constructor for records tyRecord :: SourceType tyVar :: Text -> SourceType tyForall :: Text -> SourceType -> SourceType -> SourceType -- | Check whether a type is a record isObject :: Type a -> Bool -- | Check whether a type is a function isFunction :: Type a -> Bool isTypeOrApplied :: Type a -> Type b -> Bool -- | Smart constructor for function types function :: SourceType -> SourceType -> SourceType (-:>) :: SourceType -> SourceType -> SourceType infixr 4 -:> primClass :: Qualified (ProperName 'TypeName) -> (SourceType -> SourceType) -> [(Qualified (ProperName 'TypeName), (SourceType, TypeKind))] -- | The primitive types in the external environment with their associated -- kinds. There are also pseudo Fail, Warn, and -- Partial types that correspond to the classes with the same -- names. primTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) -- | This Map contains all of the prim types from all Prim -- modules. allPrimTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primBooleanTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primCoerceTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primOrderingTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primRowTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primRowListTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primSymbolTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) primTypeErrorTypes :: Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) -- | The primitive class map. This just contains the Partial -- class. Partial is used as a kind of magic constraint for -- partial functions. primClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData -- | This contains all of the type classes from all Prim modules. allPrimClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData primCoerceClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData primRowClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData primRowListClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData primSymbolClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData primTypeErrorClasses :: Map (Qualified (ProperName 'ClassName)) TypeClassData -- | Finds information about data constructors from the current -- environment. lookupConstructor :: Environment -> Qualified (ProperName 'ConstructorName) -> (DataDeclType, ProperName 'TypeName, SourceType, [Ident]) -- | Checks whether a data constructor is for a newtype. isNewtypeConstructor :: Environment -> Qualified (ProperName 'ConstructorName) -> Bool -- | Finds information about values from the current environment. lookupValue :: Environment -> Qualified Ident -> Maybe (SourceType, NameKind, NameVisibility) dictSynonymName' :: Text -> Text dictSynonymName :: ProperName a -> ProperName a isDictSynonym :: ProperName a -> Bool -- | Given the kind of a type, generate a list Nominal roles. This -- is used for opaque foreign types as well as type classes. nominalRolesForKind :: Type a -> [Role] kindArity :: Type a -> Int unapplyKinds :: Type a -> ([Type a], Type a) instance GHC.Generics.Generic Language.PureScript.Environment.FunctionalDependency instance GHC.Show.Show Language.PureScript.Environment.FunctionalDependency instance GHC.Generics.Generic Language.PureScript.Environment.TypeClassData instance GHC.Show.Show Language.PureScript.Environment.TypeClassData instance GHC.Generics.Generic Language.PureScript.Environment.NameVisibility instance GHC.Classes.Eq Language.PureScript.Environment.NameVisibility instance GHC.Show.Show Language.PureScript.Environment.NameVisibility instance GHC.Generics.Generic Language.PureScript.Environment.NameKind instance GHC.Classes.Eq Language.PureScript.Environment.NameKind instance GHC.Show.Show Language.PureScript.Environment.NameKind instance GHC.Generics.Generic Language.PureScript.Environment.DataDeclType instance GHC.Classes.Ord Language.PureScript.Environment.DataDeclType instance GHC.Classes.Eq Language.PureScript.Environment.DataDeclType instance GHC.Show.Show Language.PureScript.Environment.DataDeclType instance GHC.Generics.Generic Language.PureScript.Environment.TypeKind instance GHC.Classes.Eq Language.PureScript.Environment.TypeKind instance GHC.Show.Show Language.PureScript.Environment.TypeKind instance GHC.Generics.Generic Language.PureScript.Environment.Environment instance GHC.Show.Show Language.PureScript.Environment.Environment instance Control.DeepSeq.NFData Language.PureScript.Environment.Environment instance Control.DeepSeq.NFData Language.PureScript.Environment.TypeKind instance Codec.Serialise.Class.Serialise Language.PureScript.Environment.TypeKind instance Control.DeepSeq.NFData Language.PureScript.Environment.DataDeclType instance Codec.Serialise.Class.Serialise Language.PureScript.Environment.DataDeclType instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Environment.DataDeclType instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Environment.DataDeclType instance Control.DeepSeq.NFData Language.PureScript.Environment.NameKind instance Codec.Serialise.Class.Serialise Language.PureScript.Environment.NameKind instance Control.DeepSeq.NFData Language.PureScript.Environment.NameVisibility instance Codec.Serialise.Class.Serialise Language.PureScript.Environment.NameVisibility instance Control.DeepSeq.NFData Language.PureScript.Environment.TypeClassData instance Control.DeepSeq.NFData Language.PureScript.Environment.FunctionalDependency instance Codec.Serialise.Class.Serialise Language.PureScript.Environment.FunctionalDependency instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.Environment.FunctionalDependency instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.Environment.FunctionalDependency -- | Case binders module Language.PureScript.AST.Binders -- | Data type for binders data Binder -- | Wildcard binder NullBinder :: Binder -- | A binder which matches a literal LiteralBinder :: SourceSpan -> Literal Binder -> Binder -- | A binder which binds an identifier VarBinder :: SourceSpan -> Ident -> Binder -- | A binder which matches a data constructor ConstructorBinder :: SourceSpan -> Qualified (ProperName 'ConstructorName) -> [Binder] -> Binder -- | A operator alias binder. During the rebracketing phase of desugaring, -- this data constructor will be removed. OpBinder :: SourceSpan -> Qualified (OpName 'ValueOpName) -> Binder -- | Binary operator application. During the rebracketing phase of -- desugaring, this data constructor will be removed. BinaryNoParensBinder :: Binder -> Binder -> Binder -> Binder -- | Explicit parentheses. During the rebracketing phase of desugaring, -- this data constructor will be removed. -- -- Note: although it seems this constructor is not used, it _is_ useful, -- since it prevents certain traversals from matching. ParensInBinder :: Binder -> Binder -- | A binder which binds its input to an identifier NamedBinder :: SourceSpan -> Ident -> Binder -> Binder -- | A binder with source position information PositionedBinder :: SourceSpan -> [Comment] -> Binder -> Binder -- | A binder with a type annotation TypedBinder :: SourceType -> Binder -> Binder -- | Collect all names introduced in binders in an expression binderNames :: Binder -> [Ident] isIrrefutable :: Binder -> Bool instance GHC.Show.Show Language.PureScript.AST.Binders.Binder instance GHC.Classes.Eq Language.PureScript.AST.Binders.Binder instance GHC.Classes.Ord Language.PureScript.AST.Binders.Binder -- | Data types for modules and declarations module Language.PureScript.AST.Declarations -- | A map of locally-bound names in scope. type Context = [(Ident, SourceType)] -- | Holds the data necessary to do type directed search for typed holes data TypeSearch -- | An Environment captured for later consumption by type directed search TSBefore :: Environment -> TypeSearch -- | Results of applying type directed search to the previously captured -- Environment TSAfter :: [(Qualified Text, SourceType)] -> Maybe [(Label, SourceType)] -> TypeSearch -- | The identifiers that fully satisfy the subsumption check [tsAfterIdentifiers] :: TypeSearch -> [(Qualified Text, SourceType)] -- | Record fields that are available on the first argument to the typed -- hole [tsAfterRecordFields] :: TypeSearch -> Maybe [(Label, SourceType)] onTypeSearchTypes :: (SourceType -> SourceType) -> TypeSearch -> TypeSearch onTypeSearchTypesM :: Applicative m => (SourceType -> m SourceType) -> TypeSearch -> m TypeSearch -- | Error message hints, providing more detailed information about -- failure. data ErrorMessageHint ErrorUnifyingTypes :: SourceType -> SourceType -> ErrorMessageHint ErrorInExpression :: Expr -> ErrorMessageHint ErrorInModule :: ModuleName -> ErrorMessageHint ErrorInInstance :: Qualified (ProperName 'ClassName) -> [SourceType] -> ErrorMessageHint ErrorInSubsumption :: SourceType -> SourceType -> ErrorMessageHint ErrorCheckingAccessor :: Expr -> PSString -> ErrorMessageHint ErrorCheckingType :: Expr -> SourceType -> ErrorMessageHint ErrorCheckingKind :: SourceType -> SourceType -> ErrorMessageHint ErrorCheckingGuard :: ErrorMessageHint ErrorInferringType :: Expr -> ErrorMessageHint ErrorInferringKind :: SourceType -> ErrorMessageHint ErrorInApplication :: Expr -> SourceType -> Expr -> ErrorMessageHint ErrorInDataConstructor :: ProperName 'ConstructorName -> ErrorMessageHint ErrorInTypeConstructor :: ProperName 'TypeName -> ErrorMessageHint ErrorInBindingGroup :: NonEmpty Ident -> ErrorMessageHint ErrorInDataBindingGroup :: [ProperName 'TypeName] -> ErrorMessageHint ErrorInTypeSynonym :: ProperName 'TypeName -> ErrorMessageHint ErrorInValueDeclaration :: Ident -> ErrorMessageHint ErrorInTypeDeclaration :: Ident -> ErrorMessageHint ErrorInTypeClassDeclaration :: ProperName 'ClassName -> ErrorMessageHint ErrorInKindDeclaration :: ProperName 'TypeName -> ErrorMessageHint ErrorInRoleDeclaration :: ProperName 'TypeName -> ErrorMessageHint ErrorInForeignImport :: Ident -> ErrorMessageHint ErrorSolvingConstraint :: SourceConstraint -> ErrorMessageHint MissingConstructorImportForCoercible :: Qualified (ProperName 'ConstructorName) -> ErrorMessageHint PositionedError :: NonEmpty SourceSpan -> ErrorMessageHint -- | Categories of hints data HintCategory ExprHint :: HintCategory KindHint :: HintCategory CheckHint :: HintCategory PositionHint :: HintCategory SolverHint :: HintCategory OtherHint :: HintCategory -- | A module declaration, consisting of comments about the module, a -- module name, a list of declarations, and a list of the declarations -- that are explicitly exported. If the export list is Nothing, -- everything is exported. data Module Module :: SourceSpan -> [Comment] -> ModuleName -> [Declaration] -> Maybe [DeclarationRef] -> Module -- | Return a module's name. getModuleName :: Module -> ModuleName -- | Return a module's source span. getModuleSourceSpan :: Module -> SourceSpan -- | Return a module's declarations. getModuleDeclarations :: Module -> [Declaration] -- | Add an import declaration for a module if it does not already -- explicitly import it. -- -- Will not import an unqualified module if that module has already been -- imported qualified. (See #2197) addDefaultImport :: Qualified ModuleName -> Module -> Module -- | Adds import declarations to a module for an implicit Prim import and -- Prim | qualified as Prim, as necessary. importPrim :: Module -> Module -- | An item in a list of explicit imports or exports data DeclarationRef -- | A type class TypeClassRef :: SourceSpan -> ProperName 'ClassName -> DeclarationRef -- | A type operator TypeOpRef :: SourceSpan -> OpName 'TypeOpName -> DeclarationRef -- | A type constructor with data constructors TypeRef :: SourceSpan -> ProperName 'TypeName -> Maybe [ProperName 'ConstructorName] -> DeclarationRef -- | A value ValueRef :: SourceSpan -> Ident -> DeclarationRef -- | A value-level operator ValueOpRef :: SourceSpan -> OpName 'ValueOpName -> DeclarationRef -- | A type class instance, created during typeclass desugaring (name, -- class name, instance types) TypeInstanceRef :: SourceSpan -> Ident -> DeclarationRef -- | A module, in its entirety ModuleRef :: SourceSpan -> ModuleName -> DeclarationRef -- | A value re-exported from another module. These will be inserted during -- elaboration in name desugaring. ReExportRef :: SourceSpan -> ExportSource -> DeclarationRef -> DeclarationRef data ExportSource ExportSource :: Maybe ModuleName -> ModuleName -> ExportSource [exportSourceImportedFrom] :: ExportSource -> Maybe ModuleName [exportSourceDefinedIn] :: ExportSource -> ModuleName declRefSourceSpan :: DeclarationRef -> SourceSpan declRefName :: DeclarationRef -> Name getTypeRef :: DeclarationRef -> Maybe (ProperName 'TypeName, Maybe [ProperName 'ConstructorName]) getTypeOpRef :: DeclarationRef -> Maybe (OpName 'TypeOpName) getValueRef :: DeclarationRef -> Maybe Ident getValueOpRef :: DeclarationRef -> Maybe (OpName 'ValueOpName) getTypeClassRef :: DeclarationRef -> Maybe (ProperName 'ClassName) isModuleRef :: DeclarationRef -> Bool -- | The data type which specifies type of import declaration data ImportDeclarationType -- | An import with no explicit list: `import M`. Implicit :: ImportDeclarationType -- | An import with an explicit list of references to import: `import M -- (foo)` Explicit :: [DeclarationRef] -> ImportDeclarationType -- | An import with a list of references to hide: `import M hiding (foo)` Hiding :: [DeclarationRef] -> ImportDeclarationType isImplicit :: ImportDeclarationType -> Bool isExplicit :: ImportDeclarationType -> Bool -- | A role declaration assigns a list of roles to a type constructor's -- parameters, e.g.: -- --
--   type role T representational phantom
--   
-- -- In this example, T is the identifier and -- [representational, phantom] is the list of roles (T -- presumably having two parameters). data RoleDeclarationData RoleDeclarationData :: !SourceAnn -> !ProperName 'TypeName -> ![Role] -> RoleDeclarationData [rdeclSourceAnn] :: RoleDeclarationData -> !SourceAnn [rdeclIdent] :: RoleDeclarationData -> !ProperName 'TypeName [rdeclRoles] :: RoleDeclarationData -> ![Role] -- | A type declaration assigns a type to an identifier, eg: -- --
--   identity :: forall a. a -> a
--   
-- -- In this example identity is the identifier and forall a. -- a -> a the type. data TypeDeclarationData TypeDeclarationData :: !SourceAnn -> !Ident -> !SourceType -> TypeDeclarationData [tydeclSourceAnn] :: TypeDeclarationData -> !SourceAnn [tydeclIdent] :: TypeDeclarationData -> !Ident [tydeclType] :: TypeDeclarationData -> !SourceType overTypeDeclaration :: (TypeDeclarationData -> TypeDeclarationData) -> Declaration -> Declaration getTypeDeclaration :: Declaration -> Maybe TypeDeclarationData unwrapTypeDeclaration :: TypeDeclarationData -> (Ident, SourceType) -- | A value declaration assigns a name and potential binders, to an -- expression (or multiple guarded expressions). -- --
--   double x = x + x
--   
-- -- In this example double is the identifier, x is a -- binder and x + x is the expression. data ValueDeclarationData a ValueDeclarationData :: !SourceAnn -> !Ident -> !NameKind -> ![Binder] -> !a -> ValueDeclarationData a [valdeclSourceAnn] :: ValueDeclarationData a -> !SourceAnn -- | The declared value's name [valdeclIdent] :: ValueDeclarationData a -> !Ident -- | Whether or not this value is exported/visible [valdeclName] :: ValueDeclarationData a -> !NameKind [valdeclBinders] :: ValueDeclarationData a -> ![Binder] [valdeclExpression] :: ValueDeclarationData a -> !a overValueDeclaration :: (ValueDeclarationData [GuardedExpr] -> ValueDeclarationData [GuardedExpr]) -> Declaration -> Declaration getValueDeclaration :: Declaration -> Maybe (ValueDeclarationData [GuardedExpr]) pattern ValueDecl :: SourceAnn -> Ident -> NameKind -> [Binder] -> [GuardedExpr] -> Declaration data DataConstructorDeclaration DataConstructorDeclaration :: !SourceAnn -> !ProperName 'ConstructorName -> ![(Ident, SourceType)] -> DataConstructorDeclaration [dataCtorAnn] :: DataConstructorDeclaration -> !SourceAnn [dataCtorName] :: DataConstructorDeclaration -> !ProperName 'ConstructorName [dataCtorFields] :: DataConstructorDeclaration -> ![(Ident, SourceType)] mapDataCtorFields :: ([(Ident, SourceType)] -> [(Ident, SourceType)]) -> DataConstructorDeclaration -> DataConstructorDeclaration traverseDataCtorFields :: Monad m => ([(Ident, SourceType)] -> m [(Ident, SourceType)]) -> DataConstructorDeclaration -> m DataConstructorDeclaration -- | The data type of declarations data Declaration -- | A data type declaration (data or newtype, name, arguments, data -- constructors) DataDeclaration :: SourceAnn -> DataDeclType -> ProperName 'TypeName -> [(Text, Maybe SourceType)] -> [DataConstructorDeclaration] -> Declaration -- | A minimal mutually recursive set of data type declarations DataBindingGroupDeclaration :: NonEmpty Declaration -> Declaration -- | A type synonym declaration (name, arguments, type) TypeSynonymDeclaration :: SourceAnn -> ProperName 'TypeName -> [(Text, Maybe SourceType)] -> SourceType -> Declaration -- | A kind signature declaration KindDeclaration :: SourceAnn -> KindSignatureFor -> ProperName 'TypeName -> SourceType -> Declaration -- | A role declaration (name, roles) RoleDeclaration :: {-# UNPACK #-} !RoleDeclarationData -> Declaration -- | A type declaration for a value (name, ty) TypeDeclaration :: {-# UNPACK #-} !TypeDeclarationData -> Declaration -- | A value declaration (name, top-level binders, optional guard, value) ValueDeclaration :: {-# UNPACK #-} !ValueDeclarationData [GuardedExpr] -> Declaration -- | A declaration paired with pattern matching in let-in expression -- (binder, optional guard, value) BoundValueDeclaration :: SourceAnn -> Binder -> Expr -> Declaration -- | A minimal mutually recursive set of value declarations BindingGroupDeclaration :: NonEmpty ((SourceAnn, Ident), NameKind, Expr) -> Declaration -- | A foreign import declaration (name, type) ExternDeclaration :: SourceAnn -> Ident -> SourceType -> Declaration -- | A data type foreign import (name, kind) ExternDataDeclaration :: SourceAnn -> ProperName 'TypeName -> SourceType -> Declaration -- | A fixity declaration FixityDeclaration :: SourceAnn -> Either ValueFixity TypeFixity -> Declaration -- | A module import (module name, qualifiedunqualifiedhiding, -- optional "qualified as" name) ImportDeclaration :: SourceAnn -> ModuleName -> ImportDeclarationType -> Maybe ModuleName -> Declaration -- | A type class declaration (name, argument, implies, member -- declarations) TypeClassDeclaration :: SourceAnn -> ProperName 'ClassName -> [(Text, Maybe SourceType)] -> [SourceConstraint] -> [FunctionalDependency] -> [Declaration] -> Declaration -- | A type instance declaration (instance chain, chain index, name, -- dependencies, class name, instance types, member declarations) TypeInstanceDeclaration :: SourceAnn -> [Ident] -> Integer -> Ident -> [SourceConstraint] -> Qualified (ProperName 'ClassName) -> [SourceType] -> TypeInstanceBody -> Declaration data ValueFixity ValueFixity :: Fixity -> Qualified (Either Ident (ProperName 'ConstructorName)) -> OpName 'ValueOpName -> ValueFixity data TypeFixity TypeFixity :: Fixity -> Qualified (ProperName 'TypeName) -> OpName 'TypeOpName -> TypeFixity pattern ValueFixityDeclaration :: SourceAnn -> Fixity -> Qualified (Either Ident (ProperName 'ConstructorName)) -> OpName 'ValueOpName -> Declaration pattern TypeFixityDeclaration :: SourceAnn -> Fixity -> Qualified (ProperName 'TypeName) -> OpName 'TypeOpName -> Declaration -- | The members of a type class instance declaration data TypeInstanceBody -- | This is a derived instance DerivedInstance :: TypeInstanceBody -- | This is an instance derived from a newtype NewtypeInstance :: TypeInstanceBody -- | This is an instance derived from a newtype, desugared to include a -- dictionary for the type under the newtype. NewtypeInstanceWithDictionary :: Expr -> TypeInstanceBody -- | This is a regular (explicit) instance ExplicitInstance :: [Declaration] -> TypeInstanceBody mapTypeInstanceBody :: ([Declaration] -> [Declaration]) -> TypeInstanceBody -> TypeInstanceBody -- | A traversal for TypeInstanceBody traverseTypeInstanceBody :: Applicative f => ([Declaration] -> f [Declaration]) -> TypeInstanceBody -> f TypeInstanceBody -- | What sort of declaration the kind signature applies to. data KindSignatureFor DataSig :: KindSignatureFor NewtypeSig :: KindSignatureFor TypeSynonymSig :: KindSignatureFor ClassSig :: KindSignatureFor declSourceAnn :: Declaration -> SourceAnn declSourceSpan :: Declaration -> SourceSpan declName :: Declaration -> Maybe Name -- | Test if a declaration is a value declaration isValueDecl :: Declaration -> Bool -- | Test if a declaration is a data type declaration isDataDecl :: Declaration -> Bool -- | Test if a declaration is a type synonym declaration isTypeSynonymDecl :: Declaration -> Bool -- | Test if a declaration is a module import isImportDecl :: Declaration -> Bool -- | Test if a declaration is a role declaration isRoleDecl :: Declaration -> Bool -- | Test if a declaration is a data type foreign import isExternDataDecl :: Declaration -> Bool -- | Test if a declaration is a fixity declaration isFixityDecl :: Declaration -> Bool getFixityDecl :: Declaration -> Maybe (Either ValueFixity TypeFixity) -- | Test if a declaration is a foreign import isExternDecl :: Declaration -> Bool -- | Test if a declaration is a type class instance declaration isTypeClassInstanceDecl :: Declaration -> Bool -- | Test if a declaration is a type class declaration isTypeClassDecl :: Declaration -> Bool -- | Test if a declaration is a kind signature declaration. isKindDecl :: Declaration -> Bool -- | Recursively flatten data binding groups in the list of declarations flattenDecls :: [Declaration] -> [Declaration] -- | A guard is just a boolean-valued expression that appears alongside a -- set of binders data Guard ConditionGuard :: Expr -> Guard PatternGuard :: Binder -> Expr -> Guard -- | The right hand side of a binder in value declarations and case -- expressions. data GuardedExpr GuardedExpr :: [Guard] -> Expr -> GuardedExpr pattern MkUnguarded :: Expr -> GuardedExpr -- | Data type for expressions and terms data Expr -- | A literal value Literal :: SourceSpan -> Literal Expr -> Expr -- | A prefix -, will be desugared UnaryMinus :: SourceSpan -> Expr -> Expr -- | Binary operator application. During the rebracketing phase of -- desugaring, this data constructor will be removed. BinaryNoParens :: Expr -> Expr -> Expr -> Expr -- | Explicit parentheses. During the rebracketing phase of desugaring, -- this data constructor will be removed. -- -- Note: although it seems this constructor is not used, it _is_ useful, -- since it prevents certain traversals from matching. Parens :: Expr -> Expr -- | An record property accessor expression (e.g. `obj.x` or `_.x`). -- Anonymous arguments will be removed during desugaring and expanded -- into a lambda that reads a property from a record. Accessor :: PSString -> Expr -> Expr -- | Partial record update ObjectUpdate :: Expr -> [(PSString, Expr)] -> Expr -- | Object updates with nested support: `x { foo { bar = e } }` Replaced -- during desugaring into a Let and nested ObjectUpdates ObjectUpdateNested :: Expr -> PathTree Expr -> Expr -- | Function introduction Abs :: Binder -> Expr -> Expr -- | Function application App :: Expr -> Expr -> Expr -- | Hint that an expression is unused. This is used to ignore type class -- dictionaries that are necessarily empty. The inner expression lets us -- solve subgoals before eliminating the whole expression. The code gen -- will render this as undefined, regardless of what the inner -- expression is. Unused :: Expr -> Expr -- | Variable Var :: SourceSpan -> Qualified Ident -> Expr -- | An operator. This will be desugared into a function during the -- "operators" phase of desugaring. Op :: SourceSpan -> Qualified (OpName 'ValueOpName) -> Expr -- | Conditional (if-then-else expression) IfThenElse :: Expr -> Expr -> Expr -> Expr -- | A data constructor Constructor :: SourceSpan -> Qualified (ProperName 'ConstructorName) -> Expr -- | A case expression. During the case expansion phase of desugaring, -- top-level binders will get desugared into case expressions, hence the -- need for guards and multiple binders per branch here. Case :: [Expr] -> [CaseAlternative] -> Expr -- | A value with a type annotation TypedValue :: Bool -> Expr -> SourceType -> Expr -- | A let binding Let :: WhereProvenance -> [Declaration] -> Expr -> Expr -- | A do-notation block Do :: Maybe ModuleName -> [DoNotationElement] -> Expr -- | An ado-notation block Ado :: Maybe ModuleName -> [DoNotationElement] -> Expr -> Expr -- | An application of a typeclass dictionary constructor. The value should -- be an ObjectLiteral. TypeClassDictionaryConstructorApp :: Qualified (ProperName 'ClassName) -> Expr -> Expr -- | A placeholder for a type class dictionary to be inserted later. At the -- end of type checking, these placeholders will be replaced with actual -- expressions representing type classes dictionaries which can be -- evaluated at runtime. The constructor arguments represent (in order): -- whether or not to look at superclass implementations when searching -- for a dictionary, the type class name and instance type, and the type -- class dictionaries in scope. TypeClassDictionary :: SourceConstraint -> Map (Maybe ModuleName) (Map (Qualified (ProperName 'ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict))) -> [ErrorMessageHint] -> Expr -- | A typeclass dictionary accessor, the implementation is left -- unspecified until CoreFn desugaring. TypeClassDictionaryAccessor :: Qualified (ProperName 'ClassName) -> Ident -> Expr -- | A placeholder for a superclass dictionary to be turned into a -- TypeClassDictionary during typechecking DeferredDictionary :: Qualified (ProperName 'ClassName) -> [SourceType] -> Expr -- | A placeholder for an anonymous function argument AnonymousArgument :: Expr -- | A typed hole that will be turned into a hint/error during typechecking Hole :: Text -> Expr -- | A value with source position information PositionedValue :: SourceSpan -> [Comment] -> Expr -> Expr -- | Metadata that tells where a let binding originated data WhereProvenance -- | The let binding was originally a where clause FromWhere :: WhereProvenance -- | The let binding was always a let binding FromLet :: WhereProvenance -- | An alternative in a case statement data CaseAlternative CaseAlternative :: [Binder] -> [GuardedExpr] -> CaseAlternative -- | A collection of binders with which to match the inputs [caseAlternativeBinders] :: CaseAlternative -> [Binder] -- | The result expression or a collect of guarded expressions [caseAlternativeResult] :: CaseAlternative -> [GuardedExpr] -- | A statement in a do-notation block data DoNotationElement -- | A monadic value without a binder DoNotationValue :: Expr -> DoNotationElement -- | A monadic value with a binder DoNotationBind :: Binder -> Expr -> DoNotationElement -- | A let statement, i.e. a pure value with a binder DoNotationLet :: [Declaration] -> DoNotationElement -- | A do notation element with source position information PositionedDoNotationElement :: SourceSpan -> [Comment] -> DoNotationElement -> DoNotationElement newtype PathTree t PathTree :: AssocList PSString (PathNode t) -> PathTree t data PathNode t Leaf :: t -> PathNode t Branch :: PathTree t -> PathNode t newtype AssocList k t AssocList :: [(k, t)] -> AssocList k t [runAssocList] :: AssocList k t -> [(k, t)] isTrueExpr :: Expr -> Bool instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.AST.Declarations.ExportSource instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.AST.Declarations.ExportSource instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.AST.Declarations.ImportDeclarationType instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.AST.Declarations.ImportDeclarationType instance Data.Aeson.Types.ToJSON.ToJSON Language.PureScript.AST.Declarations.DeclarationRef instance Data.Aeson.Types.FromJSON.FromJSON Language.PureScript.AST.Declarations.DeclarationRef instance GHC.Show.Show Language.PureScript.AST.Declarations.TypeSearch instance GHC.Classes.Eq Language.PureScript.AST.Declarations.HintCategory instance GHC.Show.Show Language.PureScript.AST.Declarations.HintCategory instance Codec.Serialise.Class.Serialise Language.PureScript.AST.Declarations.ExportSource instance Control.DeepSeq.NFData Language.PureScript.AST.Declarations.ExportSource instance GHC.Generics.Generic Language.PureScript.AST.Declarations.ExportSource instance GHC.Show.Show Language.PureScript.AST.Declarations.ExportSource instance GHC.Classes.Ord Language.PureScript.AST.Declarations.ExportSource instance GHC.Classes.Eq Language.PureScript.AST.Declarations.ExportSource instance Codec.Serialise.Class.Serialise Language.PureScript.AST.Declarations.DeclarationRef instance Control.DeepSeq.NFData Language.PureScript.AST.Declarations.DeclarationRef instance GHC.Generics.Generic Language.PureScript.AST.Declarations.DeclarationRef instance GHC.Show.Show Language.PureScript.AST.Declarations.DeclarationRef instance Codec.Serialise.Class.Serialise Language.PureScript.AST.Declarations.ImportDeclarationType instance GHC.Generics.Generic Language.PureScript.AST.Declarations.ImportDeclarationType instance GHC.Show.Show Language.PureScript.AST.Declarations.ImportDeclarationType instance GHC.Classes.Eq Language.PureScript.AST.Declarations.ImportDeclarationType instance GHC.Classes.Eq Language.PureScript.AST.Declarations.RoleDeclarationData instance GHC.Show.Show Language.PureScript.AST.Declarations.RoleDeclarationData instance GHC.Classes.Eq Language.PureScript.AST.Declarations.TypeDeclarationData instance GHC.Show.Show Language.PureScript.AST.Declarations.TypeDeclarationData instance Data.Traversable.Traversable Language.PureScript.AST.Declarations.ValueDeclarationData instance Data.Foldable.Foldable Language.PureScript.AST.Declarations.ValueDeclarationData instance GHC.Base.Functor Language.PureScript.AST.Declarations.ValueDeclarationData instance GHC.Show.Show a => GHC.Show.Show (Language.PureScript.AST.Declarations.ValueDeclarationData a) instance GHC.Classes.Eq Language.PureScript.AST.Declarations.DataConstructorDeclaration instance GHC.Show.Show Language.PureScript.AST.Declarations.DataConstructorDeclaration instance GHC.Show.Show Language.PureScript.AST.Declarations.ValueFixity instance GHC.Classes.Ord Language.PureScript.AST.Declarations.ValueFixity instance GHC.Classes.Eq Language.PureScript.AST.Declarations.ValueFixity instance GHC.Show.Show Language.PureScript.AST.Declarations.TypeFixity instance GHC.Classes.Ord Language.PureScript.AST.Declarations.TypeFixity instance GHC.Classes.Eq Language.PureScript.AST.Declarations.TypeFixity instance GHC.Show.Show Language.PureScript.AST.Declarations.KindSignatureFor instance GHC.Classes.Ord Language.PureScript.AST.Declarations.KindSignatureFor instance GHC.Classes.Eq Language.PureScript.AST.Declarations.KindSignatureFor instance GHC.Show.Show Language.PureScript.AST.Declarations.WhereProvenance instance Data.Traversable.Traversable (Language.PureScript.AST.Declarations.AssocList k) instance GHC.Base.Functor (Language.PureScript.AST.Declarations.AssocList k) instance Data.Foldable.Foldable (Language.PureScript.AST.Declarations.AssocList k) instance (GHC.Classes.Ord k, GHC.Classes.Ord t) => GHC.Classes.Ord (Language.PureScript.AST.Declarations.AssocList k t) instance (GHC.Classes.Eq k, GHC.Classes.Eq t) => GHC.Classes.Eq (Language.PureScript.AST.Declarations.AssocList k t) instance (GHC.Show.Show k, GHC.Show.Show t) => GHC.Show.Show (Language.PureScript.AST.Declarations.AssocList k t) instance Data.Traversable.Traversable Language.PureScript.AST.Declarations.PathNode instance Data.Foldable.Foldable Language.PureScript.AST.Declarations.PathNode instance GHC.Base.Functor Language.PureScript.AST.Declarations.PathNode instance GHC.Classes.Ord t => GHC.Classes.Ord (Language.PureScript.AST.Declarations.PathNode t) instance GHC.Classes.Eq t => GHC.Classes.Eq (Language.PureScript.AST.Declarations.PathNode t) instance GHC.Show.Show t => GHC.Show.Show (Language.PureScript.AST.Declarations.PathNode t) instance Data.Traversable.Traversable Language.PureScript.AST.Declarations.PathTree instance Data.Foldable.Foldable Language.PureScript.AST.Declarations.PathTree instance GHC.Base.Functor Language.PureScript.AST.Declarations.PathTree instance GHC.Classes.Ord t => GHC.Classes.Ord (Language.PureScript.AST.Declarations.PathTree t) instance GHC.Classes.Eq t => GHC.Classes.Eq (Language.PureScript.AST.Declarations.PathTree t) instance GHC.Show.Show t => GHC.Show.Show (Language.PureScript.AST.Declarations.PathTree t) instance GHC.Show.Show Language.PureScript.AST.Declarations.ErrorMessageHint instance GHC.Show.Show Language.PureScript.AST.Declarations.CaseAlternative instance GHC.Show.Show Language.PureScript.AST.Declarations.TypeInstanceBody instance GHC.Show.Show Language.PureScript.AST.Declarations.Guard instance GHC.Show.Show Language.PureScript.AST.Declarations.GuardedExpr instance GHC.Show.Show Language.PureScript.AST.Declarations.Declaration instance GHC.Show.Show Language.PureScript.AST.Declarations.DoNotationElement instance GHC.Show.Show Language.PureScript.AST.Declarations.Expr instance GHC.Show.Show Language.PureScript.AST.Declarations.Module instance GHC.Classes.Eq Language.PureScript.AST.Declarations.DeclarationRef instance GHC.Classes.Ord Language.PureScript.AST.Declarations.DeclarationRef -- | AST traversal helpers module Language.PureScript.AST.Traversals guardedExprM :: Applicative m => (Guard -> m Guard) -> (Expr -> m Expr) -> GuardedExpr -> m GuardedExpr mapGuardedExpr :: (Guard -> Guard) -> (Expr -> Expr) -> GuardedExpr -> GuardedExpr litM :: Monad m => (a -> m a) -> Literal a -> m (Literal a) everywhereOnValues :: (Declaration -> Declaration) -> (Expr -> Expr) -> (Binder -> Binder) -> (Declaration -> Declaration, Expr -> Expr, Binder -> Binder) everywhereOnValuesTopDownM :: forall m. Monad m => (Declaration -> m Declaration) -> (Expr -> m Expr) -> (Binder -> m Binder) -> (Declaration -> m Declaration, Expr -> m Expr, Binder -> m Binder) everywhereOnValuesM :: forall m. Monad m => (Declaration -> m Declaration) -> (Expr -> m Expr) -> (Binder -> m Binder) -> (Declaration -> m Declaration, Expr -> m Expr, Binder -> m Binder) everythingOnValues :: forall r. (r -> r -> r) -> (Declaration -> r) -> (Expr -> r) -> (Binder -> r) -> (CaseAlternative -> r) -> (DoNotationElement -> r) -> (Declaration -> r, Expr -> r, Binder -> r, CaseAlternative -> r, DoNotationElement -> r) everythingWithContextOnValues :: forall s r. s -> r -> (r -> r -> r) -> (s -> Declaration -> (s, r)) -> (s -> Expr -> (s, r)) -> (s -> Binder -> (s, r)) -> (s -> CaseAlternative -> (s, r)) -> (s -> DoNotationElement -> (s, r)) -> (Declaration -> r, Expr -> r, Binder -> r, CaseAlternative -> r, DoNotationElement -> r) everywhereWithContextOnValuesM :: forall m s. Monad m => s -> (s -> Declaration -> m (s, Declaration)) -> (s -> Expr -> m (s, Expr)) -> (s -> Binder -> m (s, Binder)) -> (s -> CaseAlternative -> m (s, CaseAlternative)) -> (s -> DoNotationElement -> m (s, DoNotationElement)) -> (Declaration -> m Declaration, Expr -> m Expr, Binder -> m Binder, CaseAlternative -> m CaseAlternative, DoNotationElement -> m DoNotationElement) data ScopedIdent LocalIdent :: Ident -> ScopedIdent ToplevelIdent :: Ident -> ScopedIdent inScope :: Ident -> Set ScopedIdent -> Bool everythingWithScope :: forall r. Monoid r => (Set ScopedIdent -> Declaration -> r) -> (Set ScopedIdent -> Expr -> r) -> (Set ScopedIdent -> Binder -> r) -> (Set ScopedIdent -> CaseAlternative -> r) -> (Set ScopedIdent -> DoNotationElement -> r) -> (Set ScopedIdent -> Declaration -> r, Set ScopedIdent -> Expr -> r, Set ScopedIdent -> Binder -> r, Set ScopedIdent -> CaseAlternative -> r, Set ScopedIdent -> DoNotationElement -> r) accumTypes :: Monoid r => (SourceType -> r) -> (Declaration -> r, Expr -> r, Binder -> r, CaseAlternative -> r, DoNotationElement -> r) -- | Map a function over type annotations appearing inside a value overTypes :: (SourceType -> SourceType) -> Expr -> Expr instance GHC.Classes.Ord Language.PureScript.AST.Traversals.ScopedIdent instance GHC.Classes.Eq Language.PureScript.AST.Traversals.ScopedIdent instance GHC.Show.Show Language.PureScript.AST.Traversals.ScopedIdent module Language.PureScript.AST.Exported -- | Return a list of all declarations which are exported from a module. -- This function descends into data declarations to filter out unexported -- data constructors, and also filters out type instance declarations if -- they refer to classes or types which are not themselves exported. -- -- Note that this function assumes that the module has already had its -- imports desugared using desugarImports. It will produce -- incorrect results if this is not the case - for example, type class -- instances will be incorrectly removed in some cases. -- -- The returned declarations are in the same order as they appear in the -- export list, unless there is no export list, in which case they appear -- in the same order as they do in the source file. exportedDeclarations :: Module -> [Declaration] -- | Test if a declaration is exported, given a module's export list. Note -- that this function does not account for type instance declarations of -- non-exported types, or non-exported data constructors. Therefore, you -- should prefer exportedDeclarations to this function, where -- possible. isExported :: Maybe [DeclarationRef] -> Declaration -> Bool -- | The initial PureScript AST module Language.PureScript.AST