Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- class Annotated a where
- type Err v = ParseError Input (Error v)
- data Error v
- = SignatureNeedsAccompanyingBody (Token v)
- | DisallowedAbsoluteName (Token Name)
- | EmptyBlock (Token String)
- | UnknownTerm (Token (HashQualified Name)) (Set Referent)
- | UnknownType (Token (HashQualified Name)) (Set Reference)
- | UnknownId (Token (HashQualified Name)) (Set Referent) (Set Reference)
- | ExpectedBlockOpen String (Token Lexeme)
- | EmptyWatch Ann
- | UseInvalidPrefixSuffix (Either (Token Name) (Token Name)) (Maybe [Token Name])
- | UseEmpty (Token String)
- | DidntExpectExpression (Token Lexeme) (Maybe (Token Lexeme))
- | TypeDeclarationErrors [Error v Ann]
- | MissingTypeModifier (Token String) (Token v)
- | TypeNotAllowed (Token (HashQualified Name))
- | ResolutionFailures [ResolutionFailure Ann]
- | DuplicateTypeNames [(v, [Ann])]
- | DuplicateTermNames [(v, [Ann])]
- | PatternArityMismatch Int Int Ann
- | FloatPattern Ann
- newtype Input = Input {
- inputStream :: [Token Lexeme]
- type P v m = ParsecT (Error v) Input (ReaderT (ParsingEnv m) m)
- data ParsingEnv (m :: Type -> Type) = ParsingEnv {}
- newtype UniqueName = UniqueName (Pos -> Int -> Maybe Text)
- anyToken :: Ord v => P v m (Token Lexeme)
- blank :: Ord v => P v m (Token NameSegment)
- bytesToken :: Ord v => P v m (Token Bytes)
- chainl1 :: Ord v => P v m a -> P v m (a -> a -> a) -> P v m a
- chainr1 :: Ord v => P v m a -> P v m (a -> a -> a) -> P v m a
- chainl1Accum :: (Stream u, Ord s) => ParsecT s u m a -> ParsecT s u m (a -> a -> a) -> ParsecT s u m (a, [a -> a])
- character :: Ord v => P v m (Token Char)
- closeBlock :: Ord v => P v m (Token ())
- optionalCloseBlock :: Ord v => P v m (Token ())
- doc :: Ord v => P v m (Token (UntitledSection (Tree (Token (ReferenceType, HashQualified Name)) [Token Lexeme])))
- failCommitted :: Ord v => Error v -> P v m x
- failureIf :: Ord v => P v m (P v m b) -> P v m a -> P v m b
- hqInfixId :: Ord v => P v m (Token (HashQualified Name))
- hqPrefixId :: Ord v => P v m (Token (HashQualified Name))
- importSymbolyId :: Ord v => P v m (Token Name)
- importWordyId :: Ord v => P v m (Token Name)
- label :: (Ord v, Show a) => String -> P v m a -> P v m a
- matchToken :: Ord v => Lexeme -> P v m (Token Lexeme)
- mkAnn :: (Annotated a, Annotated b) => a -> b -> Ann
- numeric :: Ord v => P v m (Token String)
- openBlock :: Ord v => P v m (Token String)
- openBlockWith :: Ord v => String -> P v m (Token ())
- peekAny :: Ord v => P v m (Token Lexeme)
- positionalVar :: (Annotated a, Var v) => a -> v -> v
- prefixDefinitionName :: Var v => P v m (Token v)
- prefixTermName :: Var v => P v m (Token v)
- queryToken :: Ord v => (Lexeme -> Maybe a) -> P v m (Token a)
- reserved :: Ord v => String -> P v m (Token String)
- resolveUniqueTypeGuid :: (Monad m, Var v) => v -> P v m Modifier
- root :: Ord v => P v m a -> P v m a
- rootFile :: Ord v => P v m a -> P v m a
- run' :: (Monad m, Ord v) => P v m a -> String -> String -> ParsingEnv m -> m (Either (Err v) a)
- run :: (Monad m, Ord v) => P v m a -> String -> ParsingEnv m -> m (Either (Err v) a)
- semi :: Ord v => P v m (Token ())
- seq :: Ord v => (Ann -> [a] -> a) -> P v m a -> P v m a
- seq' :: Ord v => String -> (Ann -> [a] -> b) -> P v m a -> P v m b
- sepBy :: Ord v => P v m a -> P v m b -> P v m [b]
- sepBy1 :: Ord v => P v m a -> P v m b -> P v m [b]
- string :: Ord v => P v m (Token Text)
- symbolyDefinitionName :: Var v => P v m (Token v)
- tok :: (Ann -> a -> b) -> Token a -> b
- tokenToPair :: Token a -> (Ann, a)
- tupleOrParenthesized :: Ord v => P v m a -> (Ann -> a) -> (a -> a -> a) -> P v m (Ann, a)
- uniqueBase32Namegen :: forall gen. DRG gen => gen -> UniqueName
- uniqueName :: (Monad m, Var v) => Int -> P v m Text
- wordyDefinitionName :: Var v => P v m (Token v)
- wordyPatternName :: Var v => P v m (Token v)
Documentation
class Annotated a where Source #
Instances
Annotated Void Source # | |
Annotated Ann Source # | |
Annotated a => Annotated (NonEmpty a) Source # | |
Annotated a => Annotated (Pattern a) Source # | |
Annotated (Token a) Source # | |
Annotated a => Annotated (Maybe a) Source # | |
Annotated a => Annotated [a] Source # | |
Defined in Unison.Parser.Ann | |
Annotated a => Annotated (Cofree f a) Source # | |
(Annotated a, Annotated b) => Annotated (MatchCase a b) Source # | |
Annotated a => Annotated (Term f v a) Source # | |
SignatureNeedsAccompanyingBody (Token v) | |
DisallowedAbsoluteName (Token Name) | |
EmptyBlock (Token String) | |
UnknownTerm (Token (HashQualified Name)) (Set Referent) | |
UnknownType (Token (HashQualified Name)) (Set Reference) | |
UnknownId (Token (HashQualified Name)) (Set Referent) (Set Reference) | |
ExpectedBlockOpen String (Token Lexeme) | |
EmptyWatch Ann | |
UseInvalidPrefixSuffix (Either (Token Name) (Token Name)) (Maybe [Token Name]) | |
UseEmpty (Token String) | |
DidntExpectExpression (Token Lexeme) (Maybe (Token Lexeme)) | |
TypeDeclarationErrors [Error v Ann] | |
MissingTypeModifier (Token String) (Token v) | MissingTypeModifier (type|ability) name |
TypeNotAllowed (Token (HashQualified Name)) | A type was found in a position that requires a term |
ResolutionFailures [ResolutionFailure Ann] | |
DuplicateTypeNames [(v, [Ann])] | |
DuplicateTermNames [(v, [Ann])] | |
PatternArityMismatch Int Int Ann | PatternArityMismatch expectedArity actualArity location |
FloatPattern Ann |
Input | |
|
Instances
Show Input Source # | |
Eq Input Source # | |
Ord Input Source # | |
Stream Input Source # | |
Defined in Unison.Syntax.Parser tokenToChunk :: Proxy Input -> Token Input -> Tokens Input # tokensToChunk :: Proxy Input -> [Token Input] -> Tokens Input # chunkToTokens :: Proxy Input -> Tokens Input -> [Token Input] # chunkLength :: Proxy Input -> Tokens Input -> Int # chunkEmpty :: Proxy Input -> Tokens Input -> Bool # take1_ :: Input -> Maybe (Token Input, Input) # takeN_ :: Int -> Input -> Maybe (Tokens Input, Input) # takeWhile_ :: (Token Input -> Bool) -> Input -> (Tokens Input, Input) # | |
VisualStream Input Source # | |
type Token Input Source # | |
type Tokens Input Source # | |
data ParsingEnv (m :: Type -> Type) Source #
ParsingEnv | |
|
newtype UniqueName Source #
UniqueName (Pos -> Int -> Maybe Text) |
Instances
Monoid UniqueName Source # | |
Defined in Unison.Syntax.Parser mempty :: UniqueName # mappend :: UniqueName -> UniqueName -> UniqueName # mconcat :: [UniqueName] -> UniqueName # | |
Semigroup UniqueName Source # | |
Defined in Unison.Syntax.Parser (<>) :: UniqueName -> UniqueName -> UniqueName # sconcat :: NonEmpty UniqueName -> UniqueName # stimes :: Integral b => b -> UniqueName -> UniqueName # |
chainl1 :: Ord v => P v m a -> P v m (a -> a -> a) -> P v m a Source #
Parse p
1+ times, combining with op
chainl1Accum :: (Stream u, Ord s) => ParsecT s u m a -> ParsecT s u m (a -> a -> a) -> ParsecT s u m (a, [a -> a]) Source #
optionalCloseBlock :: Ord v => P v m (Token ()) Source #
With layout, blocks might “close” without an explicit outdent (e.g., not even a newline at the end of a
Transclude
). This allows those blocks to be closed by EOF.
doc :: Ord v => P v m (Token (UntitledSection (Tree (Token (ReferenceType, HashQualified Name)) [Token Lexeme]))) Source #
failureIf :: Ord v => P v m (P v m b) -> P v m a -> P v m b Source #
If p
would succeed, this fails uncommitted.
Otherwise, failIfOk
used to produce the output
hqPrefixId :: Ord v => P v m (Token (HashQualified Name)) Source #
matchToken :: Ord v => Lexeme -> P v m (Token Lexeme) Source #
Match a particular lexeme exactly, and consume it.
openBlock :: Ord v => P v m (Token String) Source #
Consume a block opening and return the string that opens the block.
positionalVar :: (Annotated a, Var v) => a -> v -> v Source #
Gives this var an id based on its position - a useful trick to obtain a variable whose id won't match any other id in the file `positionalVar a Var.missingResult`
prefixDefinitionName :: Var v => P v m (Token v) Source #
Parse a prefix identifier e.g. Foo or (+), discarding any hash
prefixTermName :: Var v => P v m (Token v) Source #
Parse a prefix identifier e.g. Foo or (+), rejecting any hash This is useful for term declarations, where type signatures and term names should not have hashes.
queryToken :: Ord v => (Lexeme -> Maybe a) -> P v m (Token a) Source #
Virtual pattern match on a lexeme.
run' :: (Monad m, Ord v) => P v m a -> String -> String -> ParsingEnv m -> m (Either (Err v) a) Source #
symbolyDefinitionName :: Var v => P v m (Token v) Source #
Parse a symboly ID like >>= or &&, discarding any hash
tokenToPair :: Token a -> (Ann, a) Source #
tupleOrParenthesized :: Ord v => P v m a -> (Ann -> a) -> (a -> a -> a) -> P v m (Ann, a) Source #
Parses a tuple of a
s, or a single parenthesized a
returns the result of combining elements with pair
, alongside the annotation containing
the full parenthesized expression.
uniqueBase32Namegen :: forall gen. DRG gen => gen -> UniqueName Source #
wordyDefinitionName :: Var v => P v m (Token v) Source #
Parse a wordy identifier e.g. Foo, discarding any hash