Safe Haskell | None |
---|---|
Language | Haskell2010 |
The main compiler module
Synopsis
- data Text
- type Supply = SupplyT Identity
- newtype SupplyT m a = SupplyT {}
- runSupplyT :: Integer -> SupplyT m a -> m (a, Integer)
- evalSupplyT :: Functor m => Integer -> SupplyT m a -> m a
- runSupply :: Integer -> Supply a -> (a, Integer)
- evalSupply :: Integer -> Supply a -> a
- data Comment
- data SourceSpan = SourceSpan {}
- data SourcePos = SourcePos {}
- type SourceAnn = (SourceSpan, [Comment])
- pattern NullSourceAnn :: SourceAnn
- pattern NullSourceSpan :: SourceSpan
- displaySourcePos :: SourcePos -> Text
- displaySourcePosShort :: SourcePos -> Text
- displayStartEndPos :: SourceSpan -> Text
- displayStartEndPosShort :: SourceSpan -> Text
- displaySourceSpan :: FilePath -> SourceSpan -> Text
- internalModuleSourceSpan :: String -> SourceSpan
- nullSourceSpan :: SourceSpan
- nullSourceAnn :: SourceAnn
- nonEmptySpan :: SourceAnn -> Maybe SourceSpan
- widenSourceSpan :: SourceSpan -> SourceSpan -> SourceSpan
- widenSourceAnn :: SourceAnn -> SourceAnn -> SourceAnn
- type HasCallStack = HasCallStack
- internalError :: HasCallStack => String -> a
- data Fixity = Fixity Associativity Precedence
- data Associativity
- type Precedence = Integer
- showAssoc :: Associativity -> String
- readAssoc :: String -> Associativity
- data Qualified a = Qualified (Maybe ModuleName) a
- newtype ModuleName = ModuleName [ProperName Namespace]
- data ProperNameType
- newtype ProperName (a :: ProperNameType) = ProperName {}
- data OpNameType
- newtype OpName (a :: OpNameType) = OpName {}
- data Ident
- data Name
- getIdentName :: Name -> Maybe Ident
- getValOpName :: Name -> Maybe (OpName ValueOpName)
- getTypeName :: Name -> Maybe (ProperName TypeName)
- getKindName :: Name -> Maybe (ProperName KindName)
- getTypeOpName :: Name -> Maybe (OpName TypeOpName)
- getDctorName :: Name -> Maybe (ProperName ConstructorName)
- getClassName :: Name -> Maybe (ProperName ClassName)
- getModName :: Name -> Maybe ModuleName
- runIdent :: Ident -> Text
- showIdent :: Ident -> Text
- freshIdent :: MonadSupply m => Text -> m Ident
- freshIdent' :: MonadSupply m => m Ident
- showOp :: OpName a -> Text
- eraseOpName :: OpName a -> OpName AnyOpName
- coerceProperName :: ProperName a -> ProperName b
- runModuleName :: ModuleName -> Text
- moduleNameFromString :: Text -> ModuleName
- isBuiltinModuleName :: ModuleName -> Bool
- showQualified :: (a -> Text) -> Qualified a -> Text
- getQual :: Qualified a -> Maybe ModuleName
- qualify :: ModuleName -> Qualified a -> (ModuleName, a)
- mkQualified :: a -> ModuleName -> Qualified a
- disqualify :: Qualified a -> a
- disqualifyFor :: Maybe ModuleName -> Qualified a -> Maybe a
- isQualified :: Qualified a -> Bool
- isUnqualified :: Qualified a -> Bool
- isQualifiedWith :: ModuleName -> Qualified a -> Bool
- data Kind a
- type SourceKind = Kind SourceAnn
- srcKUnknown :: Int -> SourceKind
- srcRow :: SourceKind -> SourceKind
- srcFunKind :: SourceKind -> SourceKind -> SourceKind
- srcNamedKind :: Qualified (ProperName KindName) -> SourceKind
- kindToJSON :: forall a. (a -> Value) -> Kind a -> Value
- kindFromJSON :: forall a. Parser a -> (Value -> Parser a) -> Value -> Parser (Kind a)
- everywhereOnKinds :: (Kind a -> Kind a) -> Kind a -> Kind a
- everywhereOnKindsM :: Monad m => (Kind a -> m (Kind a)) -> Kind a -> m (Kind a)
- everythingOnKinds :: (r -> r -> r) -> (Kind a -> r) -> Kind a -> r
- annForKind :: Lens' (Kind a) a
- getAnnForKind :: Kind a -> a
- setAnnForKind :: a -> Kind a -> Kind a
- eqKind :: Kind a -> Kind b -> Bool
- eqMaybeKind :: Maybe (Kind a) -> Maybe (Kind b) -> Bool
- compareKind :: Kind a -> Kind b -> Ordering
- compareMaybeKind :: Maybe (Kind a) -> Maybe (Kind b) -> Ordering
- data CodegenTarget
- = JS
- | JSSourceMap
- | CoreFn
- | Docs
- data Options = Options {}
- defaultOptions :: Options
- codegenTargets :: Map String CodegenTarget
- prettyPrintString :: PSString -> Text
- data Literal a
- = NumericLiteral (Either Integer Double)
- | StringLiteral PSString
- | CharLiteral Char
- | BooleanLiteral Bool
- | ArrayLiteral [a]
- | ObjectLiteral [(PSString, a)]
- data RowListItem a = RowListItem {
- rowListAnn :: a
- rowListLabel :: Label
- rowListType :: Type a
- data Constraint a = Constraint {}
- data ConstraintData = PartialConstraintData [[Text]] Bool
- data Type a
- = TUnknown a Int
- | TypeVar a Text
- | TypeLevelString a PSString
- | TypeWildcard a (Maybe Text)
- | TypeConstructor a (Qualified (ProperName TypeName))
- | TypeOp a (Qualified (OpName TypeOpName))
- | TypeApp a (Type a) (Type a)
- | ForAll a Text (Maybe (Kind a)) (Type a) (Maybe SkolemScope)
- | ConstrainedType a (Constraint a) (Type a)
- | Skolem a Text Int SkolemScope
- | REmpty a
- | RCons a Label (Type a) (Type a)
- | KindedType a (Type a) (Kind a)
- | BinaryNoParensType a (Type a) (Type a) (Type a)
- | ParensInType a (Type a)
- newtype SkolemScope = SkolemScope {}
- type SourceConstraint = Constraint SourceAnn
- type SourceType = Type SourceAnn
- 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
- srcForAll :: Text -> Maybe SourceKind -> SourceType -> Maybe SkolemScope -> SourceType
- srcConstrainedType :: SourceConstraint -> SourceType -> SourceType
- srcSkolem :: Text -> Int -> SkolemScope -> SourceType
- srcREmpty :: SourceType
- srcRCons :: Label -> SourceType -> SourceType -> SourceType
- srcKindedType :: SourceType -> SourceKind -> SourceType
- srcBinaryNoParensType :: SourceType -> SourceType -> SourceType -> SourceType
- srcParensInType :: SourceType -> SourceType
- srcConstraint :: Qualified (ProperName ClassName) -> [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)
- 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)
- srcRowListItem :: Label -> SourceType -> RowListItem SourceAnn
- rowToList :: Type a -> ([RowListItem a], Type a)
- rowToSortedList :: Type a -> ([RowListItem a], Type a)
- rowFromList :: ([RowListItem a], Type a) -> Type a
- isMonoType :: Type a -> Bool
- mkForAll :: [(a, (Text, Maybe (Kind a)))] -> Type a -> Type a
- replaceTypeVars :: Text -> Type a -> Type a -> Type a
- replaceAllTypeVars :: [(Text, Type a)] -> Type a -> Type a
- usedTypeVariables :: Type a -> [Text]
- freeTypeVariables :: Type a -> [Text]
- quantify :: Type a -> Type a
- moveQuantifiersToFront :: Type a -> Type a
- containsWildcards :: Type a -> Bool
- containsForAll :: Type a -> Bool
- 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)
- 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
- compareType :: Type a -> Type b -> Ordering
- eqConstraint :: Constraint a -> Constraint b -> Bool
- compareConstraint :: Constraint a -> Constraint b -> Ordering
- data DataDeclType
- data TypeKind
- data NameKind
- data NameVisibility
- data FunctionalDependency = FunctionalDependency {
- fdDeterminers :: [Int]
- fdDetermined :: [Int]
- data TypeClassData = TypeClassData {}
- data Environment = Environment {
- names :: Map (Qualified Ident) (SourceType, NameKind, NameVisibility)
- types :: Map (Qualified (ProperName TypeName)) (SourceKind, TypeKind)
- dataConstructors :: Map (Qualified (ProperName ConstructorName)) (DataDeclType, ProperName TypeName, SourceType, [Ident])
- typeSynonyms :: Map (Qualified (ProperName TypeName)) ([(Text, Maybe SourceKind)], SourceType)
- typeClassDictionaries :: Map (Maybe ModuleName) (Map (Qualified (ProperName ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict)))
- typeClasses :: Map (Qualified (ProperName ClassName)) TypeClassData
- kinds :: Set (Qualified (ProperName KindName))
- initEnvironment :: Environment
- makeTypeClassData :: [(Text, Maybe SourceKind)] -> [(Ident, SourceType)] -> [SourceConstraint] -> [FunctionalDependency] -> TypeClassData
- showDataDeclType :: DataDeclType -> Text
- primName :: Text -> Qualified (ProperName a)
- primSubName :: Text -> Text -> Qualified (ProperName a)
- primKind :: Text -> SourceKind
- primSubKind :: Text -> Text -> SourceKind
- kindType :: SourceKind
- kindConstraint :: SourceKind
- isKindType :: Kind a -> Bool
- (-:>) :: SourceKind -> SourceKind -> SourceKind
- kindSymbol :: SourceKind
- kindDoc :: SourceKind
- kindBoolean :: SourceKind
- kindOrdering :: SourceKind
- kindRowList :: SourceKind
- kindRow :: SourceKind -> SourceKind
- primTy :: Text -> SourceType
- tyFunction :: SourceType
- tyString :: SourceType
- tyChar :: SourceType
- tyNumber :: SourceType
- tyInt :: SourceType
- tyBoolean :: SourceType
- tyArray :: SourceType
- tyRecord :: SourceType
- isObject :: Type a -> Bool
- isFunction :: Type a -> Bool
- isTypeOrApplied :: Type a -> Type b -> Bool
- function :: SourceType -> SourceType -> SourceType
- primKinds :: Set (Qualified (ProperName KindName))
- primBooleanKinds :: Set (Qualified (ProperName KindName))
- primOrderingKinds :: Set (Qualified (ProperName KindName))
- primRowListKinds :: Set (Qualified (ProperName KindName))
- primTypeErrorKinds :: Set (Qualified (ProperName KindName))
- allPrimKinds :: Set (Qualified (ProperName KindName))
- primTypes :: Map (Qualified (ProperName TypeName)) (SourceKind, TypeKind)
- allPrimTypes :: Map (Qualified (ProperName TypeName)) (SourceKind, TypeKind)
- primBooleanTypes :: Map (Qualified (ProperName TypeName)) (SourceKind, TypeKind)
- primOrderingTypes :: Map (Qualified (ProperName TypeName)) (SourceKind, TypeKind)
- primRowTypes :: Map (Qualified (ProperName TypeName)) (SourceKind, TypeKind)
- primRowListTypes :: Map (Qualified (ProperName TypeName)) (SourceKind, TypeKind)
- primSymbolTypes :: Map (Qualified (ProperName TypeName)) (SourceKind, TypeKind)
- primTypeErrorTypes :: Map (Qualified (ProperName TypeName)) (SourceKind, TypeKind)
- primClasses :: Map (Qualified (ProperName ClassName)) TypeClassData
- allPrimClasses :: 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
- lookupConstructor :: Environment -> Qualified (ProperName ConstructorName) -> (DataDeclType, ProperName TypeName, SourceType, [Ident])
- isNewtypeConstructor :: Environment -> Qualified (ProperName ConstructorName) -> Bool
- lookupValue :: Environment -> Qualified Ident -> Maybe (SourceType, NameKind, NameVisibility)
- data Binder
- = NullBinder
- | LiteralBinder SourceSpan (Literal Binder)
- | VarBinder SourceSpan Ident
- | ConstructorBinder SourceSpan (Qualified (ProperName ConstructorName)) [Binder]
- | OpBinder SourceSpan (Qualified (OpName ValueOpName))
- | BinaryNoParensBinder Binder Binder Binder
- | ParensInBinder Binder
- | NamedBinder SourceSpan Ident Binder
- | PositionedBinder SourceSpan [Comment] Binder
- | TypedBinder SourceType Binder
- binderNames :: Binder -> [Ident]
- isIrrefutable :: Binder -> Bool
- newtype AssocList k t = AssocList {
- runAssocList :: [(k, t)]
- data PathNode t
- newtype PathTree t = PathTree (AssocList PSString (PathNode t))
- data DoNotationElement
- data CaseAlternative = CaseAlternative {}
- data WhereProvenance
- data Expr
- = Literal SourceSpan (Literal Expr)
- | UnaryMinus SourceSpan Expr
- | BinaryNoParens Expr Expr Expr
- | Parens Expr
- | Accessor PSString Expr
- | ObjectUpdate Expr [(PSString, Expr)]
- | ObjectUpdateNested Expr (PathTree Expr)
- | Abs Binder Expr
- | App Expr Expr
- | Var SourceSpan (Qualified Ident)
- | Op SourceSpan (Qualified (OpName ValueOpName))
- | IfThenElse Expr Expr Expr
- | Constructor SourceSpan (Qualified (ProperName ConstructorName))
- | Case [Expr] [CaseAlternative]
- | TypedValue Bool Expr SourceType
- | Let WhereProvenance [Declaration] Expr
- | Do (Maybe ModuleName) [DoNotationElement]
- | Ado (Maybe ModuleName) [DoNotationElement] Expr
- | TypeClassDictionaryConstructorApp (Qualified (ProperName ClassName)) Expr
- | TypeClassDictionary SourceConstraint (Map (Maybe ModuleName) (Map (Qualified (ProperName ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict)))) [ErrorMessageHint]
- | TypeClassDictionaryAccessor (Qualified (ProperName ClassName)) Ident
- | DeferredDictionary (Qualified (ProperName ClassName)) [SourceType]
- | AnonymousArgument
- | Hole Text
- | PositionedValue SourceSpan [Comment] Expr
- data GuardedExpr = GuardedExpr [Guard] Expr
- data Guard
- data TypeInstanceBody
- data TypeFixity = TypeFixity Fixity (Qualified (ProperName TypeName)) (OpName TypeOpName)
- data ValueFixity = ValueFixity Fixity (Qualified (Either Ident (ProperName ConstructorName))) (OpName ValueOpName)
- data Declaration
- = DataDeclaration SourceAnn DataDeclType (ProperName TypeName) [(Text, Maybe SourceKind)] [(ProperName ConstructorName, [(Ident, SourceType)])]
- | DataBindingGroupDeclaration (NonEmpty Declaration)
- | TypeSynonymDeclaration SourceAnn (ProperName TypeName) [(Text, Maybe SourceKind)] SourceType
- | TypeDeclaration !TypeDeclarationData
- | ValueDeclaration !(ValueDeclarationData [GuardedExpr])
- | BoundValueDeclaration SourceAnn Binder Expr
- | BindingGroupDeclaration (NonEmpty ((SourceAnn, Ident), NameKind, Expr))
- | ExternDeclaration SourceAnn Ident SourceType
- | ExternDataDeclaration SourceAnn (ProperName TypeName) SourceKind
- | ExternKindDeclaration SourceAnn (ProperName KindName)
- | FixityDeclaration SourceAnn (Either ValueFixity TypeFixity)
- | ImportDeclaration SourceAnn ModuleName ImportDeclarationType (Maybe ModuleName)
- | TypeClassDeclaration SourceAnn (ProperName ClassName) [(Text, Maybe SourceKind)] [SourceConstraint] [FunctionalDependency] [Declaration]
- | TypeInstanceDeclaration SourceAnn [Ident] Integer Ident [SourceConstraint] (Qualified (ProperName ClassName)) [SourceType] TypeInstanceBody
- data ValueDeclarationData a = ValueDeclarationData {
- valdeclSourceAnn :: !SourceAnn
- valdeclIdent :: !Ident
- valdeclName :: !NameKind
- valdeclBinders :: ![Binder]
- valdeclExpression :: !a
- data TypeDeclarationData = TypeDeclarationData {
- tydeclSourceAnn :: !SourceAnn
- tydeclIdent :: !Ident
- tydeclType :: !SourceType
- data ImportDeclarationType
- data ExportSource = ExportSource {}
- data DeclarationRef
- = TypeRef SourceSpan (ProperName TypeName) (Maybe [ProperName ConstructorName])
- | TypeOpRef SourceSpan (OpName TypeOpName)
- | ValueRef SourceSpan Ident
- | ValueOpRef SourceSpan (OpName ValueOpName)
- | TypeClassRef SourceSpan (ProperName ClassName)
- | TypeInstanceRef SourceSpan Ident
- | ModuleRef SourceSpan ModuleName
- | KindRef SourceSpan (ProperName KindName)
- | ReExportRef SourceSpan ExportSource DeclarationRef
- data Module = Module SourceSpan [Comment] ModuleName [Declaration] (Maybe [DeclarationRef])
- data ErrorMessage = ErrorMessage [ErrorMessageHint] SimpleErrorMessage
- data HintCategory
- data ErrorMessageHint
- = ErrorUnifyingTypes SourceType SourceType
- | ErrorInExpression Expr
- | ErrorInModule ModuleName
- | ErrorInInstance (Qualified (ProperName ClassName)) [SourceType]
- | ErrorInSubsumption SourceType SourceType
- | ErrorCheckingAccessor Expr PSString
- | ErrorCheckingType Expr SourceType
- | ErrorCheckingKind SourceType
- | ErrorCheckingGuard
- | ErrorInferringType Expr
- | ErrorInApplication Expr SourceType Expr
- | ErrorInDataConstructor (ProperName ConstructorName)
- | ErrorInTypeConstructor (ProperName TypeName)
- | ErrorInBindingGroup (NonEmpty Ident)
- | ErrorInDataBindingGroup [ProperName TypeName]
- | ErrorInTypeSynonym (ProperName TypeName)
- | ErrorInValueDeclaration Ident
- | ErrorInTypeDeclaration Ident
- | ErrorInTypeClassDeclaration (ProperName ClassName)
- | ErrorInForeignImport Ident
- | ErrorSolvingConstraint SourceConstraint
- | PositionedError (NonEmpty SourceSpan)
- data SimpleErrorMessage
- = ModuleNotFound ModuleName
- | ErrorParsingFFIModule FilePath (Maybe ErrorMessage)
- | ErrorParsingModule ParseError
- | ErrorParsingCSTModule ParserError
- | MissingFFIModule ModuleName
- | UnnecessaryFFIModule ModuleName FilePath
- | MissingFFIImplementations ModuleName [Ident]
- | UnusedFFIImplementations ModuleName [Ident]
- | InvalidFFIIdentifier ModuleName Text
- | CannotGetFileInfo FilePath
- | CannotReadFile FilePath
- | CannotWriteFile FilePath
- | InfiniteType SourceType
- | InfiniteKind SourceKind
- | MultipleValueOpFixities (OpName ValueOpName)
- | MultipleTypeOpFixities (OpName TypeOpName)
- | OrphanTypeDeclaration Ident
- | RedefinedIdent Ident
- | OverlappingNamesInLet
- | UnknownName (Qualified Name)
- | UnknownImport ModuleName Name
- | UnknownImportDataConstructor ModuleName (ProperName TypeName) (ProperName ConstructorName)
- | UnknownExport Name
- | UnknownExportDataConstructor (ProperName TypeName) (ProperName ConstructorName)
- | ScopeConflict Name [ModuleName]
- | ScopeShadowing Name (Maybe ModuleName) [ModuleName]
- | DeclConflict Name Name
- | ExportConflict (Qualified Name) (Qualified Name)
- | DuplicateModule ModuleName
- | DuplicateTypeClass (ProperName ClassName) SourceSpan
- | DuplicateInstance Ident SourceSpan
- | DuplicateTypeArgument Text
- | InvalidDoBind
- | InvalidDoLet
- | CycleInDeclaration Ident
- | CycleInTypeSynonym (Maybe (ProperName TypeName))
- | CycleInTypeClassDeclaration [Qualified (ProperName ClassName)]
- | CycleInModules [ModuleName]
- | NameIsUndefined Ident
- | UndefinedTypeVariable (ProperName TypeName)
- | PartiallyAppliedSynonym (Qualified (ProperName TypeName))
- | EscapedSkolem Text (Maybe SourceSpan) SourceType
- | TypesDoNotUnify SourceType SourceType
- | KindsDoNotUnify SourceKind SourceKind
- | ConstrainedTypeUnified SourceType SourceType
- | OverlappingInstances (Qualified (ProperName ClassName)) [SourceType] [Qualified Ident]
- | NoInstanceFound SourceConstraint
- | AmbiguousTypeVariables SourceType SourceConstraint
- | UnknownClass (Qualified (ProperName ClassName))
- | PossiblyInfiniteInstance (Qualified (ProperName ClassName)) [SourceType]
- | CannotDerive (Qualified (ProperName ClassName)) [SourceType]
- | InvalidDerivedInstance (Qualified (ProperName ClassName)) [SourceType] Int
- | ExpectedTypeConstructor (Qualified (ProperName ClassName)) [SourceType] SourceType
- | InvalidNewtypeInstance (Qualified (ProperName ClassName)) [SourceType]
- | MissingNewtypeSuperclassInstance (Qualified (ProperName ClassName)) (Qualified (ProperName ClassName)) [SourceType]
- | UnverifiableSuperclassInstance (Qualified (ProperName ClassName)) (Qualified (ProperName ClassName)) [SourceType]
- | CannotFindDerivingType (ProperName TypeName)
- | DuplicateLabel Label (Maybe Expr)
- | DuplicateValueDeclaration Ident
- | ArgListLengthsDiffer Ident
- | OverlappingArgNames (Maybe Ident)
- | MissingClassMember (NonEmpty (Ident, SourceType))
- | ExtraneousClassMember Ident (Qualified (ProperName ClassName))
- | ExpectedType SourceType SourceKind
- | IncorrectConstructorArity (Qualified (ProperName ConstructorName)) Int Int
- | ExprDoesNotHaveType Expr SourceType
- | PropertyIsMissing Label
- | AdditionalProperty Label
- | TypeSynonymInstance
- | OrphanInstance Ident (Qualified (ProperName ClassName)) (Set ModuleName) [SourceType]
- | InvalidNewtype (ProperName TypeName)
- | InvalidInstanceHead SourceType
- | TransitiveExportError DeclarationRef [DeclarationRef]
- | TransitiveDctorExportError DeclarationRef (ProperName ConstructorName)
- | ShadowedName Ident
- | ShadowedTypeVar Text
- | UnusedTypeVar Text
- | WildcardInferredType SourceType Context
- | HoleInferredType Text SourceType Context (Maybe TypeSearch)
- | MissingTypeDeclaration Ident SourceType
- | OverlappingPattern [[Binder]] Bool
- | IncompleteExhaustivityCheck
- | MisleadingEmptyTypeImport ModuleName (ProperName TypeName)
- | ImportHidingModule ModuleName
- | UnusedImport ModuleName
- | UnusedExplicitImport ModuleName [Name] (Maybe ModuleName) [DeclarationRef]
- | UnusedDctorImport ModuleName (ProperName TypeName) (Maybe ModuleName) [DeclarationRef]
- | UnusedDctorExplicitImport ModuleName (ProperName TypeName) [ProperName ConstructorName] (Maybe ModuleName) [DeclarationRef]
- | DuplicateSelectiveImport ModuleName
- | DuplicateImport ModuleName ImportDeclarationType (Maybe ModuleName)
- | DuplicateImportRef Name
- | DuplicateExportRef Name
- | IntOutOfRange Integer Text Integer Integer
- | ImplicitQualifiedImport ModuleName ModuleName [DeclarationRef]
- | ImplicitQualifiedImportReExport ModuleName ModuleName [DeclarationRef]
- | ImplicitImport ModuleName [DeclarationRef]
- | HidingImport ModuleName [DeclarationRef]
- | CaseBinderLengthDiffers Int [Binder]
- | IncorrectAnonymousArgument
- | InvalidOperatorInBinder (Qualified (OpName ValueOpName)) (Qualified Ident)
- | CannotGeneralizeRecursiveFunction Ident SourceType
- | CannotDeriveNewtypeForData (ProperName TypeName)
- | ExpectedWildcard (ProperName TypeName)
- | CannotUseBindWithDo Ident
- | ClassInstanceArityMismatch Ident (Qualified (ProperName ClassName)) Int Int
- | UserDefinedWarning SourceType
- | UnusableDeclaration Ident [[Text]]
- | CannotDefinePrimModules ModuleName
- | MixedAssociativityError (NonEmpty (Qualified (OpName AnyOpName), Associativity))
- | NonAssociativeError (NonEmpty (Qualified (OpName AnyOpName)))
- data TypeSearch
- = TSBefore Environment
- | TSAfter {
- tsAfterIdentifiers :: [(Qualified Text, SourceType)]
- tsAfterRecordFields :: Maybe [(Label, SourceType)]
- type Context = [(Ident, SourceType)]
- pattern MkUnguarded :: Expr -> GuardedExpr
- pattern TypeFixityDeclaration :: SourceAnn -> Fixity -> Qualified (ProperName TypeName) -> OpName TypeOpName -> Declaration
- pattern ValueFixityDeclaration :: SourceAnn -> Fixity -> Qualified (Either Ident (ProperName ConstructorName)) -> OpName ValueOpName -> Declaration
- pattern ValueDecl :: SourceAnn -> Ident -> NameKind -> [Binder] -> [GuardedExpr] -> Declaration
- onTypeSearchTypes :: (SourceType -> SourceType) -> TypeSearch -> TypeSearch
- onTypeSearchTypesM :: Applicative m => (SourceType -> m SourceType) -> TypeSearch -> m TypeSearch
- getModuleName :: Module -> ModuleName
- getModuleSourceSpan :: Module -> SourceSpan
- getModuleDeclarations :: Module -> [Declaration]
- addDefaultImport :: Qualified ModuleName -> Module -> Module
- importPrim :: Module -> Module
- compDecRef :: DeclarationRef -> DeclarationRef -> Ordering
- 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)
- getKindRef :: DeclarationRef -> Maybe (ProperName KindName)
- isModuleRef :: DeclarationRef -> Bool
- isImplicit :: ImportDeclarationType -> Bool
- isExplicit :: ImportDeclarationType -> Bool
- overTypeDeclaration :: (TypeDeclarationData -> TypeDeclarationData) -> Declaration -> Declaration
- getTypeDeclaration :: Declaration -> Maybe TypeDeclarationData
- unwrapTypeDeclaration :: TypeDeclarationData -> (Ident, SourceType)
- overValueDeclaration :: (ValueDeclarationData [GuardedExpr] -> ValueDeclarationData [GuardedExpr]) -> Declaration -> Declaration
- getValueDeclaration :: Declaration -> Maybe (ValueDeclarationData [GuardedExpr])
- mapTypeInstanceBody :: ([Declaration] -> [Declaration]) -> TypeInstanceBody -> TypeInstanceBody
- traverseTypeInstanceBody :: Applicative f => ([Declaration] -> f [Declaration]) -> TypeInstanceBody -> f TypeInstanceBody
- declSourceAnn :: Declaration -> SourceAnn
- declSourceSpan :: Declaration -> SourceSpan
- declName :: Declaration -> Maybe Name
- isValueDecl :: Declaration -> Bool
- isDataDecl :: Declaration -> Bool
- isImportDecl :: Declaration -> Bool
- isExternDataDecl :: Declaration -> Bool
- isExternKindDecl :: Declaration -> Bool
- isFixityDecl :: Declaration -> Bool
- getFixityDecl :: Declaration -> Maybe (Either ValueFixity TypeFixity)
- isExternDecl :: Declaration -> Bool
- isTypeClassInstanceDeclaration :: Declaration -> Bool
- isTypeClassDeclaration :: Declaration -> Bool
- flattenDecls :: [Declaration] -> [Declaration]
- isTrueExpr :: Expr -> Bool
- data ScopedIdent
- 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)
- 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)
- accumKinds :: Monoid r => (SourceKind -> r) -> (Declaration -> r, Expr -> r, Binder -> r, CaseAlternative -> r, DoNotationElement -> r)
- overTypes :: (SourceType -> SourceType) -> Expr -> Expr
- exportedDeclarations :: Module -> [Declaration]
- isExported :: Maybe [DeclarationRef] -> Declaration -> Bool
- desugarLetPatternModule :: Module -> Module
- prettyPrintKind :: Kind a -> Text
- type PrettyPrintConstraint = (Qualified (ProperName ClassName), [PrettyPrintType])
- data PrettyPrintType
- = PPTUnknown Int
- | PPTypeVar Text
- | PPTypeLevelString PSString
- | PPTypeWildcard (Maybe Text)
- | PPTypeConstructor (Qualified (ProperName TypeName))
- | PPTypeOp (Qualified (OpName TypeOpName))
- | PPSkolem Text Int
- | PPTypeApp PrettyPrintType PrettyPrintType
- | PPConstrainedType PrettyPrintConstraint PrettyPrintType
- | PPKindedType PrettyPrintType (Kind ())
- | PPBinaryNoParensType PrettyPrintType PrettyPrintType PrettyPrintType
- | PPParensInType PrettyPrintType
- | PPForAll [(Text, Maybe (Kind ()))] PrettyPrintType
- | PPFunction PrettyPrintType PrettyPrintType
- | PPRecord [(Label, PrettyPrintType)] (Maybe PrettyPrintType)
- | PPRow [(Label, PrettyPrintType)] (Maybe PrettyPrintType)
- | PPTruncated
- convertPrettyPrintType :: Int -> Type a -> PrettyPrintType
- typeAtomAsBox :: Int -> Type a -> Box
- prettyPrintTypeAtom :: Int -> Type a -> String
- typeAsBox :: Int -> Type a -> Box
- suggestedTypeAsBox :: PrettyPrintType -> Box
- prettyPrintType :: Int -> Type a -> String
- prettyPrintTypeWithUnicode :: Int -> Type a -> String
- prettyPrintSuggestedType :: Type a -> String
- prettyPrintLabel :: Label -> Text
- prettyPrintObjectKey :: PSString -> Text
- prettyPrintValue :: Int -> Expr -> Box
- prettyPrintBinderAtom :: Binder -> Text
- prettyPrintBinder :: Binder -> Text
- data ExternsDeclaration
- = EDType { }
- | EDTypeSynonym { }
- | EDDataConstructor { }
- | EDValue { }
- | EDClass { }
- | EDInstance { }
- | EDKind { }
- data ExternsTypeFixity = ExternsTypeFixity {}
- data ExternsFixity = ExternsFixity {}
- data ExternsImport = ExternsImport {}
- data ExternsFile = ExternsFile {}
- applyExternsFileToEnvironment :: ExternsFile -> Environment -> Environment
- moduleToExternsFile :: Module -> Environment -> ExternsFile
- decodeExterns :: ByteString -> Maybe ExternsFile
- data PPEOptions = PPEOptions {}
- data Level
- data TypeMap = TypeMap {
- umSkolemMap :: Map Int (String, Int, Maybe SourceSpan)
- umUnknownMap :: Map Int Int
- umNextIndex :: Int
- newtype MultipleErrors = MultipleErrors {}
- newtype ErrorSuggestion = ErrorSuggestion Text
- errorSpan :: ErrorMessage -> Maybe (NonEmpty SourceSpan)
- errorModule :: ErrorMessage -> Maybe ModuleName
- findHint :: (ErrorMessageHint -> Maybe a) -> ErrorMessage -> Maybe a
- stripModuleAndSpan :: ErrorMessage -> ErrorMessage
- errorCode :: ErrorMessage -> Text
- nonEmpty :: MultipleErrors -> Bool
- errorMessage :: SimpleErrorMessage -> MultipleErrors
- errorMessage' :: SourceSpan -> SimpleErrorMessage -> MultipleErrors
- errorMessage'' :: NonEmpty SourceSpan -> SimpleErrorMessage -> MultipleErrors
- errorMessage''' :: [SourceSpan] -> SimpleErrorMessage -> MultipleErrors
- singleError :: ErrorMessage -> MultipleErrors
- onErrorMessages :: (ErrorMessage -> ErrorMessage) -> MultipleErrors -> MultipleErrors
- addHint :: ErrorMessageHint -> MultipleErrors -> MultipleErrors
- addHints :: [ErrorMessageHint] -> MultipleErrors -> MultipleErrors
- defaultUnknownMap :: TypeMap
- unwrapErrorMessage :: ErrorMessage -> SimpleErrorMessage
- replaceUnknowns :: SourceType -> State TypeMap SourceType
- onTypesInErrorMessage :: (SourceType -> SourceType) -> ErrorMessage -> ErrorMessage
- onTypesInErrorMessageM :: Applicative m => (SourceType -> m SourceType) -> ErrorMessage -> m ErrorMessage
- errorDocUri :: ErrorMessage -> Text
- errorSuggestion :: SimpleErrorMessage -> Maybe ErrorSuggestion
- suggestionSpan :: ErrorMessage -> Maybe SourceSpan
- showSuggestion :: SimpleErrorMessage -> Text
- ansiColor :: (ColorIntensity, Color) -> String
- ansiColorReset :: String
- colorCode :: Maybe (ColorIntensity, Color) -> Text -> Text
- colorCodeBox :: Maybe (ColorIntensity, Color) -> Box -> Box
- defaultCodeColor :: (ColorIntensity, Color)
- defaultPPEOptions :: PPEOptions
- prettyPrintSingleError :: PPEOptions -> ErrorMessage -> Box
- prettyPrintExport :: DeclarationRef -> Text
- prettyPrintImport :: ModuleName -> ImportDeclarationType -> Maybe ModuleName -> Text
- prettyPrintRef :: DeclarationRef -> Maybe Text
- prettyPrintMultipleErrors :: PPEOptions -> MultipleErrors -> String
- prettyPrintMultipleWarnings :: PPEOptions -> MultipleErrors -> String
- prettyPrintMultipleWarningsBox :: PPEOptions -> MultipleErrors -> [Box]
- prettyPrintMultipleErrorsBox :: PPEOptions -> MultipleErrors -> [Box]
- prettyPrintMultipleErrorsWith :: PPEOptions -> String -> String -> MultipleErrors -> [Box]
- prettyPrintParseError :: ParseError -> Box
- prettyPrintParseErrorMessages :: String -> String -> String -> String -> String -> [Message] -> Box
- line :: Text -> Box
- lineS :: String -> Box
- renderBox :: Box -> String
- toTypelevelString :: Type a -> Maybe Box
- rethrow :: MonadError e m => (e -> e) -> m a -> m a
- reifyErrors :: MonadError e m => m a -> m (Either e a)
- reflectErrors :: MonadError e m => m (Either e a) -> m a
- warnAndRethrow :: (MonadError e m, MonadWriter e m) => (e -> e) -> m a -> m a
- rethrowWithPosition :: MonadError MultipleErrors m => SourceSpan -> m a -> m a
- warnWithPosition :: MonadWriter MultipleErrors m => SourceSpan -> m a -> m a
- warnAndRethrowWithPosition :: (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => SourceSpan -> m a -> m a
- withPosition :: SourceSpan -> ErrorMessage -> ErrorMessage
- positionedError :: SourceSpan -> ErrorMessageHint
- filterErrors :: (ErrorMessage -> Bool) -> MultipleErrors -> MultipleErrors
- escalateWarningWhen :: (MonadWriter MultipleErrors m, MonadError MultipleErrors m) => (ErrorMessage -> Bool) -> m a -> m a
- parU :: forall m a b. MonadError MultipleErrors m => [a] -> (a -> m b) -> m [b]
- type Unknown = Int
- data CheckState = CheckState {}
- data Substitution = Substitution {}
- emptySubstitution :: Substitution
- emptyCheckState :: Environment -> CheckState
- bindNames :: MonadState CheckState m => Map (Qualified Ident) (SourceType, NameKind, NameVisibility) -> m a -> m a
- bindTypes :: MonadState CheckState m => Map (Qualified (ProperName TypeName)) (SourceKind, TypeKind) -> m a -> m a
- withScopedTypeVars :: (MonadState CheckState m, MonadWriter MultipleErrors m) => ModuleName -> [(Text, SourceKind)] -> m a -> m a
- withErrorMessageHint :: (MonadState CheckState m, MonadError MultipleErrors m) => ErrorMessageHint -> m a -> m a
- getHints :: MonadState CheckState m => m [ErrorMessageHint]
- rethrowWithPositionTC :: (MonadState CheckState m, MonadError MultipleErrors m) => SourceSpan -> m a -> m a
- warnAndRethrowWithPositionTC :: (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => SourceSpan -> m a -> m a
- withTypeClassDictionaries :: MonadState CheckState m => [NamedDict] -> m a -> m a
- getTypeClassDictionaries :: MonadState CheckState m => m (Map (Maybe ModuleName) (Map (Qualified (ProperName ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict))))
- lookupTypeClassDictionaries :: MonadState CheckState m => Maybe ModuleName -> m (Map (Qualified (ProperName ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict)))
- lookupTypeClassDictionariesForClass :: MonadState CheckState m => Maybe ModuleName -> Qualified (ProperName ClassName) -> m (Map (Qualified Ident) (NonEmpty NamedDict))
- bindLocalVariables :: MonadState CheckState m => [(Ident, SourceType, NameVisibility)] -> m a -> m a
- bindLocalTypeVariables :: MonadState CheckState m => ModuleName -> [(ProperName TypeName, SourceKind)] -> m a -> m a
- makeBindingGroupVisible :: MonadState CheckState m => m ()
- withBindingGroupVisible :: MonadState CheckState m => m a -> m a
- preservingNames :: MonadState CheckState m => m a -> m a
- lookupVariable :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => Qualified Ident -> m SourceType
- getVisibility :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => Qualified Ident -> m NameVisibility
- checkVisibility :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => Qualified Ident -> m ()
- lookupTypeVariable :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => ModuleName -> Qualified (ProperName TypeName) -> m SourceKind
- getEnv :: MonadState CheckState m => m Environment
- getLocalContext :: MonadState CheckState m => m Context
- putEnv :: MonadState CheckState m => Environment -> m ()
- modifyEnv :: MonadState CheckState m => (Environment -> Environment) -> m ()
- runCheck :: Functor m => StateT CheckState m a -> m (a, Environment)
- runCheck' :: Functor m => CheckState -> StateT CheckState m a -> m (a, Environment)
- guardWith :: MonadError e m => e -> Bool -> m ()
- captureSubstitution :: MonadState CheckState m => m a -> m (a, Substitution)
- capturingSubstitution :: MonadState CheckState m => (a -> Substitution -> b) -> m a -> m b
- withFreshSubstitution :: MonadState CheckState m => m a -> m a
- withoutWarnings :: MonadWriter w m => m a -> m (a, w)
- unsafeCheckCurrentModule :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) => m ModuleName
- type SynonymMap = Map (Qualified (ProperName TypeName)) ([(Text, Maybe SourceKind)], SourceType)
- replaceAllTypeSynonyms :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => SourceType -> m SourceType
- replaceAllTypeSynonymsM :: MonadError MultipleErrors m => SynonymMap -> SourceType -> m SourceType
- kindOf :: (MonadError MultipleErrors m, MonadState CheckState m) => SourceType -> m SourceKind
- kindOfWithScopedVars :: (MonadError MultipleErrors m, MonadState CheckState m) => SourceType -> m (SourceKind, [(Text, SourceKind)])
- kindsOf :: (MonadError MultipleErrors m, MonadState CheckState m) => Bool -> ModuleName -> ProperName TypeName -> [(Text, Maybe SourceKind)] -> [SourceType] -> m SourceKind
- kindsOfAll :: (MonadError MultipleErrors m, MonadState CheckState m) => ModuleName -> [(SourceAnn, ProperName TypeName, [(Text, Maybe SourceKind)], SourceType)] -> [(SourceAnn, ProperName TypeName, [(Text, Maybe SourceKind)], [SourceType])] -> m ([SourceKind], [SourceKind])
- data BindingGroupType
- typesOf :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => BindingGroupType -> ModuleName -> [((SourceAnn, Ident), Expr)] -> m [((SourceAnn, Ident), (Expr, SourceType))]
- desugarTypeDeclarationsModule :: forall m. MonadError MultipleErrors m => Module -> m Module
- desugarSignedLiterals :: Module -> Module
- rebracket :: forall m. MonadError MultipleErrors m => [ExternsFile] -> [Module] -> m [Module]
- rebracketFiltered :: forall m. MonadError MultipleErrors m => (Declaration -> Bool) -> [ExternsFile] -> [Module] -> m [Module]
- checkFixityExports :: forall m. MonadError MultipleErrors m => Module -> m Module
- desugarObjectConstructors :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Module -> m Module
- desugarDecl :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Declaration -> m Declaration
- type Env = Map ModuleName (SourceSpan, Imports, Exports)
- data Exports = Exports {
- exportedTypes :: Map (ProperName TypeName) ([ProperName ConstructorName], ExportSource)
- exportedTypeOps :: Map (OpName TypeOpName) ExportSource
- exportedTypeClasses :: Map (ProperName ClassName) ExportSource
- exportedValues :: Map Ident ExportSource
- exportedValueOps :: Map (OpName ValueOpName) ExportSource
- exportedKinds :: Map (ProperName KindName) ExportSource
- data Imports = Imports {
- importedTypes :: ImportMap (ProperName TypeName)
- importedTypeOps :: ImportMap (OpName TypeOpName)
- importedDataConstructors :: ImportMap (ProperName ConstructorName)
- importedTypeClasses :: ImportMap (ProperName ClassName)
- importedValues :: ImportMap Ident
- importedValueOps :: ImportMap (OpName ValueOpName)
- importedModules :: Set ModuleName
- importedQualModules :: Set ModuleName
- importedKinds :: ImportMap (ProperName KindName)
- data ImportProvenance
- data ImportRecord a = ImportRecord {}
- primEnv :: Env
- desugarDoModule :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Module -> m Module
- desugarCasesModule :: (MonadSupply m, MonadError MultipleErrors m) => Module -> m Module
- desugarCaseGuards :: forall m. (MonadSupply m, MonadError MultipleErrors m) => [Declaration] -> m [Declaration]
- desugarCases :: forall m. (MonadSupply m, MonadError MultipleErrors m) => [Declaration] -> m [Declaration]
- desugarTypeClasses :: (MonadSupply m, MonadError MultipleErrors m) => [ExternsFile] -> [Module] -> m [Module]
- typeClassMemberName :: Declaration -> Text
- superClassDictionaryNames :: [Constraint a] -> [Text]
- createBindingGroupsModule :: MonadError MultipleErrors m => Module -> m Module
- collapseBindingGroupsModule :: [Module] -> [Module]
- createBindingGroups :: forall m. MonadError MultipleErrors m => ModuleName -> [Declaration] -> m [Declaration]
- collapseBindingGroups :: [Declaration] -> [Declaration]
- desugarAdoModule :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Module -> m Module
- data ModuleSignature = ModuleSignature {}
- type ModuleGraph = [(ModuleName, [ModuleName])]
- sortModules :: forall m a. MonadError MultipleErrors m => (a -> ModuleSignature) -> [a] -> m ([a], ModuleGraph)
- moduleSignature :: Module -> ModuleSignature
- newtype Make a = Make {}
- runMake :: Options -> Make a -> IO (Either MultipleErrors a, MultipleErrors)
- makeIO :: (IOError -> ErrorMessage) -> IO a -> Make a
- readTextFile :: FilePath -> Make ByteString
- type UsedImports = Map ModuleName [Qualified Name]
- lintImports :: forall m. MonadWriter MultipleErrors m => Module -> Env -> UsedImports -> m ()
- desugarImports :: forall m. (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => [ExternsFile] -> [Module] -> m [Module]
- desugarImportsWithEnv :: forall m. (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => [ExternsFile] -> [Module] -> m (Env, [Module])
- checkExhaustiveExpr :: forall m. (MonadWriter MultipleErrors m, MonadSupply m) => SourceSpan -> Environment -> ModuleName -> Expr -> m Expr
- lint :: forall m. MonadWriter MultipleErrors m => Module -> m ()
- checkNewtype :: forall m. MonadError MultipleErrors m => ProperName TypeName -> [(ProperName ConstructorName, [(Ident, SourceType)])] -> m ()
- typeCheckModule :: forall m. (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => Module -> m Module
- deriveInstances :: forall m. (MonadError MultipleErrors m, MonadWriter MultipleErrors m, MonadSupply m) => [ExternsFile] -> Module -> m Module
- desugar :: (MonadSupply m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => [ExternsFile] -> [Module] -> m [Module]
- renameInModules :: [Module Ann] -> [Module Ann]
- data MakeActions m = MakeActions {
- getInputTimestamp :: ModuleName -> m (Either RebuildPolicy (Maybe UTCTime))
- getOutputTimestamp :: ModuleName -> m (Maybe UTCTime)
- readExterns :: ModuleName -> m (FilePath, Externs)
- codegen :: Module Ann -> Module -> Externs -> SupplyT m ()
- ffiCodegen :: Module Ann -> m ()
- progress :: ProgressMessage -> m ()
- type Externs = ByteString
- data ProgressMessage = CompilingModule ModuleName
- data RebuildPolicy
- buildMakeActions :: FilePath -> Map ModuleName (Either RebuildPolicy FilePath) -> Map ModuleName FilePath -> Bool -> MakeActions Make
- checkForeignDecls :: Module ann -> FilePath -> Make ()
- rebuildModule :: forall m. (Monad m, MonadBaseControl IO m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => MakeActions m -> [ExternsFile] -> Module -> m ExternsFile
- make :: forall m. (Monad m, MonadBaseControl IO m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => MakeActions m -> [PartialResult Module] -> m [ExternsFile]
- inferForeignModules :: forall m. MonadIO m => Map ModuleName (Either RebuildPolicy FilePath) -> m (Map ModuleName FilePath)
- version :: Version
Documentation
A space efficient, packed, unboxed Unicode text type.
Instances
Instances
MonadTrans SupplyT Source # | |
Defined in Control.Monad.Supply | |
MonadError e m => MonadError e (SupplyT m) Source # | |
Defined in Control.Monad.Supply throwError :: e -> SupplyT m a # catchError :: SupplyT m a -> (e -> SupplyT m a) -> SupplyT m a # | |
MonadReader r m => MonadReader r (SupplyT m) Source # | |
MonadWriter w m => MonadWriter w (SupplyT m) Source # | |
Monad m => Monad (SupplyT m) Source # | |
Functor m => Functor (SupplyT m) Source # | |
Monad m => Applicative (SupplyT m) Source # | |
MonadPlus m => MonadPlus (SupplyT m) Source # | |
MonadPlus m => Alternative (SupplyT m) Source # | |
Monad m => MonadSupply (SupplyT m) Source # | |
evalSupply :: Integer -> Supply a -> a Source #
Instances
data SourceSpan Source #
Instances
Source position information
SourcePos | |
|
Instances
Eq SourcePos Source # | |
Ord SourcePos Source # | |
Defined in Language.PureScript.AST.SourcePos | |
Show SourcePos Source # | |
Generic SourcePos Source # | |
NFData SourcePos Source # | |
Defined in Language.PureScript.AST.SourcePos | |
ToJSON SourcePos Source # | |
Defined in Language.PureScript.AST.SourcePos | |
FromJSON SourcePos Source # | |
type Rep SourcePos Source # | |
Defined in Language.PureScript.AST.SourcePos type Rep SourcePos = D1 (MetaData "SourcePos" "Language.PureScript.AST.SourcePos" "purescript-0.13.0-1whdl2565Nb1wvlLK7uK18" False) (C1 (MetaCons "SourcePos" PrefixI True) (S1 (MetaSel (Just "sourcePosLine") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int) :*: S1 (MetaSel (Just "sourcePosColumn") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int))) |
type SourceAnn = (SourceSpan, [Comment]) Source #
Source annotation - position information and comments.
pattern NullSourceAnn :: SourceAnn Source #
pattern NullSourceSpan :: SourceSpan Source #
displaySourcePos :: SourcePos -> Text Source #
displayStartEndPos :: SourceSpan -> Text Source #
displaySourceSpan :: FilePath -> SourceSpan -> Text Source #
nonEmptySpan :: SourceAnn -> Maybe SourceSpan Source #
widenSourceSpan :: SourceSpan -> SourceSpan -> SourceSpan Source #
type HasCallStack = HasCallStack Source #
A compatibility wrapper for the GHC.Stack.HasCallStack
constraint.
internalError :: HasCallStack => String -> a Source #
Exit with an error message and a crash report link.
Fixity data for infix operators
Instances
Eq Fixity Source # | |
Ord Fixity Source # | |
Show Fixity Source # | |
Generic Fixity Source # | |
NFData Fixity Source # | |
Defined in Language.PureScript.AST.Operators | |
ToJSON Fixity Source # | |
Defined in Language.PureScript.AST.Operators | |
type Rep Fixity Source # | |
Defined in Language.PureScript.AST.Operators type Rep Fixity = D1 (MetaData "Fixity" "Language.PureScript.AST.Operators" "purescript-0.13.0-1whdl2565Nb1wvlLK7uK18" False) (C1 (MetaCons "Fixity" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Associativity) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Precedence))) |
data Associativity Source #
Associativity for infix operators
Instances
type Precedence = Integer Source #
A precedence level for an infix operator
showAssoc :: Associativity -> String Source #
readAssoc :: String -> Associativity Source #
A qualified name, i.e. a name with an optional module name
Qualified (Maybe ModuleName) a |
Instances
newtype ModuleName Source #
Module names
Instances
data ProperNameType Source #
The closed set of proper name types.
newtype ProperName (a :: ProperNameType) Source #
Proper names, i.e. capitalized names for e.g. module names, type//data constructors.
Instances
newtype OpName (a :: OpNameType) Source #
Operator alias names.
Instances
Eq (OpName a) Source # | |
Ord (OpName a) Source # | |
Defined in Language.PureScript.Names | |
Show (OpName a) Source # | |
Generic (OpName a) Source # | |
NFData (OpName a) Source # | |
Defined in Language.PureScript.Names | |
ToJSON (OpName a) Source # | |
Defined in Language.PureScript.Names | |
FromJSON (OpName a) Source # | |
type Rep (OpName a) Source # | |
Defined in Language.PureScript.Names |
Names for value identifiers
Ident Text | An alphanumeric identifier |
GenIdent (Maybe Text) Integer | A generated name for an identifier |
UnusedIdent | A generated name used only for type-checking |
Instances
Eq Ident Source # | |
Ord Ident Source # | |
Show Ident Source # | |
Generic Ident Source # | |
NFData Ident Source # | |
Defined in Language.PureScript.Names | |
ToJSON Ident Source # | |
Defined in Language.PureScript.Names | |
FromJSON Ident Source # | |
type Rep Ident Source # | |
Defined in Language.PureScript.Names type Rep Ident = D1 (MetaData "Ident" "Language.PureScript.Names" "purescript-0.13.0-1whdl2565Nb1wvlLK7uK18" False) (C1 (MetaCons "Ident" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)) :+: (C1 (MetaCons "GenIdent" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Text)) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Integer)) :+: C1 (MetaCons "UnusedIdent" PrefixI False) (U1 :: Type -> Type))) |
A sum of the possible name types, useful for error and lint messages.
Instances
getValOpName :: Name -> Maybe (OpName ValueOpName) Source #
getTypeName :: Name -> Maybe (ProperName TypeName) Source #
getKindName :: Name -> Maybe (ProperName KindName) Source #
getTypeOpName :: Name -> Maybe (OpName TypeOpName) Source #
getDctorName :: Name -> Maybe (ProperName ConstructorName) Source #
getClassName :: Name -> Maybe (ProperName ClassName) Source #
getModName :: Name -> Maybe ModuleName Source #
freshIdent :: MonadSupply m => Text -> m Ident Source #
freshIdent' :: MonadSupply m => m Ident Source #
coerceProperName :: ProperName a -> ProperName b Source #
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.
runModuleName :: ModuleName -> Text Source #
isBuiltinModuleName :: ModuleName -> Bool Source #
qualify :: ModuleName -> Qualified a -> (ModuleName, a) Source #
Provide a default module name, if a name is unqualified
mkQualified :: a -> ModuleName -> Qualified a Source #
Makes a qualified value from a name and module name.
disqualify :: Qualified a -> a Source #
Remove the module name from a qualified name
disqualifyFor :: Maybe ModuleName -> Qualified a -> Maybe a Source #
Remove the qualification from a value when it is qualified with a particular module name.
isQualified :: Qualified a -> Bool Source #
Checks whether a qualified value is actually qualified with a module reference
isUnqualified :: Qualified a -> Bool Source #
Checks whether a qualified value is not actually qualified with a module reference
isQualifiedWith :: ModuleName -> Qualified a -> Bool Source #
Checks whether a qualified value is qualified with a particular module
The data type of kinds
KUnknown a Int | Unification variable of type Kind |
Row a (Kind a) | Kinds for labelled, unordered rows without duplicates |
FunKind a (Kind a) (Kind a) | Function kinds |
NamedKind a (Qualified (ProperName KindName)) | A named kind |
Instances
type SourceKind = Kind SourceAnn Source #
srcKUnknown :: Int -> SourceKind Source #
srcRow :: SourceKind -> SourceKind Source #
srcFunKind :: SourceKind -> SourceKind -> SourceKind Source #
srcNamedKind :: Qualified (ProperName KindName) -> SourceKind Source #
everythingOnKinds :: (r -> r -> r) -> (Kind a -> r) -> Kind a -> r Source #
annForKind :: Lens' (Kind a) a Source #
getAnnForKind :: Kind a -> a Source #
setAnnForKind :: a -> Kind a -> Kind a Source #
data CodegenTarget Source #
Instances
Eq CodegenTarget Source # | |
Defined in Language.PureScript.Options (==) :: CodegenTarget -> CodegenTarget -> Bool # (/=) :: CodegenTarget -> CodegenTarget -> Bool # | |
Ord CodegenTarget Source # | |
Defined in Language.PureScript.Options compare :: CodegenTarget -> CodegenTarget -> Ordering # (<) :: CodegenTarget -> CodegenTarget -> Bool # (<=) :: CodegenTarget -> CodegenTarget -> Bool # (>) :: CodegenTarget -> CodegenTarget -> Bool # (>=) :: CodegenTarget -> CodegenTarget -> Bool # max :: CodegenTarget -> CodegenTarget -> CodegenTarget # min :: CodegenTarget -> CodegenTarget -> CodegenTarget # | |
Show CodegenTarget Source # | |
Defined in Language.PureScript.Options showsPrec :: Int -> CodegenTarget -> ShowS # show :: CodegenTarget -> String # showList :: [CodegenTarget] -> ShowS # |
The data type of compiler options
Options | |
|
prettyPrintString :: PSString -> Text Source #
Pretty print a PSString, using Haskell/PureScript escape sequences. This is identical to the Show instance except that we get a Text out instead of a String.
Data type for literal values. Parameterised so it can be used for Exprs and Binders.
NumericLiteral (Either Integer Double) | A numeric literal |
StringLiteral PSString | A string literal |
CharLiteral Char | A character literal |
BooleanLiteral Bool | A boolean literal |
ArrayLiteral [a] | An array literal |
ObjectLiteral [(PSString, a)] | An object literal |
data RowListItem a Source #
RowListItem | |
|
Instances
data Constraint a Source #
A typeclass constraint
Constraint | |
|
Instances
data ConstraintData Source #
Additional data relevant to type class constraints
PartialConstraintData [[Text]] Bool | 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 |
Instances
The type of types
TUnknown a Int | A unification variable of type Type |
TypeVar a Text | A named type variable |
TypeLevelString a PSString | A type-level string |
TypeWildcard a (Maybe Text) | A type wildcard, as would appear in a partial type synonym |
TypeConstructor a (Qualified (ProperName TypeName)) | A type constructor |
TypeOp a (Qualified (OpName TypeOpName)) | A type operator. This will be desugared into a type constructor during the "operators" phase of desugaring. |
TypeApp a (Type a) (Type a) | A type application |
ForAll a Text (Maybe (Kind a)) (Type a) (Maybe SkolemScope) | Forall quantifier |
ConstrainedType a (Constraint a) (Type a) | A type with a set of type class constraints |
Skolem a Text Int SkolemScope | A skolem constant |
REmpty a | An empty row |
RCons a Label (Type a) (Type a) | A non-empty row |
KindedType a (Type a) (Kind a) | A type with a kind annotation |
BinaryNoParensType a (Type a) (Type a) (Type a) | Binary operator application. During the rebracketing phase of desugaring, this data constructor will be removed. |
ParensInType 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. |
Instances
newtype SkolemScope Source #
An identifier for the scope of a skolem variable
Instances
type SourceConstraint = Constraint SourceAnn Source #
type SourceType = Type SourceAnn Source #
srcTUnknown :: Int -> SourceType Source #
srcTypeVar :: Text -> SourceType Source #
srcTypeOp :: Qualified (OpName TypeOpName) -> SourceType Source #
srcTypeApp :: SourceType -> SourceType -> SourceType Source #
srcForAll :: Text -> Maybe SourceKind -> SourceType -> Maybe SkolemScope -> SourceType Source #
srcSkolem :: Text -> Int -> SkolemScope -> SourceType Source #
srcRCons :: Label -> SourceType -> SourceType -> SourceType Source #
srcKindedType :: SourceType -> SourceKind -> SourceType Source #
srcBinaryNoParensType :: SourceType -> SourceType -> SourceType -> SourceType Source #
srcConstraint :: Qualified (ProperName ClassName) -> [SourceType] -> Maybe ConstraintData -> SourceConstraint Source #
mapConstraintArgs :: ([Type a] -> [Type a]) -> Constraint a -> Constraint a Source #
overConstraintArgs :: Functor f => ([Type a] -> f [Type a]) -> Constraint a -> f (Constraint a) Source #
constraintToJSON :: (a -> Value) -> Constraint a -> Value Source #
constraintFromJSON :: forall a. Parser a -> (Value -> Parser a) -> Value -> Parser (Constraint a) Source #
srcRowListItem :: Label -> SourceType -> RowListItem SourceAnn Source #
rowToList :: Type a -> ([RowListItem a], Type a) Source #
Convert a row to a list of pairs of labels and types
rowToSortedList :: Type a -> ([RowListItem a], Type a) Source #
Convert a row to a list of pairs of labels and types, sorted by the labels.
rowFromList :: ([RowListItem a], Type a) -> Type a Source #
Convert a list of labels and types to a row
isMonoType :: Type a -> Bool Source #
Check whether a type is a monotype
replaceTypeVars :: Text -> Type a -> Type a -> Type a Source #
Replace a type variable, taking into account variable shadowing
replaceAllTypeVars :: [(Text, Type a)] -> Type a -> Type a Source #
Replace named type variables with types
usedTypeVariables :: Type a -> [Text] Source #
Collect all type variables appearing in a type
freeTypeVariables :: Type a -> [Text] Source #
Collect all free type variables appearing in a type
quantify :: Type a -> Type a Source #
Universally quantify over all type variables appearing free in a type
moveQuantifiersToFront :: Type a -> Type a Source #
Move all universal quantifiers to the front of a type
containsWildcards :: Type a -> Bool Source #
Check if a type contains wildcards
containsForAll :: Type a -> Bool Source #
Check if a type contains forall
everythingOnTypes :: (r -> r -> r) -> (Type a -> r) -> Type a -> r Source #
everythingWithContextOnTypes :: s -> r -> (r -> r -> r) -> (s -> Type a -> (s, r)) -> Type a -> r Source #
annForType :: Lens' (Type a) a Source #
getAnnForType :: Type a -> a Source #
setAnnForType :: a -> Type a -> Type a Source #
eqConstraint :: Constraint a -> Constraint b -> Bool Source #
compareConstraint :: Constraint a -> Constraint b -> Ordering Source #
data DataDeclType Source #
The type ('data' or 'newtype') of a data type declaration
Instances
The kinds of a type
DataType [(Text, Maybe SourceKind)] [(ProperName ConstructorName, [SourceType])] | Data type |
TypeSynonym | Type synonym |
ExternData | Foreign data |
LocalTypeVariable | A local type variable |
ScopedTypeVar | A scoped type variable |
Instances
A flag for whether a name is for an private or public value - only public values will be included in a generated externs file.
Private | A private value introduced as an artifact of code generation (class instances, class member accessors, etc.) |
Public | A public value for a module member or foreing import declaration |
External | A name for member introduced by foreign import |
Instances
Eq NameKind Source # | |
Show NameKind Source # | |
Generic NameKind Source # | |
NFData NameKind Source # | |
Defined in Language.PureScript.Environment | |
type Rep NameKind Source # | |
Defined in Language.PureScript.Environment type Rep NameKind = D1 (MetaData "NameKind" "Language.PureScript.Environment" "purescript-0.13.0-1whdl2565Nb1wvlLK7uK18" False) (C1 (MetaCons "Private" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "Public" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "External" PrefixI False) (U1 :: Type -> Type))) |
data NameVisibility Source #
The visibility of a name in scope
Undefined | The name is defined in the current binding group, but is not visible |
Defined | The name is defined in the another binding group, or has been made visible by a function binder |
Instances
Eq NameVisibility Source # | |
Defined in Language.PureScript.Environment (==) :: NameVisibility -> NameVisibility -> Bool # (/=) :: NameVisibility -> NameVisibility -> Bool # | |
Show NameVisibility Source # | |
Defined in Language.PureScript.Environment showsPrec :: Int -> NameVisibility -> ShowS # show :: NameVisibility -> String # showList :: [NameVisibility] -> ShowS # | |
Generic NameVisibility Source # | |
Defined in Language.PureScript.Environment type Rep NameVisibility :: Type -> Type # from :: NameVisibility -> Rep NameVisibility x # to :: Rep NameVisibility x -> NameVisibility # | |
NFData NameVisibility Source # | |
Defined in Language.PureScript.Environment rnf :: NameVisibility -> () # | |
type Rep NameVisibility Source # | |
Defined in Language.PureScript.Environment |
data FunctionalDependency Source #
A functional dependency indicates a relationship between two sets of type arguments in a class declaration.
FunctionalDependency | |
|
Instances
data TypeClassData Source #
Information about a type class
TypeClassData | |
|
Instances
data Environment Source #
The Environment
defines all values and types which are currently in scope:
Environment | |
|
Instances
initEnvironment :: Environment Source #
The initial environment with no values and only the default javascript types defined
makeTypeClassData :: [(Text, Maybe SourceKind)] -> [(Ident, SourceType)] -> [SourceConstraint] -> [FunctionalDependency] -> TypeClassData Source #
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.
showDataDeclType :: DataDeclType -> Text Source #
primSubName :: Text -> Text -> Qualified (ProperName a) Source #
Construct a ProperName
in the Prim.NAME
module.
primKind :: Text -> SourceKind Source #
primSubKind :: Text -> Text -> SourceKind Source #
kindType :: SourceKind Source #
Kind of ground types
isKindType :: Kind a -> Bool Source #
(-:>) :: SourceKind -> SourceKind -> SourceKind infixr 4 Source #
kindDoc :: SourceKind Source #
kindRow :: SourceKind -> SourceKind Source #
primTy :: Text -> SourceType Source #
Construct a type in the Prim module
tyFunction :: SourceType Source #
Type constructor for functions
tyString :: SourceType Source #
Type constructor for strings
tyChar :: SourceType Source #
Type constructor for strings
tyNumber :: SourceType Source #
Type constructor for numbers
tyInt :: SourceType Source #
Type constructor for integers
tyBoolean :: SourceType Source #
Type constructor for booleans
tyArray :: SourceType Source #
Type constructor for arrays
tyRecord :: SourceType Source #
Type constructor for records
isFunction :: Type a -> Bool Source #
Check whether a type is a function
function :: SourceType -> SourceType -> SourceType Source #
Smart constructor for function types
primBooleanKinds :: Set (Qualified (ProperName KindName)) Source #
Kinds in Prim.Boolean
primOrderingKinds :: Set (Qualified (ProperName KindName)) Source #
Kinds in Prim.Ordering
primRowListKinds :: Set (Qualified (ProperName KindName)) Source #
Kinds in Prim.RowList
primTypeErrorKinds :: Set (Qualified (ProperName KindName)) Source #
Kinds in Prim.TypeError
allPrimKinds :: Set (Qualified (ProperName KindName)) Source #
All primitive kinds
primTypes :: Map (Qualified (ProperName TypeName)) (SourceKind, TypeKind) Source #
The primitive types in the external javascript environment with their
associated kinds. There are also pseudo Fail
, Warn
, and Partial
types
that correspond to the classes with the same names.
allPrimTypes :: Map (Qualified (ProperName TypeName)) (SourceKind, TypeKind) Source #
This Map
contains all of the prim types from all Prim modules.
primBooleanTypes :: Map (Qualified (ProperName TypeName)) (SourceKind, TypeKind) Source #
primOrderingTypes :: Map (Qualified (ProperName TypeName)) (SourceKind, TypeKind) Source #
primRowTypes :: Map (Qualified (ProperName TypeName)) (SourceKind, TypeKind) Source #
primRowListTypes :: Map (Qualified (ProperName TypeName)) (SourceKind, TypeKind) Source #
primSymbolTypes :: Map (Qualified (ProperName TypeName)) (SourceKind, TypeKind) Source #
primClasses :: Map (Qualified (ProperName ClassName)) TypeClassData Source #
The primitive class map. This just contains the Partial
class.
Partial
is used as a kind of magic constraint for partial functions.
allPrimClasses :: Map (Qualified (ProperName ClassName)) TypeClassData Source #
This contains all of the type classes from all Prim modules.
lookupConstructor :: Environment -> Qualified (ProperName ConstructorName) -> (DataDeclType, ProperName TypeName, SourceType, [Ident]) Source #
Finds information about data constructors from the current environment.
isNewtypeConstructor :: Environment -> Qualified (ProperName ConstructorName) -> Bool Source #
Checks whether a data constructor is for a newtype.
lookupValue :: Environment -> Qualified Ident -> Maybe (SourceType, NameKind, NameVisibility) Source #
Finds information about values from the current environment.
Data type for binders
NullBinder | Wildcard binder |
LiteralBinder SourceSpan (Literal Binder) | A binder which matches a literal |
VarBinder SourceSpan Ident | A binder which binds an identifier |
ConstructorBinder SourceSpan (Qualified (ProperName ConstructorName)) [Binder] | A binder which matches a data constructor |
OpBinder SourceSpan (Qualified (OpName ValueOpName)) | A operator alias binder. During the rebracketing phase of desugaring, this data constructor will be removed. |
BinaryNoParensBinder Binder Binder Binder | Binary operator application. During the rebracketing phase of desugaring, this data constructor will be removed. |
ParensInBinder 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. |
NamedBinder SourceSpan Ident Binder | A binder which binds its input to an identifier |
PositionedBinder SourceSpan [Comment] Binder | A binder with source position information |
TypedBinder SourceType Binder | A binder with a type annotation |
binderNames :: Binder -> [Ident] Source #
Collect all names introduced in binders in an expression
isIrrefutable :: Binder -> Bool Source #
newtype AssocList k t Source #
AssocList | |
|
Instances
Instances
Functor PathNode Source # | |
Foldable PathNode Source # | |
Defined in Language.PureScript.AST.Declarations fold :: Monoid m => PathNode m -> m # foldMap :: Monoid m => (a -> m) -> PathNode a -> m # foldr :: (a -> b -> b) -> b -> PathNode a -> b # foldr' :: (a -> b -> b) -> b -> PathNode a -> b # foldl :: (b -> a -> b) -> b -> PathNode a -> b # foldl' :: (b -> a -> b) -> b -> PathNode a -> b # foldr1 :: (a -> a -> a) -> PathNode a -> a # foldl1 :: (a -> a -> a) -> PathNode a -> a # elem :: Eq a => a -> PathNode a -> Bool # maximum :: Ord a => PathNode a -> a # minimum :: Ord a => PathNode a -> a # | |
Traversable PathNode Source # | |
Defined in Language.PureScript.AST.Declarations | |
Eq t => Eq (PathNode t) Source # | |
Ord t => Ord (PathNode t) Source # | |
Defined in Language.PureScript.AST.Declarations | |
Show t => Show (PathNode t) Source # | |
Instances
Functor PathTree Source # | |
Foldable PathTree Source # | |
Defined in Language.PureScript.AST.Declarations fold :: Monoid m => PathTree m -> m # foldMap :: Monoid m => (a -> m) -> PathTree a -> m # foldr :: (a -> b -> b) -> b -> PathTree a -> b # foldr' :: (a -> b -> b) -> b -> PathTree a -> b # foldl :: (b -> a -> b) -> b -> PathTree a -> b # foldl' :: (b -> a -> b) -> b -> PathTree a -> b # foldr1 :: (a -> a -> a) -> PathTree a -> a # foldl1 :: (a -> a -> a) -> PathTree a -> a # elem :: Eq a => a -> PathTree a -> Bool # maximum :: Ord a => PathTree a -> a # minimum :: Ord a => PathTree a -> a # | |
Traversable PathTree Source # | |
Defined in Language.PureScript.AST.Declarations | |
Eq t => Eq (PathTree t) Source # | |
Ord t => Ord (PathTree t) Source # | |
Defined in Language.PureScript.AST.Declarations | |
Show t => Show (PathTree t) Source # | |
data DoNotationElement Source #
A statement in a do-notation block
DoNotationValue Expr | A monadic value without a binder |
DoNotationBind Binder Expr | A monadic value with a binder |
DoNotationLet [Declaration] | A let statement, i.e. a pure value with a binder |
PositionedDoNotationElement SourceSpan [Comment] DoNotationElement | A do notation element with source position information |
Instances
Show DoNotationElement Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> DoNotationElement -> ShowS # show :: DoNotationElement -> String # showList :: [DoNotationElement] -> ShowS # |
data CaseAlternative Source #
An alternative in a case statement
CaseAlternative | |
|
Instances
Show CaseAlternative Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> CaseAlternative -> ShowS # show :: CaseAlternative -> String # showList :: [CaseAlternative] -> ShowS # |
data WhereProvenance Source #
Metadata that tells where a let binding originated
FromWhere | The let binding was originally a where clause |
FromLet | The let binding was always a let binding |
Instances
Show WhereProvenance Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> WhereProvenance -> ShowS # show :: WhereProvenance -> String # showList :: [WhereProvenance] -> ShowS # |
Data type for expressions and terms
Literal SourceSpan (Literal Expr) | A literal value |
UnaryMinus SourceSpan Expr | A prefix -, will be desugared |
BinaryNoParens Expr Expr Expr | Binary operator application. During the rebracketing phase of desugaring, this data constructor will be removed. |
Parens 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. |
Accessor PSString 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. |
ObjectUpdate Expr [(PSString, Expr)] | Partial record update |
ObjectUpdateNested Expr (PathTree Expr) | Object updates with nested support: `x { foo { bar = e } }`
Replaced during desugaring into a |
Abs Binder Expr | Function introduction |
App Expr Expr | Function application |
Var SourceSpan (Qualified Ident) | Variable |
Op SourceSpan (Qualified (OpName ValueOpName)) | An operator. This will be desugared into a function during the "operators" phase of desugaring. |
IfThenElse Expr Expr Expr | Conditional (if-then-else expression) |
Constructor SourceSpan (Qualified (ProperName ConstructorName)) | A data constructor |
Case [Expr] [CaseAlternative] | 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. |
TypedValue Bool Expr SourceType | A value with a type annotation |
Let WhereProvenance [Declaration] Expr | A let binding |
Do (Maybe ModuleName) [DoNotationElement] | A do-notation block |
Ado (Maybe ModuleName) [DoNotationElement] Expr | An ado-notation block |
TypeClassDictionaryConstructorApp (Qualified (ProperName ClassName)) Expr | An application of a typeclass dictionary constructor. The value should be an ObjectLiteral. |
TypeClassDictionary SourceConstraint (Map (Maybe ModuleName) (Map (Qualified (ProperName ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict)))) [ErrorMessageHint] | 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. |
TypeClassDictionaryAccessor (Qualified (ProperName ClassName)) Ident | A typeclass dictionary accessor, the implementation is left unspecified until CoreFn desugaring. |
DeferredDictionary (Qualified (ProperName ClassName)) [SourceType] | A placeholder for a superclass dictionary to be turned into a TypeClassDictionary during typechecking |
AnonymousArgument | A placeholder for an anonymous function argument |
Hole Text | A typed hole that will be turned into a hint/error during typechecking |
PositionedValue SourceSpan [Comment] Expr | A value with source position information |
data GuardedExpr Source #
The right hand side of a binder in value declarations and case expressions.
Instances
Show GuardedExpr Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> GuardedExpr -> ShowS # show :: GuardedExpr -> String # showList :: [GuardedExpr] -> ShowS # |
A guard is just a boolean-valued expression that appears alongside a set of binders
data TypeInstanceBody Source #
The members of a type class instance declaration
DerivedInstance | This is a derived instance |
NewtypeInstance | This is an instance derived from a newtype |
NewtypeInstanceWithDictionary Expr | This is an instance derived from a newtype, desugared to include a dictionary for the type under the newtype. |
ExplicitInstance [Declaration] | This is a regular (explicit) instance |
Instances
Show TypeInstanceBody Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> TypeInstanceBody -> ShowS # show :: TypeInstanceBody -> String # showList :: [TypeInstanceBody] -> ShowS # |
data TypeFixity Source #
Instances
Eq TypeFixity Source # | |
Defined in Language.PureScript.AST.Declarations (==) :: TypeFixity -> TypeFixity -> Bool # (/=) :: TypeFixity -> TypeFixity -> Bool # | |
Ord TypeFixity Source # | |
Defined in Language.PureScript.AST.Declarations compare :: TypeFixity -> TypeFixity -> Ordering # (<) :: TypeFixity -> TypeFixity -> Bool # (<=) :: TypeFixity -> TypeFixity -> Bool # (>) :: TypeFixity -> TypeFixity -> Bool # (>=) :: TypeFixity -> TypeFixity -> Bool # max :: TypeFixity -> TypeFixity -> TypeFixity # min :: TypeFixity -> TypeFixity -> TypeFixity # | |
Show TypeFixity Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> TypeFixity -> ShowS # show :: TypeFixity -> String # showList :: [TypeFixity] -> ShowS # |
data ValueFixity Source #
Instances
Eq ValueFixity Source # | |
Defined in Language.PureScript.AST.Declarations (==) :: ValueFixity -> ValueFixity -> Bool # (/=) :: ValueFixity -> ValueFixity -> Bool # | |
Ord ValueFixity Source # | |
Defined in Language.PureScript.AST.Declarations compare :: ValueFixity -> ValueFixity -> Ordering # (<) :: ValueFixity -> ValueFixity -> Bool # (<=) :: ValueFixity -> ValueFixity -> Bool # (>) :: ValueFixity -> ValueFixity -> Bool # (>=) :: ValueFixity -> ValueFixity -> Bool # max :: ValueFixity -> ValueFixity -> ValueFixity # min :: ValueFixity -> ValueFixity -> ValueFixity # | |
Show ValueFixity Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> ValueFixity -> ShowS # show :: ValueFixity -> String # showList :: [ValueFixity] -> ShowS # |
data Declaration Source #
The data type of declarations
DataDeclaration SourceAnn DataDeclType (ProperName TypeName) [(Text, Maybe SourceKind)] [(ProperName ConstructorName, [(Ident, SourceType)])] | A data type declaration (data or newtype, name, arguments, data constructors) |
DataBindingGroupDeclaration (NonEmpty Declaration) | A minimal mutually recursive set of data type declarations |
TypeSynonymDeclaration SourceAnn (ProperName TypeName) [(Text, Maybe SourceKind)] SourceType | A type synonym declaration (name, arguments, type) |
TypeDeclaration !TypeDeclarationData | A type declaration for a value (name, ty) |
ValueDeclaration !(ValueDeclarationData [GuardedExpr]) | A value declaration (name, top-level binders, optional guard, value) |
BoundValueDeclaration SourceAnn Binder Expr | A declaration paired with pattern matching in let-in expression (binder, optional guard, value) |
BindingGroupDeclaration (NonEmpty ((SourceAnn, Ident), NameKind, Expr)) | A minimal mutually recursive set of value declarations |
ExternDeclaration SourceAnn Ident SourceType | A foreign import declaration (name, type) |
ExternDataDeclaration SourceAnn (ProperName TypeName) SourceKind | A data type foreign import (name, kind) |
ExternKindDeclaration SourceAnn (ProperName KindName) | A foreign kind import (name) |
FixityDeclaration SourceAnn (Either ValueFixity TypeFixity) | A fixity declaration |
ImportDeclaration SourceAnn ModuleName ImportDeclarationType (Maybe ModuleName) | A module import (module name, qualifiedunqualifiedhiding, optional "qualified as" name) |
TypeClassDeclaration SourceAnn (ProperName ClassName) [(Text, Maybe SourceKind)] [SourceConstraint] [FunctionalDependency] [Declaration] | A type class declaration (name, argument, implies, member declarations) |
TypeInstanceDeclaration SourceAnn [Ident] Integer Ident [SourceConstraint] (Qualified (ProperName ClassName)) [SourceType] TypeInstanceBody | A type instance declaration (instance chain, chain index, name, dependencies, class name, instance types, member declarations) |
Instances
Show Declaration Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> Declaration -> ShowS # show :: Declaration -> String # showList :: [Declaration] -> ShowS # |
data ValueDeclarationData a Source #
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.
ValueDeclarationData | |
|
Instances
data TypeDeclarationData Source #
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.
Instances
Eq TypeDeclarationData Source # | |
Defined in Language.PureScript.AST.Declarations (==) :: TypeDeclarationData -> TypeDeclarationData -> Bool # (/=) :: TypeDeclarationData -> TypeDeclarationData -> Bool # | |
Show TypeDeclarationData Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> TypeDeclarationData -> ShowS # show :: TypeDeclarationData -> String # showList :: [TypeDeclarationData] -> ShowS # |
data ImportDeclarationType Source #
The data type which specifies type of import declaration
Implicit | An import with no explicit list: `import M`. |
Explicit [DeclarationRef] | An import with an explicit list of references to import: `import M (foo)` |
Hiding [DeclarationRef] | An import with a list of references to hide: `import M hiding (foo)` |
Instances
Eq ImportDeclarationType Source # | |
Defined in Language.PureScript.AST.Declarations (==) :: ImportDeclarationType -> ImportDeclarationType -> Bool # (/=) :: ImportDeclarationType -> ImportDeclarationType -> Bool # | |
Show ImportDeclarationType Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> ImportDeclarationType -> ShowS # show :: ImportDeclarationType -> String # showList :: [ImportDeclarationType] -> ShowS # | |
ToJSON ImportDeclarationType Source # | |
Defined in Language.PureScript.AST.Declarations toJSON :: ImportDeclarationType -> Value # toEncoding :: ImportDeclarationType -> Encoding # toJSONList :: [ImportDeclarationType] -> Value # toEncodingList :: [ImportDeclarationType] -> Encoding # | |
FromJSON ImportDeclarationType Source # | |
Defined in Language.PureScript.AST.Declarations parseJSON :: Value -> Parser ImportDeclarationType # parseJSONList :: Value -> Parser [ImportDeclarationType] # |
data ExportSource Source #
Instances
data DeclarationRef Source #
An item in a list of explicit imports or exports
TypeRef SourceSpan (ProperName TypeName) (Maybe [ProperName ConstructorName]) | A type constructor with data constructors |
TypeOpRef SourceSpan (OpName TypeOpName) | A type operator |
ValueRef SourceSpan Ident | A value |
ValueOpRef SourceSpan (OpName ValueOpName) | A value-level operator |
TypeClassRef SourceSpan (ProperName ClassName) | A type class |
TypeInstanceRef SourceSpan Ident | A type class instance, created during typeclass desugaring (name, class name, instance types) |
ModuleRef SourceSpan ModuleName | A module, in its entirety |
KindRef SourceSpan (ProperName KindName) | A named kind |
ReExportRef SourceSpan ExportSource DeclarationRef | A value re-exported from another module. These will be inserted during elaboration in name desugaring. |
Instances
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 ErrorMessage Source #
Instances
Show ErrorMessage Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> ErrorMessage -> ShowS # show :: ErrorMessage -> String # showList :: [ErrorMessage] -> ShowS # |
data HintCategory Source #
Categories of hints
Instances
Eq HintCategory Source # | |
Defined in Language.PureScript.AST.Declarations (==) :: HintCategory -> HintCategory -> Bool # (/=) :: HintCategory -> HintCategory -> Bool # | |
Show HintCategory Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> HintCategory -> ShowS # show :: HintCategory -> String # showList :: [HintCategory] -> ShowS # |
data ErrorMessageHint Source #
Error message hints, providing more detailed information about failure.
Instances
Show ErrorMessageHint Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> ErrorMessageHint -> ShowS # show :: ErrorMessageHint -> String # showList :: [ErrorMessageHint] -> ShowS # |
data SimpleErrorMessage Source #
A type of error messages
Instances
Show SimpleErrorMessage Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> SimpleErrorMessage -> ShowS # show :: SimpleErrorMessage -> String # showList :: [SimpleErrorMessage] -> ShowS # |
data TypeSearch Source #
Holds the data necessary to do type directed search for typed holes
TSBefore Environment | An Environment captured for later consumption by type directed search |
TSAfter | Results of applying type directed search to the previously captured Environment |
|
Instances
Show TypeSearch Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> TypeSearch -> ShowS # show :: TypeSearch -> String # showList :: [TypeSearch] -> ShowS # |
type Context = [(Ident, SourceType)] Source #
A map of locally-bound names in scope.
pattern MkUnguarded :: Expr -> GuardedExpr Source #
pattern TypeFixityDeclaration :: SourceAnn -> Fixity -> Qualified (ProperName TypeName) -> OpName TypeOpName -> Declaration Source #
pattern ValueFixityDeclaration :: SourceAnn -> Fixity -> Qualified (Either Ident (ProperName ConstructorName)) -> OpName ValueOpName -> Declaration Source #
pattern ValueDecl :: SourceAnn -> Ident -> NameKind -> [Binder] -> [GuardedExpr] -> Declaration Source #
onTypeSearchTypes :: (SourceType -> SourceType) -> TypeSearch -> TypeSearch Source #
onTypeSearchTypesM :: Applicative m => (SourceType -> m SourceType) -> TypeSearch -> m TypeSearch Source #
getModuleName :: Module -> ModuleName Source #
Return a module's name.
getModuleSourceSpan :: Module -> SourceSpan Source #
Return a module's source span.
getModuleDeclarations :: Module -> [Declaration] Source #
Return a module's declarations.
addDefaultImport :: Qualified ModuleName -> Module -> Module Source #
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)
importPrim :: Module -> Module Source #
Adds import declarations to a module for an implicit Prim import and Prim | qualified as Prim, as necessary.
compDecRef :: DeclarationRef -> DeclarationRef -> Ordering Source #
declRefName :: DeclarationRef -> Name Source #
getTypeRef :: DeclarationRef -> Maybe (ProperName TypeName, Maybe [ProperName ConstructorName]) Source #
getTypeOpRef :: DeclarationRef -> Maybe (OpName TypeOpName) Source #
getValueRef :: DeclarationRef -> Maybe Ident Source #
getValueOpRef :: DeclarationRef -> Maybe (OpName ValueOpName) Source #
getKindRef :: DeclarationRef -> Maybe (ProperName KindName) Source #
isModuleRef :: DeclarationRef -> Bool Source #
overTypeDeclaration :: (TypeDeclarationData -> TypeDeclarationData) -> Declaration -> Declaration Source #
overValueDeclaration :: (ValueDeclarationData [GuardedExpr] -> ValueDeclarationData [GuardedExpr]) -> Declaration -> Declaration Source #
mapTypeInstanceBody :: ([Declaration] -> [Declaration]) -> TypeInstanceBody -> TypeInstanceBody Source #
traverseTypeInstanceBody :: Applicative f => ([Declaration] -> f [Declaration]) -> TypeInstanceBody -> f TypeInstanceBody Source #
A traversal for TypeInstanceBody
declSourceAnn :: Declaration -> SourceAnn Source #
isValueDecl :: Declaration -> Bool Source #
Test if a declaration is a value declaration
isDataDecl :: Declaration -> Bool Source #
Test if a declaration is a data type or type synonym declaration
isImportDecl :: Declaration -> Bool Source #
Test if a declaration is a module import
isExternDataDecl :: Declaration -> Bool Source #
Test if a declaration is a data type foreign import
isExternKindDecl :: Declaration -> Bool Source #
Test if a declaration is a foreign kind import
isFixityDecl :: Declaration -> Bool Source #
Test if a declaration is a fixity declaration
isExternDecl :: Declaration -> Bool Source #
Test if a declaration is a foreign import
isTypeClassInstanceDeclaration :: Declaration -> Bool Source #
Test if a declaration is a type class instance declaration
isTypeClassDeclaration :: Declaration -> Bool Source #
Test if a declaration is a type class declaration
flattenDecls :: [Declaration] -> [Declaration] Source #
Recursively flatten data binding groups in the list of declarations
isTrueExpr :: Expr -> Bool Source #
data ScopedIdent Source #
Instances
Eq ScopedIdent Source # | |
Defined in Language.PureScript.AST.Traversals (==) :: ScopedIdent -> ScopedIdent -> Bool # (/=) :: ScopedIdent -> ScopedIdent -> Bool # | |
Ord ScopedIdent Source # | |
Defined in Language.PureScript.AST.Traversals compare :: ScopedIdent -> ScopedIdent -> Ordering # (<) :: ScopedIdent -> ScopedIdent -> Bool # (<=) :: ScopedIdent -> ScopedIdent -> Bool # (>) :: ScopedIdent -> ScopedIdent -> Bool # (>=) :: ScopedIdent -> ScopedIdent -> Bool # max :: ScopedIdent -> ScopedIdent -> ScopedIdent # min :: ScopedIdent -> ScopedIdent -> ScopedIdent # | |
Show ScopedIdent Source # | |
Defined in Language.PureScript.AST.Traversals showsPrec :: Int -> ScopedIdent -> ShowS # show :: ScopedIdent -> String # showList :: [ScopedIdent] -> ShowS # |
guardedExprM :: Applicative m => (Guard -> m Guard) -> (Expr -> m Expr) -> GuardedExpr -> m GuardedExpr Source #
mapGuardedExpr :: (Guard -> Guard) -> (Expr -> Expr) -> GuardedExpr -> GuardedExpr Source #
everywhereOnValues :: (Declaration -> Declaration) -> (Expr -> Expr) -> (Binder -> Binder) -> (Declaration -> Declaration, Expr -> Expr, Binder -> Binder) Source #
everywhereOnValuesTopDownM :: forall m. Monad m => (Declaration -> m Declaration) -> (Expr -> m Expr) -> (Binder -> m Binder) -> (Declaration -> m Declaration, Expr -> m Expr, Binder -> m Binder) Source #
everywhereOnValuesM :: forall m. Monad m => (Declaration -> m Declaration) -> (Expr -> m Expr) -> (Binder -> m Binder) -> (Declaration -> m Declaration, Expr -> m Expr, Binder -> m Binder) Source #
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) Source #
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) Source #
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) Source #
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) Source #
accumTypes :: Monoid r => (SourceType -> r) -> (Declaration -> r, Expr -> r, Binder -> r, CaseAlternative -> r, DoNotationElement -> r) Source #
accumKinds :: Monoid r => (SourceKind -> r) -> (Declaration -> r, Expr -> r, Binder -> r, CaseAlternative -> r, DoNotationElement -> r) Source #
overTypes :: (SourceType -> SourceType) -> Expr -> Expr Source #
Map a function over type annotations appearing inside a value
exportedDeclarations :: Module -> [Declaration] Source #
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.
isExported :: Maybe [DeclarationRef] -> Declaration -> Bool Source #
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.
desugarLetPatternModule :: Module -> Module Source #
Replace every BoundValueDeclaration
in Let
expressions with Case
expressions.
prettyPrintKind :: Kind a -> Text Source #
Generate a pretty-printed string representing a Kind
type PrettyPrintConstraint = (Qualified (ProperName ClassName), [PrettyPrintType]) Source #
data PrettyPrintType Source #
convertPrettyPrintType :: Int -> Type a -> PrettyPrintType Source #
prettyPrintTypeAtom :: Int -> Type a -> String Source #
Generate a pretty-printed string representing a Type, as it should appear inside parentheses
prettyPrintType :: Int -> Type a -> String Source #
Generate a pretty-printed string representing a Type
prettyPrintTypeWithUnicode :: Int -> Type a -> String Source #
Generate a pretty-printed string representing a Type
using unicode
symbols where applicable
prettyPrintSuggestedType :: Type a -> String Source #
Generate a pretty-printed string representing a suggested Type
prettyPrintLabel :: Label -> Text Source #
prettyPrintObjectKey :: PSString -> Text Source #
prettyPrintBinderAtom :: Binder -> Text Source #
prettyPrintBinder :: Binder -> Text Source #
Generate a pretty-printed string representing a Binder
data ExternsDeclaration Source #
A type or value declaration appearing in an externs file
EDType | A type declaration |
EDTypeSynonym | A type synonym |
EDDataConstructor | A data construtor |
EDValue | A value declaration |
EDClass | A type class declaration |
EDInstance | An instance declaration |
EDKind | A kind declaration |
Instances
Show ExternsDeclaration Source # | |
Defined in Language.PureScript.Externs showsPrec :: Int -> ExternsDeclaration -> ShowS # show :: ExternsDeclaration -> String # showList :: [ExternsDeclaration] -> ShowS # | |
ToJSON ExternsDeclaration Source # | |
Defined in Language.PureScript.Externs toJSON :: ExternsDeclaration -> Value # toEncoding :: ExternsDeclaration -> Encoding # toJSONList :: [ExternsDeclaration] -> Value # toEncodingList :: [ExternsDeclaration] -> Encoding # | |
FromJSON ExternsDeclaration Source # | |
Defined in Language.PureScript.Externs parseJSON :: Value -> Parser ExternsDeclaration # parseJSONList :: Value -> Parser [ExternsDeclaration] # |
data ExternsTypeFixity Source #
A type fixity declaration in an externs file
ExternsTypeFixity | |
|
Instances
Show ExternsTypeFixity Source # | |
Defined in Language.PureScript.Externs showsPrec :: Int -> ExternsTypeFixity -> ShowS # show :: ExternsTypeFixity -> String # showList :: [ExternsTypeFixity] -> ShowS # | |
ToJSON ExternsTypeFixity Source # | |
Defined in Language.PureScript.Externs toJSON :: ExternsTypeFixity -> Value # toEncoding :: ExternsTypeFixity -> Encoding # toJSONList :: [ExternsTypeFixity] -> Value # toEncodingList :: [ExternsTypeFixity] -> Encoding # | |
FromJSON ExternsTypeFixity Source # | |
Defined in Language.PureScript.Externs parseJSON :: Value -> Parser ExternsTypeFixity # parseJSONList :: Value -> Parser [ExternsTypeFixity] # |
data ExternsFixity Source #
A fixity declaration in an externs file
ExternsFixity | |
|
Instances
Show ExternsFixity Source # | |
Defined in Language.PureScript.Externs showsPrec :: Int -> ExternsFixity -> ShowS # show :: ExternsFixity -> String # showList :: [ExternsFixity] -> ShowS # | |
ToJSON ExternsFixity Source # | |
Defined in Language.PureScript.Externs toJSON :: ExternsFixity -> Value # toEncoding :: ExternsFixity -> Encoding # toJSONList :: [ExternsFixity] -> Value # toEncodingList :: [ExternsFixity] -> Encoding # | |
FromJSON ExternsFixity Source # | |
Defined in Language.PureScript.Externs parseJSON :: Value -> Parser ExternsFixity # parseJSONList :: Value -> Parser [ExternsFixity] # |
data ExternsImport Source #
A module import in an externs file
ExternsImport | |
|
Instances
Show ExternsImport Source # | |
Defined in Language.PureScript.Externs showsPrec :: Int -> ExternsImport -> ShowS # show :: ExternsImport -> String # showList :: [ExternsImport] -> ShowS # | |
ToJSON ExternsImport Source # | |
Defined in Language.PureScript.Externs toJSON :: ExternsImport -> Value # toEncoding :: ExternsImport -> Encoding # toJSONList :: [ExternsImport] -> Value # toEncodingList :: [ExternsImport] -> Encoding # | |
FromJSON ExternsImport Source # | |
Defined in Language.PureScript.Externs parseJSON :: Value -> Parser ExternsImport # parseJSONList :: Value -> Parser [ExternsImport] # |
data ExternsFile Source #
The data which will be serialized to an externs file
ExternsFile | |
|
Instances
Show ExternsFile Source # | |
Defined in Language.PureScript.Externs showsPrec :: Int -> ExternsFile -> ShowS # show :: ExternsFile -> String # showList :: [ExternsFile] -> ShowS # | |
ToJSON ExternsFile Source # | |
Defined in Language.PureScript.Externs toJSON :: ExternsFile -> Value # toEncoding :: ExternsFile -> Encoding # toJSONList :: [ExternsFile] -> Value # toEncodingList :: [ExternsFile] -> Encoding # | |
FromJSON ExternsFile Source # | |
Defined in Language.PureScript.Externs parseJSON :: Value -> Parser ExternsFile # parseJSONList :: Value -> Parser [ExternsFile] # |
applyExternsFileToEnvironment :: ExternsFile -> Environment -> Environment Source #
Convert an externs file back into a module
moduleToExternsFile :: Module -> Environment -> ExternsFile Source #
Generate an externs file for all declarations in a module
data PPEOptions Source #
prettyPrintSingleError
Options
PPEOptions | |
|
How critical the issue is
A map from rigid type variable name/unknown variable pairs to new variables.
TypeMap | |
|
newtype MultipleErrors Source #
A stack trace for an error
Instances
newtype ErrorSuggestion Source #
errorSpan :: ErrorMessage -> Maybe (NonEmpty SourceSpan) Source #
Get the source span for an error
errorModule :: ErrorMessage -> Maybe ModuleName Source #
Get the module name for an error
findHint :: (ErrorMessageHint -> Maybe a) -> ErrorMessage -> Maybe a Source #
stripModuleAndSpan :: ErrorMessage -> ErrorMessage Source #
Remove the module name and span hints from an error
errorCode :: ErrorMessage -> Text Source #
Get the error code for a particular error type
nonEmpty :: MultipleErrors -> Bool Source #
Check whether a collection of errors is empty or not.
errorMessage :: SimpleErrorMessage -> MultipleErrors Source #
Create an error set from a single simple error message
errorMessage' :: SourceSpan -> SimpleErrorMessage -> MultipleErrors Source #
Create an error set from a single simple error message and source annotation
errorMessage'' :: NonEmpty SourceSpan -> SimpleErrorMessage -> MultipleErrors Source #
Create an error set from a single simple error message and source annotations
errorMessage''' :: [SourceSpan] -> SimpleErrorMessage -> MultipleErrors Source #
Create an error from multiple (possibly empty) source spans, reversed sorted.
singleError :: ErrorMessage -> MultipleErrors Source #
Create an error set from a single error message
onErrorMessages :: (ErrorMessage -> ErrorMessage) -> MultipleErrors -> MultipleErrors Source #
Lift a function on ErrorMessage to a function on MultipleErrors
addHint :: ErrorMessageHint -> MultipleErrors -> MultipleErrors Source #
Add a hint to an error message
addHints :: [ErrorMessageHint] -> MultipleErrors -> MultipleErrors Source #
Add hints to an error message
unwrapErrorMessage :: ErrorMessage -> SimpleErrorMessage Source #
Extract nested error messages from wrapper errors
onTypesInErrorMessage :: (SourceType -> SourceType) -> ErrorMessage -> ErrorMessage Source #
onTypesInErrorMessageM :: Applicative m => (SourceType -> m SourceType) -> ErrorMessage -> m ErrorMessage Source #
errorDocUri :: ErrorMessage -> Text Source #
colorCodeBox :: Maybe (ColorIntensity, Color) -> Box -> Box Source #
defaultCodeColor :: (ColorIntensity, Color) Source #
Default color intesity and color for code
defaultPPEOptions :: PPEOptions Source #
Default options for PPEOptions
prettyPrintSingleError :: PPEOptions -> ErrorMessage -> Box Source #
Pretty print a single error, simplifying if necessary
prettyPrintImport :: ModuleName -> ImportDeclarationType -> Maybe ModuleName -> Text Source #
prettyPrintRef :: DeclarationRef -> Maybe Text Source #
prettyPrintMultipleErrors :: PPEOptions -> MultipleErrors -> String Source #
Pretty print multiple errors
prettyPrintMultipleWarnings :: PPEOptions -> MultipleErrors -> String Source #
Pretty print multiple warnings
prettyPrintMultipleWarningsBox :: PPEOptions -> MultipleErrors -> [Box] Source #
Pretty print warnings as a Box
prettyPrintMultipleErrorsBox :: PPEOptions -> MultipleErrors -> [Box] Source #
Pretty print errors as a Box
prettyPrintMultipleErrorsWith :: PPEOptions -> String -> String -> MultipleErrors -> [Box] Source #
prettyPrintParseError :: ParseError -> Box Source #
Pretty print a Parsec ParseError as a Box
prettyPrintParseErrorMessages :: String -> String -> String -> String -> String -> [Message] -> Box Source #
Pretty print ParseError
detail messages.
Adapted from showErrorMessages
.
See https://github.com/aslatter/parsec/blob/v3.1.9/Text/Parsec/Error.hs#L173.
rethrow :: MonadError e m => (e -> e) -> m a -> m a Source #
Rethrow an error with a more detailed error message in the case of failure
reifyErrors :: MonadError e m => m a -> m (Either e a) Source #
reflectErrors :: MonadError e m => m (Either e a) -> m a Source #
warnAndRethrow :: (MonadError e m, MonadWriter e m) => (e -> e) -> m a -> m a Source #
rethrowWithPosition :: MonadError MultipleErrors m => SourceSpan -> m a -> m a Source #
Rethrow an error with source position information
warnWithPosition :: MonadWriter MultipleErrors m => SourceSpan -> m a -> m a Source #
warnAndRethrowWithPosition :: (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => SourceSpan -> m a -> m a Source #
withPosition :: SourceSpan -> ErrorMessage -> ErrorMessage Source #
filterErrors :: (ErrorMessage -> Bool) -> MultipleErrors -> MultipleErrors Source #
escalateWarningWhen :: (MonadWriter MultipleErrors m, MonadError MultipleErrors m) => (ErrorMessage -> Bool) -> m a -> m a Source #
Runs a computation listening for warnings and then escalating any warnings that match the predicate to error status.
parU :: forall m a b. MonadError MultipleErrors m => [a] -> (a -> m b) -> m [b] Source #
Collect errors in in parallel
data CheckState Source #
State required for type checking
CheckState | |
|
data Substitution Source #
A substitution of unification variables for types or kinds
Substitution | |
|
emptySubstitution :: Substitution Source #
An empty substitution
emptyCheckState :: Environment -> CheckState Source #
Create an empty CheckState
bindNames :: MonadState CheckState m => Map (Qualified Ident) (SourceType, NameKind, NameVisibility) -> m a -> m a Source #
Temporarily bind a collection of names to values
bindTypes :: MonadState CheckState m => Map (Qualified (ProperName TypeName)) (SourceKind, TypeKind) -> m a -> m a Source #
Temporarily bind a collection of names to types
withScopedTypeVars :: (MonadState CheckState m, MonadWriter MultipleErrors m) => ModuleName -> [(Text, SourceKind)] -> m a -> m a Source #
Temporarily bind a collection of names to types
withErrorMessageHint :: (MonadState CheckState m, MonadError MultipleErrors m) => ErrorMessageHint -> m a -> m a Source #
getHints :: MonadState CheckState m => m [ErrorMessageHint] Source #
These hints are added at the front, so the most nested hint occurs at the front, but the simplifier assumes the reverse order.
rethrowWithPositionTC :: (MonadState CheckState m, MonadError MultipleErrors m) => SourceSpan -> m a -> m a Source #
warnAndRethrowWithPositionTC :: (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => SourceSpan -> m a -> m a Source #
withTypeClassDictionaries :: MonadState CheckState m => [NamedDict] -> m a -> m a Source #
Temporarily make a collection of type class dictionaries available
getTypeClassDictionaries :: MonadState CheckState m => m (Map (Maybe ModuleName) (Map (Qualified (ProperName ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict)))) Source #
Get the currently available map of type class dictionaries
lookupTypeClassDictionaries :: MonadState CheckState m => Maybe ModuleName -> m (Map (Qualified (ProperName ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict))) Source #
Lookup type class dictionaries in a module.
lookupTypeClassDictionariesForClass :: MonadState CheckState m => Maybe ModuleName -> Qualified (ProperName ClassName) -> m (Map (Qualified Ident) (NonEmpty NamedDict)) Source #
Lookup type class dictionaries in a module.
bindLocalVariables :: MonadState CheckState m => [(Ident, SourceType, NameVisibility)] -> m a -> m a Source #
Temporarily bind a collection of names to local variables
bindLocalTypeVariables :: MonadState CheckState m => ModuleName -> [(ProperName TypeName, SourceKind)] -> m a -> m a Source #
Temporarily bind a collection of names to local type variables
makeBindingGroupVisible :: MonadState CheckState m => m () Source #
Update the visibility of all names to Defined
withBindingGroupVisible :: MonadState CheckState m => m a -> m a Source #
Update the visibility of all names to Defined in the scope of the provided action
preservingNames :: MonadState CheckState m => m a -> m a Source #
Perform an action while preserving the names from the Environment
.
lookupVariable :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => Qualified Ident -> m SourceType Source #
Lookup the type of a value by name in the Environment
getVisibility :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => Qualified Ident -> m NameVisibility Source #
Lookup the visibility of a value by name in the Environment
checkVisibility :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => Qualified Ident -> m () Source #
Assert that a name is visible
lookupTypeVariable :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => ModuleName -> Qualified (ProperName TypeName) -> m SourceKind Source #
Lookup the kind of a type by name in the Environment
getEnv :: MonadState CheckState m => m Environment Source #
Get the current Environment
getLocalContext :: MonadState CheckState m => m Context Source #
Get locally-bound names in context, to create an error message.
putEnv :: MonadState CheckState m => Environment -> m () Source #
Update the Environment
modifyEnv :: MonadState CheckState m => (Environment -> Environment) -> m () Source #
Modify the Environment
runCheck :: Functor m => StateT CheckState m a -> m (a, Environment) Source #
Run a computation in the typechecking monad, starting with an empty Environment
runCheck' :: Functor m => CheckState -> StateT CheckState m a -> m (a, Environment) Source #
Run a computation in the typechecking monad, failing with an error, or succeeding with a return value and the final Environment
.
guardWith :: MonadError e m => e -> Bool -> m () Source #
Make an assertion, failing with an error message
captureSubstitution :: MonadState CheckState m => m a -> m (a, Substitution) Source #
Run a computation in the substitution monad, generating a return value and the final substitution.
capturingSubstitution :: MonadState CheckState m => (a -> Substitution -> b) -> m a -> m b Source #
withFreshSubstitution :: MonadState CheckState m => m a -> m a Source #
withoutWarnings :: MonadWriter w m => m a -> m (a, w) Source #
unsafeCheckCurrentModule :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) => m ModuleName Source #
type SynonymMap = Map (Qualified (ProperName TypeName)) ([(Text, Maybe SourceKind)], SourceType) Source #
Type synonym information (arguments with kinds, aliased type), indexed by name
replaceAllTypeSynonyms :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => SourceType -> m SourceType Source #
Replace fully applied type synonyms
replaceAllTypeSynonymsM :: MonadError MultipleErrors m => SynonymMap -> SourceType -> m SourceType Source #
Replace fully applied type synonyms by explicitly providing a SynonymMap
.
kindOf :: (MonadError MultipleErrors m, MonadState CheckState m) => SourceType -> m SourceKind Source #
Infer the kind of a single type
kindOfWithScopedVars :: (MonadError MultipleErrors m, MonadState CheckState m) => SourceType -> m (SourceKind, [(Text, SourceKind)]) Source #
Infer the kind of a single type, returning the kinds of any scoped type variables
kindsOf :: (MonadError MultipleErrors m, MonadState CheckState m) => Bool -> ModuleName -> ProperName TypeName -> [(Text, Maybe SourceKind)] -> [SourceType] -> m SourceKind Source #
Infer the kind of a type constructor with a collection of arguments and a collection of associated data constructors
kindsOfAll :: (MonadError MultipleErrors m, MonadState CheckState m) => ModuleName -> [(SourceAnn, ProperName TypeName, [(Text, Maybe SourceKind)], SourceType)] -> [(SourceAnn, ProperName TypeName, [(Text, Maybe SourceKind)], [SourceType])] -> m ([SourceKind], [SourceKind]) Source #
Simultaneously infer the kinds of several mutually recursive type constructors
data BindingGroupType Source #
Instances
Eq BindingGroupType Source # | |
Defined in Language.PureScript.TypeChecker.Types (==) :: BindingGroupType -> BindingGroupType -> Bool # (/=) :: BindingGroupType -> BindingGroupType -> Bool # | |
Ord BindingGroupType Source # | |
Defined in Language.PureScript.TypeChecker.Types compare :: BindingGroupType -> BindingGroupType -> Ordering # (<) :: BindingGroupType -> BindingGroupType -> Bool # (<=) :: BindingGroupType -> BindingGroupType -> Bool # (>) :: BindingGroupType -> BindingGroupType -> Bool # (>=) :: BindingGroupType -> BindingGroupType -> Bool # max :: BindingGroupType -> BindingGroupType -> BindingGroupType # min :: BindingGroupType -> BindingGroupType -> BindingGroupType # | |
Show BindingGroupType Source # | |
Defined in Language.PureScript.TypeChecker.Types showsPrec :: Int -> BindingGroupType -> ShowS # show :: BindingGroupType -> String # showList :: [BindingGroupType] -> ShowS # |
typesOf :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => BindingGroupType -> ModuleName -> [((SourceAnn, Ident), Expr)] -> m [((SourceAnn, Ident), (Expr, SourceType))] Source #
Infer the types of multiple mutually-recursive values, and return elaborated values including type class dictionaries and type annotations.
desugarTypeDeclarationsModule :: forall m. MonadError MultipleErrors m => Module -> m Module Source #
Replace all top level type declarations in a module with type annotations
desugarSignedLiterals :: Module -> Module Source #
Removes unary negation operators and replaces them with calls to negate
.
rebracket :: forall m. MonadError MultipleErrors m => [ExternsFile] -> [Module] -> m [Module] Source #
Remove explicit parentheses and reorder binary operator applications.
This pass requires name desugaring and export elaboration to have run first.
rebracketFiltered :: forall m. MonadError MultipleErrors m => (Declaration -> Bool) -> [ExternsFile] -> [Module] -> m [Module] Source #
A version of rebracket
which allows you to choose which declarations
should be affected. This is used in docs generation, where we want to
desugar type operators in instance declarations to ensure that instances are
paired up with their types correctly, but we don't want to desugar type
operators in value declarations.
checkFixityExports :: forall m. MonadError MultipleErrors m => Module -> m Module Source #
Checks all the fixity exports within a module to ensure that members aliased by the operators are also exported from the module.
This pass requires name desugaring and export elaboration to have run first.
desugarObjectConstructors :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Module -> m Module Source #
desugarDecl :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Declaration -> m Declaration Source #
type Env = Map ModuleName (SourceSpan, Imports, Exports) Source #
The imports and exports for a collection of modules. The SourceSpan
is used
to store the source location of the module with a given name, used to provide
useful information when there is a duplicate module definition.
The exported declarations from a module.
Exports | |
|
The imported declarations for a module, including the module's own members.
Imports | |
|
data ImportProvenance Source #
Used to track how an import was introduced into scope. This allows us to handle the one-open-import special case that allows a name conflict to become a warning rather than being an unresolvable situation.
Instances
Eq ImportProvenance Source # | |
Defined in Language.PureScript.Sugar.Names.Env (==) :: ImportProvenance -> ImportProvenance -> Bool # (/=) :: ImportProvenance -> ImportProvenance -> Bool # | |
Ord ImportProvenance Source # | |
Defined in Language.PureScript.Sugar.Names.Env compare :: ImportProvenance -> ImportProvenance -> Ordering # (<) :: ImportProvenance -> ImportProvenance -> Bool # (<=) :: ImportProvenance -> ImportProvenance -> Bool # (>) :: ImportProvenance -> ImportProvenance -> Bool # (>=) :: ImportProvenance -> ImportProvenance -> Bool # max :: ImportProvenance -> ImportProvenance -> ImportProvenance # min :: ImportProvenance -> ImportProvenance -> ImportProvenance # | |
Show ImportProvenance Source # | |
Defined in Language.PureScript.Sugar.Names.Env showsPrec :: Int -> ImportProvenance -> ShowS # show :: ImportProvenance -> String # showList :: [ImportProvenance] -> ShowS # |
data ImportRecord a Source #
The details for an import: the name of the thing that is being imported
(x
if importing from A
), the module that the thing was originally
defined in (for re-export resolution), and the import provenance (see below).
Instances
Eq a => Eq (ImportRecord a) Source # | |
Defined in Language.PureScript.Sugar.Names.Env (==) :: ImportRecord a -> ImportRecord a -> Bool # (/=) :: ImportRecord a -> ImportRecord a -> Bool # | |
Ord a => Ord (ImportRecord a) Source # | |
Defined in Language.PureScript.Sugar.Names.Env compare :: ImportRecord a -> ImportRecord a -> Ordering # (<) :: ImportRecord a -> ImportRecord a -> Bool # (<=) :: ImportRecord a -> ImportRecord a -> Bool # (>) :: ImportRecord a -> ImportRecord a -> Bool # (>=) :: ImportRecord a -> ImportRecord a -> Bool # max :: ImportRecord a -> ImportRecord a -> ImportRecord a # min :: ImportRecord a -> ImportRecord a -> ImportRecord a # | |
Show a => Show (ImportRecord a) Source # | |
Defined in Language.PureScript.Sugar.Names.Env showsPrec :: Int -> ImportRecord a -> ShowS # show :: ImportRecord a -> String # showList :: [ImportRecord a] -> ShowS # |
desugarDoModule :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Module -> m Module Source #
Replace all DoNotationBind
and DoNotationValue
constructors with
applications of the bind function in scope, and all DoNotationLet
constructors with let expressions.
desugarCasesModule :: (MonadSupply m, MonadError MultipleErrors m) => Module -> m Module Source #
Replace all top-level binders in a module with case expressions.
desugarCaseGuards :: forall m. (MonadSupply m, MonadError MultipleErrors m) => [Declaration] -> m [Declaration] Source #
desugarCases :: forall m. (MonadSupply m, MonadError MultipleErrors m) => [Declaration] -> m [Declaration] Source #
Replace all top-level binders with case expressions.
desugarTypeClasses :: (MonadSupply m, MonadError MultipleErrors m) => [ExternsFile] -> [Module] -> m [Module] Source #
Add type synonym declarations for type class dictionary types, and value declarations for type class instance dictionary expressions.
superClassDictionaryNames :: [Constraint a] -> [Text] Source #
createBindingGroupsModule :: MonadError MultipleErrors m => Module -> m Module Source #
Replace all sets of mutually-recursive declarations in a module with binding groups
collapseBindingGroupsModule :: [Module] -> [Module] Source #
Collapse all binding groups in a module to individual declarations
createBindingGroups :: forall m. MonadError MultipleErrors m => ModuleName -> [Declaration] -> m [Declaration] Source #
collapseBindingGroups :: [Declaration] -> [Declaration] Source #
Collapse all binding groups to individual declarations
desugarAdoModule :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Module -> m Module Source #
Replace all AdoNotationBind
and AdoNotationValue
constructors with
applications of the pure and apply functions in scope, and all AdoNotationLet
constructors with let expressions.
data ModuleSignature Source #
A module signature for sorting dependencies.
type ModuleGraph = [(ModuleName, [ModuleName])] Source #
A list of modules with their transitive dependencies
sortModules :: forall m a. MonadError MultipleErrors m => (a -> ModuleSignature) -> [a] -> m ([a], ModuleGraph) Source #
Sort a collection of modules based on module dependencies.
Reports an error if the module graph contains a cycle.
A monad for running make actions
Instances
Monad Make Source # | |
Functor Make Source # | |
Applicative Make Source # | |
MonadIO Make Source # | |
Defined in Language.PureScript.Make.Monad | |
MonadError MultipleErrors Make Source # | |
Defined in Language.PureScript.Make.Monad throwError :: MultipleErrors -> Make a # catchError :: Make a -> (MultipleErrors -> Make a) -> Make a # | |
MonadReader Options Make Source # | |
MonadBase IO Make Source # | |
Defined in Language.PureScript.Make.Monad | |
MonadBaseControl IO Make Source # | |
MonadWriter MultipleErrors Make Source # | |
Defined in Language.PureScript.Make.Monad writer :: (a, MultipleErrors) -> Make a # tell :: MultipleErrors -> Make () # listen :: Make a -> Make (a, MultipleErrors) # pass :: Make (a, MultipleErrors -> MultipleErrors) -> Make a # | |
type StM Make a Source # | |
Defined in Language.PureScript.Make.Monad |
runMake :: Options -> Make a -> IO (Either MultipleErrors a, MultipleErrors) Source #
Execute a Make
monad, returning either errors, or the result of the compile plus any warnings.
makeIO :: (IOError -> ErrorMessage) -> IO a -> Make a Source #
Run an IO
action in the Make
monad, by specifying how IO errors should
be rendered as ErrorMessage
values.
readTextFile :: FilePath -> Make ByteString Source #
Read a text file in the Make
monad, capturing any errors using the
MonadError
instance.
type UsedImports = Map ModuleName [Qualified Name] Source #
Map of module name to list of imported names from that module which have been used.
lintImports :: forall m. MonadWriter MultipleErrors m => Module -> Env -> UsedImports -> m () Source #
Find and warn on:
- Unused import statements (qualified or unqualified)
- Unused references in an explicit import list
- Implicit imports of modules
- Implicit imports into a virtual module (unless the virtual module only has members from one module imported)
- Imports using
hiding
(this is another form of implicit importing)
desugarImports :: forall m. (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => [ExternsFile] -> [Module] -> m [Module] Source #
Replaces all local names with qualified names within a list of modules. The modules should be topologically sorted beforehand.
desugarImportsWithEnv :: forall m. (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => [ExternsFile] -> [Module] -> m (Env, [Module]) Source #
checkExhaustiveExpr :: forall m. (MonadWriter MultipleErrors m, MonadSupply m) => SourceSpan -> Environment -> ModuleName -> Expr -> m Expr Source #
Exhaustivity checking
lint :: forall m. MonadWriter MultipleErrors m => Module -> m () Source #
Lint the PureScript AST. | | Right now, this pass only performs a shadowing check.
checkNewtype :: forall m. MonadError MultipleErrors m => ProperName TypeName -> [(ProperName ConstructorName, [(Ident, SourceType)])] -> m () Source #
typeCheckModule :: forall m. (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => Module -> m Module Source #
Type check an entire module and ensure all types and classes defined within the module that are required by exported members are also exported.
deriveInstances :: forall m. (MonadError MultipleErrors m, MonadWriter MultipleErrors m, MonadSupply m) => [ExternsFile] -> Module -> m Module Source #
Elaborates deriving instance declarations by code generation.
desugar :: (MonadSupply m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => [ExternsFile] -> [Module] -> m [Module] Source #
The desugaring pipeline proceeds as follows:
- Remove signed literals in favour of
negate
applications - Desugar object literals with wildcards into lambdas
- Desugar operator sections
- Desugar do-notation
- Desugar ado-notation
- Desugar top-level case declarations into explicit case expressions
- Desugar type declarations into value declarations with explicit type annotations
- Qualify any unqualified names and types
- Rebracket user-defined binary operators
- Introduce type synonyms for type class dictionaries
- Group mutually recursive value and data declarations into binding groups.
renameInModules :: [Module Ann] -> [Module Ann] Source #
Renames within each declaration in a module.
data MakeActions m Source #
Actions that require implementations when running in "make" mode.
This type exists to make two things abstract:
- The particular backend being used (JavaScript, C++11, etc.)
- The details of how files are read/written etc.
MakeActions | |
|
type Externs = ByteString Source #
Generated code for an externs file.
data ProgressMessage Source #
Progress messages from the make process
CompilingModule ModuleName | Compilation started for the specified module |
Instances
Eq ProgressMessage Source # | |
Defined in Language.PureScript.Make.Actions (==) :: ProgressMessage -> ProgressMessage -> Bool # (/=) :: ProgressMessage -> ProgressMessage -> Bool # | |
Ord ProgressMessage Source # | |
Defined in Language.PureScript.Make.Actions compare :: ProgressMessage -> ProgressMessage -> Ordering # (<) :: ProgressMessage -> ProgressMessage -> Bool # (<=) :: ProgressMessage -> ProgressMessage -> Bool # (>) :: ProgressMessage -> ProgressMessage -> Bool # (>=) :: ProgressMessage -> ProgressMessage -> Bool # max :: ProgressMessage -> ProgressMessage -> ProgressMessage # min :: ProgressMessage -> ProgressMessage -> ProgressMessage # | |
Show ProgressMessage Source # | |
Defined in Language.PureScript.Make.Actions showsPrec :: Int -> ProgressMessage -> ShowS # show :: ProgressMessage -> String # showList :: [ProgressMessage] -> ShowS # |
data RebuildPolicy Source #
Determines when to rebuild a module
RebuildNever | Never rebuild this module |
RebuildAlways | Always rebuild this module |
Instances
Eq RebuildPolicy Source # | |
Defined in Language.PureScript.Make.Actions (==) :: RebuildPolicy -> RebuildPolicy -> Bool # (/=) :: RebuildPolicy -> RebuildPolicy -> Bool # | |
Ord RebuildPolicy Source # | |
Defined in Language.PureScript.Make.Actions compare :: RebuildPolicy -> RebuildPolicy -> Ordering # (<) :: RebuildPolicy -> RebuildPolicy -> Bool # (<=) :: RebuildPolicy -> RebuildPolicy -> Bool # (>) :: RebuildPolicy -> RebuildPolicy -> Bool # (>=) :: RebuildPolicy -> RebuildPolicy -> Bool # max :: RebuildPolicy -> RebuildPolicy -> RebuildPolicy # min :: RebuildPolicy -> RebuildPolicy -> RebuildPolicy # | |
Show RebuildPolicy Source # | |
Defined in Language.PureScript.Make.Actions showsPrec :: Int -> RebuildPolicy -> ShowS # show :: RebuildPolicy -> String # showList :: [RebuildPolicy] -> ShowS # |
:: FilePath | the output directory |
-> Map ModuleName (Either RebuildPolicy FilePath) | a map between module names and paths to the file containing the PureScript module |
-> Map ModuleName FilePath | a map between module name and the file containing the foreign javascript for the module |
-> Bool | Generate a prefix comment? |
-> MakeActions Make |
A set of make actions that read and write modules from the given directory.
checkForeignDecls :: Module ann -> FilePath -> Make () Source #
Check that the declarations in a given PureScript module match with those in its corresponding foreign module.
rebuildModule :: forall m. (Monad m, MonadBaseControl IO m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => MakeActions m -> [ExternsFile] -> Module -> m ExternsFile Source #
Rebuild a single module.
This function is used for fast-rebuild workflows (PSCi and psc-ide are examples).
make :: forall m. (Monad m, MonadBaseControl IO m, MonadError MultipleErrors m, MonadWriter MultipleErrors m) => MakeActions m -> [PartialResult Module] -> m [ExternsFile] Source #
Compiles in "make" mode, compiling each module separately to a .js
file and an externs.json
file.
If timestamps have not changed, the externs file can be used to provide the module's types without having to typecheck the module again.
inferForeignModules :: forall m. MonadIO m => Map ModuleName (Either RebuildPolicy FilePath) -> m (Map ModuleName FilePath) Source #
Infer the module name for a module by looking for the same filename with a .js extension.