Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- data PrettyCursor
- data PrettyState = PrettyState {
- ps'nameMap :: Map Index Text
- ps'names :: Set Text
- ps'cursor :: PrettyCursor
- type PrettyMonad s = ReaderT (STGenM StdGen s) (StateT PrettyState (ST s))
- forkState :: MonadState s m => m b -> m b
- normalizeCursor :: PrettyState -> PrettyState
- specializeCursor :: PrettyState -> PrettyState
- memorizeName :: Text -> PrettyState -> PrettyState
- insertName :: Text -> PrettyState -> PrettyState
- insertBindings :: [Text] -> PrettyState -> PrettyState
- builtinFunAtRef :: Map Index Text -> Index -> Maybe DefaultFun
- nameOfRef :: Index -> Map Index Text -> Maybe Text
Documentation
data PrettyCursor Source #
Notifies the prettifier what "state" the cursor currently is, so it can decide whether or not to wrap the target expression in parens.
Normal indicates no parens wrapping is necessary, even for complex expressions.
Special indicates complex expressions should be wrapped in parens.
Usually, Special just hints at one of three states:
- Applying - The expression is being applied like a function.
- Applied - The expression is being applied as a function argument.
- Unary arg - The expression is being used as an argument to a high arity unary operator (~ and !).
Instances
Bounded PrettyCursor Source # | |
Defined in Plutarch.Pretty.Internal.Types | |
Enum PrettyCursor Source # | |
Defined in Plutarch.Pretty.Internal.Types succ :: PrettyCursor -> PrettyCursor Source # pred :: PrettyCursor -> PrettyCursor Source # toEnum :: Int -> PrettyCursor Source # fromEnum :: PrettyCursor -> Int Source # enumFrom :: PrettyCursor -> [PrettyCursor] Source # enumFromThen :: PrettyCursor -> PrettyCursor -> [PrettyCursor] Source # enumFromTo :: PrettyCursor -> PrettyCursor -> [PrettyCursor] Source # enumFromThenTo :: PrettyCursor -> PrettyCursor -> PrettyCursor -> [PrettyCursor] Source # | |
Show PrettyCursor Source # | |
Defined in Plutarch.Pretty.Internal.Types | |
Eq PrettyCursor Source # | |
Defined in Plutarch.Pretty.Internal.Types (==) :: PrettyCursor -> PrettyCursor -> Bool Source # (/=) :: PrettyCursor -> PrettyCursor -> Bool Source # |
data PrettyState Source #
PrettyState | |
|
type PrettyMonad s = ReaderT (STGenM StdGen s) (StateT PrettyState (ST s)) Source #
forkState :: MonadState s m => m b -> m b Source #
memorizeName :: Text -> PrettyState -> PrettyState Source #
insertName :: Text -> PrettyState -> PrettyState Source #
Insert a fresh binding onto the name map, i.e a name at index 0 - incrementing all other indices.
insertBindings :: [Text] -> PrettyState -> PrettyState Source #