| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Telescope.Data.Parser
Synopsis
- data Parser :: Effect where
- runParser :: Error ParseError :> es => Eff (Parser : es) a -> Eff es a
- runParserPure :: Eff '[Parser, Error ParseError] a -> Either ParseError a
- runParserAlts :: Parser :> es => Eff es a -> Eff (NonDet : es) a -> Eff es a
- data Ref
- newtype Path = Path [Ref]
- data ParseError = ParseFailure Path String
- expected :: (Show value, Parser :> es) => String -> value -> Eff es a
- parseFail :: Parser :> es => String -> Eff es a
- parseAt :: Parser :> es => Ref -> Eff es a -> Eff es a
- class Applicative f => Alternative (f :: Type -> Type) where
- data NonDet (a :: Type -> Type) b
- tryParserEmpty :: (NonDet :> es, Parser :> es) => Eff (Parser : (Error ParseError : es)) a -> Eff es a
Documentation
data Parser :: Effect where Source #
Instances
| type DispatchOf Parser Source # | |
Defined in Telescope.Data.Parser | |
runParserPure :: Eff '[Parser, Error ParseError] a -> Either ParseError a Source #
Tracks the location of the parser in the document for error messages
data ParseError Source #
Constructors
| ParseFailure Path String |
Instances
| Exception ParseError Source # | |
Defined in Telescope.Data.Parser Methods toException :: ParseError -> SomeException # fromException :: SomeException -> Maybe ParseError # displayException :: ParseError -> String # | |
| Show ParseError Source # | |
Defined in Telescope.Data.Parser Methods showsPrec :: Int -> ParseError -> ShowS # show :: ParseError -> String # showList :: [ParseError] -> ShowS # | |
| Eq ParseError Source # | |
Defined in Telescope.Data.Parser | |
expected :: (Show value, Parser :> es) => String -> value -> Eff es a Source #
Easy error message when we expect a particular type:
instance FromKeyword Int where
parseKeywordValue = \case
Integer n -> pure n
v -> expected "Integer" vclass Applicative f => Alternative (f :: Type -> Type) where #
A monoid on applicative functors.
If defined, some and many should be the least solutions
of the equations:
Methods
The identity of <|>
(<|>) :: f a -> f a -> f a infixl 3 #
An associative binary operation
One or more.
Zero or more.
Instances
data NonDet (a :: Type -> Type) b #
Provide the ability to use the Alternative and MonadPlus instance for
Eff.
Note: NonDet does not backtrack. Formally, it obeys the "left-catch" law
for MonadPlus, rather than the "left-distribution" law. This means that it
behaves more like Maybe than [].
Since: effectful-core-2.2.0.0
Instances
| type DispatchOf NonDet | |
Defined in Effectful.Internal.Monad | |