Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype Nice a = Nice {
- unNice :: ReaderT NiceEnv (ExceptT DeclarationException (State NiceState)) a
- runNice :: NiceEnv -> Nice a -> (Either DeclarationException a, NiceWarnings)
- data NiceEnv = NiceEnv {
- safeButNotBuiltin :: Bool
- data NiceState = NiceState {}
- data LoneSig = LoneSig {}
- type LoneSigs = Map Name LoneSig
- type NiceWarnings = [DeclarationWarning]
- initNiceState :: NiceState
- lensNameId :: Lens' NiceState NameId
- nextNameId :: Nice NameId
- loneSigs :: Lens' NiceState LoneSigs
- addLoneSig :: Range -> Name -> DataRecOrFun -> Nice Name
- removeLoneSig :: Name -> Nice ()
- getSig :: Name -> Nice (Maybe DataRecOrFun)
- noLoneSigs :: Nice Bool
- forgetLoneSigs :: Nice ()
- checkLoneSigs :: LoneSigs -> Nice ()
- breakImplicitMutualBlock :: KwRange -> String -> Nice ()
- loneFuns :: LoneSigs -> [(Name, Name)]
- loneSigsFromLoneNames :: [(Range, Name, DataRecOrFun)] -> LoneSigs
- terminationCheckPragma :: Lens' NiceState TerminationCheck
- withTerminationCheckPragma :: TerminationCheck -> Nice a -> Nice a
- coverageCheckPragma :: Lens' NiceState CoverageCheck
- withCoverageCheckPragma :: CoverageCheck -> Nice a -> Nice a
- positivityCheckPragma :: Lens' NiceState PositivityCheck
- withPositivityCheckPragma :: PositivityCheck -> Nice a -> Nice a
- universeCheckPragma :: Lens' NiceState UniverseCheck
- withUniverseCheckPragma :: UniverseCheck -> Nice a -> Nice a
- getUniverseCheckFromSig :: Name -> Nice UniverseCheck
- catchallPragma :: Lens' NiceState Catchall
- popCatchallPragma :: Nice Catchall
- withCatchallPragma :: Catchall -> Nice a -> Nice a
- niceWarning :: DeclarationWarning -> Nice ()
- declarationException :: HasCallStack => DeclarationException' -> Nice a
- declarationWarning' :: DeclarationWarning' -> CallStack -> Nice ()
- declarationWarning :: HasCallStack => DeclarationWarning' -> Nice ()
Documentation
Nicifier monad. Preserve the state when throwing an exception.
Nice | |
|
Instances
Applicative Nice Source # | |
Functor Nice Source # | |
Monad Nice Source # | |
MonadError DeclarationException Nice Source # | |
Defined in Agda.Syntax.Concrete.Definitions.Monad throwError :: DeclarationException -> Nice a catchError :: Nice a -> (DeclarationException -> Nice a) -> Nice a | |
MonadReader NiceEnv Nice Source # | |
MonadState NiceState Nice Source # | |
Null a => Null (Nice a) Source # | |
runNice :: NiceEnv -> Nice a -> (Either DeclarationException a, NiceWarnings) Source #
Run a Nicifier computation, return result and warnings (in chronological order).
Nicifier parameters.
NiceEnv | |
|
Nicifier state.
NiceState | |
|
= Map Name LoneSig | We retain the Another reason is that we want to distinguish different
occurrences of |
type NiceWarnings Source #
= [DeclarationWarning] | Stack of warnings. Head is last warning. |
initNiceState :: NiceState Source #
Initial nicifier state.
nextNameId :: Nice NameId Source #
Handling the lone signatures, stored to infer mutual blocks.
addLoneSig :: Range -> Name -> DataRecOrFun -> Nice Name Source #
Adding a lone signature to the state.
Return the name (which is made unique if isNoName
).
removeLoneSig :: Name -> Nice () Source #
Remove a lone signature from the state.
noLoneSigs :: Nice Bool Source #
Check that no lone signatures are left in the state.
forgetLoneSigs :: Nice () Source #
checkLoneSigs :: LoneSigs -> Nice () Source #
Ensure that all forward declarations have been given a definition.
breakImplicitMutualBlock :: KwRange -> String -> Nice () Source #
Ensure that all forward declarations have been given a definition, raising an error indicating *why* they would have had to have been defined.
loneFuns :: LoneSigs -> [(Name, Name)] Source #
Get names of lone function signatures, plus their unique names.
loneSigsFromLoneNames :: [(Range, Name, DataRecOrFun)] -> LoneSigs Source #
Create a LoneSigs
map from an association list.
terminationCheckPragma :: Lens' NiceState TerminationCheck Source #
Lens for field _termChk
.
withTerminationCheckPragma :: TerminationCheck -> Nice a -> Nice a Source #
withCoverageCheckPragma :: CoverageCheck -> Nice a -> Nice a Source #
positivityCheckPragma :: Lens' NiceState PositivityCheck Source #
Lens for field _posChk
.
withPositivityCheckPragma :: PositivityCheck -> Nice a -> Nice a Source #
universeCheckPragma :: Lens' NiceState UniverseCheck Source #
Lens for field _uniChk
.
withUniverseCheckPragma :: UniverseCheck -> Nice a -> Nice a Source #
getUniverseCheckFromSig :: Name -> Nice UniverseCheck Source #
Get universe check pragma from a data/rec signature.
Defaults to YesUniverseCheck
.
popCatchallPragma :: Nice Catchall Source #
Get current catchall pragma, and reset it for the next clause.
niceWarning :: DeclarationWarning -> Nice () Source #
Add a new warning.
declarationException :: HasCallStack => DeclarationException' -> Nice a Source #
declarationWarning' :: DeclarationWarning' -> CallStack -> Nice () Source #
declarationWarning :: HasCallStack => DeclarationWarning' -> Nice () Source #