unison-syntax-0.0.0
Safe HaskellNone
LanguageHaskell2010

Unison.Syntax.Parser

Synopsis

Documentation

class Annotated a where Source #

Methods

ann :: a -> Ann Source #

Instances

Instances details
Annotated Void Source # 
Instance details

Defined in Unison.Parser.Ann

Methods

ann :: Void -> Ann Source #

Annotated Ann Source # 
Instance details

Defined in Unison.Parser.Ann

Methods

ann :: Ann -> Ann Source #

Annotated a => Annotated (NonEmpty a) Source # 
Instance details

Defined in Unison.Parser.Ann

Methods

ann :: NonEmpty a -> Ann Source #

Annotated a => Annotated (Pattern a) Source # 
Instance details

Defined in Unison.Syntax.Parser

Methods

ann :: Pattern a -> Ann Source #

Annotated (Token a) Source # 
Instance details

Defined in Unison.Syntax.Lexer.Token

Methods

ann :: Token a -> Ann Source #

Annotated (Pattern v) Source # 
Instance details

Defined in Unison.Syntax.Pattern

Methods

ann :: Pattern v -> Ann Source #

Annotated a => Annotated (Maybe a) Source # 
Instance details

Defined in Unison.Parser.Ann

Methods

ann :: Maybe a -> Ann Source #

Annotated a => Annotated [a] Source # 
Instance details

Defined in Unison.Parser.Ann

Methods

ann :: [a] -> Ann Source #

Annotated a => Annotated (Cofree f a) Source # 
Instance details

Defined in Unison.Parser.Ann

Methods

ann :: Cofree f a -> Ann Source #

(Annotated a, Annotated b) => Annotated (MatchCase a b) Source # 
Instance details

Defined in Unison.Syntax.Parser

Methods

ann :: MatchCase a b -> Ann Source #

Annotated a => Annotated (Term f v a) Source # 
Instance details

Defined in Unison.Syntax.Parser

Methods

ann :: Term f v a -> Ann Source #

data Error v Source #

Instances

Instances details
Show v => Show (Error v) Source # 
Instance details

Defined in Unison.Syntax.Parser

Methods

showsPrec :: Int -> Error v -> ShowS #

show :: Error v -> String #

showList :: [Error v] -> ShowS #

Eq v => Eq (Error v) Source # 
Instance details

Defined in Unison.Syntax.Parser

Methods

(==) :: Error v -> Error v -> Bool #

(/=) :: Error v -> Error v -> Bool #

Ord v => Ord (Error v) Source # 
Instance details

Defined in Unison.Syntax.Parser

Methods

compare :: Error v -> Error v -> Ordering #

(<) :: Error v -> Error v -> Bool #

(<=) :: Error v -> Error v -> Bool #

(>) :: Error v -> Error v -> Bool #

(>=) :: Error v -> Error v -> Bool #

max :: Error v -> Error v -> Error v #

min :: Error v -> Error v -> Error v #

newtype Input Source #

Constructors

Input 

Fields

Instances

Instances details
Show Input Source # 
Instance details

Defined in Unison.Syntax.Parser

Methods

showsPrec :: Int -> Input -> ShowS #

show :: Input -> String #

showList :: [Input] -> ShowS #

Eq Input Source # 
Instance details

Defined in Unison.Syntax.Parser

Methods

(==) :: Input -> Input -> Bool #

(/=) :: Input -> Input -> Bool #

Ord Input Source # 
Instance details

Defined in Unison.Syntax.Parser

Methods

compare :: Input -> Input -> Ordering #

(<) :: Input -> Input -> Bool #

(<=) :: Input -> Input -> Bool #

(>) :: Input -> Input -> Bool #

(>=) :: Input -> Input -> Bool #

max :: Input -> Input -> Input #

min :: Input -> Input -> Input #

Stream Input Source # 
Instance details

Defined in Unison.Syntax.Parser

Associated Types

type Token Input 
Instance details

Defined in Unison.Syntax.Parser

type Tokens Input 
Instance details

Defined in Unison.Syntax.Parser

VisualStream Input Source # 
Instance details

Defined in Unison.Syntax.Parser

type Token Input Source # 
Instance details

Defined in Unison.Syntax.Parser

type Tokens Input Source # 
Instance details

Defined in Unison.Syntax.Parser

type P v (m :: Type -> Type) = ParsecT (Error v) Input (ReaderT (ParsingEnv m) m) Source #

data ParsingEnv (m :: Type -> Type) Source #

Constructors

ParsingEnv 

Fields

newtype UniqueName Source #

Constructors

UniqueName (Pos -> Int -> Maybe Text) 

anyToken :: forall v (m :: Type -> Type). Ord v => P v m (Token Lexeme) Source #

blank :: forall v (m :: Type -> Type). Ord v => P v m (Token NameSegment) Source #

Parse a placeholder or typed hole

bytesToken :: forall v (m :: Type -> Type). Ord v => P v m (Token Bytes) Source #

chainl1 :: forall v (m :: Type -> Type) a. Ord v => P v m a -> P v m (a -> a -> a) -> P v m a Source #

Parse p 1+ times, combining with op

chainr1 :: forall v (m :: Type -> Type) a. Ord v => P v m a -> P v m (a -> a -> a) -> P v m a Source #

chainl1Accum :: forall u s (m :: Type -> Type) a. (Stream u, Ord s) => ParsecT s u m a -> ParsecT s u m (a -> a -> a) -> ParsecT s u m (a, [a -> a]) Source #

character :: forall v (m :: Type -> Type). Ord v => P v m (Token Char) Source #

closeBlock :: forall v (m :: Type -> Type). Ord v => P v m (Token ()) Source #

Consume the end of a block

optionalCloseBlock :: forall v (m :: Type -> Type). 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.

failCommitted :: forall v (m :: Type -> Type) x. Ord v => Error v -> P v m x Source #

failureIf :: forall v (m :: Type -> Type) b a. 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

hqInfixId :: forall v (m :: Type -> Type). Ord v => P v m (Token (HashQualified Name)) Source #

hqPrefixId :: forall v (m :: Type -> Type). Ord v => P v m (Token (HashQualified Name)) Source #

importRelativeSymbolyId :: forall v (m :: Type -> Type). Ord v => P v m (Token Name) Source #

The + in: use Foo.bar + as a relative Name

importRelativeWordyId :: forall v (m :: Type -> Type). Ord v => P v m (Token Name) Source #

Parse a wordyId as a relative Name, rejecting any hash

importSymbolyId :: forall v (m :: Type -> Type). Ord v => P v m (Token Name) Source #

The + in: use Foo.bar + as a Name

importWordyId :: forall v (m :: Type -> Type). Ord v => P v m (Token Name) Source #

Parse a wordyId as a Name, rejecting any hash

label :: forall v a (m :: Type -> Type). (Ord v, Show a) => String -> P v m a -> P v m a Source #

matchToken :: forall v (m :: Type -> Type). Ord v => Lexeme -> P v m (Token Lexeme) Source #

Match a particular lexeme exactly, and consume it.

mkAnn :: (Annotated a, Annotated b) => a -> b -> Ann Source #

numeric :: forall v (m :: Type -> Type). Ord v => P v m (Token String) Source #

openBlock :: forall v (m :: Type -> Type). Ord v => P v m (Token String) Source #

Consume a block opening and return the string that opens the block.

openBlockWith :: forall v (m :: Type -> Type). Ord v => String -> P v m (Token ()) Source #

peekAny :: forall v (m :: Type -> Type). Ord v => P v m (Token Lexeme) Source #

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 :: forall v (m :: Type -> Type). Var v => P v m (Token v) Source #

Parse a prefix identifier e.g. Foo or (+), discarding any hash

prefixTermName :: forall v (m :: Type -> Type). 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 :: forall v a (m :: Type -> Type). Ord v => (Lexeme -> Maybe a) -> P v m (Token a) Source #

Virtual pattern match on a lexeme.

reserved :: forall v (m :: Type -> Type). Ord v => String -> P v m (Token String) Source #

Parse a reserved word

resolveUniqueTypeGuid :: forall (m :: Type -> Type) v. (Monad m, Var v) => v -> P v m Modifier Source #

root :: forall v (m :: Type -> Type) a. Ord v => P v m a -> P v m a Source #

rootFile :: forall v (m :: Type -> Type) a. Ord v => P v m a -> P v m a Source #

run' :: (Monad m, Ord v) => P v m a -> String -> String -> ParsingEnv m -> m (Either (Err v) a) Source #

run :: (Monad m, Ord v) => P v m a -> String -> ParsingEnv m -> m (Either (Err v) a) Source #

semi :: forall v (m :: Type -> Type). Ord v => P v m (Token ()) Source #

Consume a virtual semicolon

seq :: forall v a (m :: Type -> Type). Ord v => (Ann -> [a] -> a) -> P v m a -> P v m a Source #

seq' :: forall v a b (m :: Type -> Type). Ord v => String -> (Ann -> [a] -> b) -> P v m a -> P v m b Source #

sepBy :: forall v (m :: Type -> Type) a b. Ord v => P v m a -> P v m b -> P v m [b] Source #

sepBy1 :: forall v (m :: Type -> Type) a b. Ord v => P v m a -> P v m b -> P v m [b] Source #

string :: forall v (m :: Type -> Type). Ord v => P v m (Token Text) Source #

symbolyDefinitionName :: forall v (m :: Type -> Type). Var v => P v m (Token v) Source #

Parse a symboly ID like >>= or &&, discarding any hash

tok :: (Ann -> a -> b) -> Token a -> b Source #

tupleOrParenthesized :: forall v (m :: Type -> Type) a. Ord v => P v m a -> (Ann -> a) -> (a -> a -> a) -> P v m (Ann, a) Source #

Parses a tuple of as, or a single parenthesized a

returns the result of combining elements with pair, alongside the annotation containing the full parenthesized expression.

uniqueName :: forall (m :: Type -> Type) v. (Monad m, Var v) => Int -> P v m Text Source #

wordyDefinitionName :: forall v (m :: Type -> Type). Var v => P v m (Token v) Source #

Parse a wordy identifier e.g. Foo, discarding any hash

wordyPatternName :: forall v (m :: Type -> Type). Var v => P v m (Token v) Source #

Orphan instances

Annotated a => Annotated (Pattern a) Source # 
Instance details

Methods

ann :: Pattern a -> Ann Source #

(Annotated a, Annotated b) => Annotated (MatchCase a b) Source # 
Instance details

Methods

ann :: MatchCase a b -> Ann Source #

Annotated a => Annotated (Term f v a) Source # 
Instance details

Methods

ann :: Term f v a -> Ann Source #