cryptol-3.0.0: Cryptol: The Language of Cryptography

Copyright | (c) 2013-2016 Galois Inc.
License | BSD3
Maintainer | cryptol@galois.com
Stability | provisional
Portability | portable
Safe Haskell | Safe
Language | Haskell2010

Cryptol.Parser.Position

Description

Synopsis

- data Located a = Located {
  - srcRange :: !Range
  - thing :: !a
  }
- data Position = Position {
  - line :: !Int
  - col :: !Int
  }
- data Range = Range {
  - from :: !Position
  - to :: !Position
  - source :: FilePath
  }
- rangeWithin :: Range -> Range -> Bool
- emptyRange :: Range
- start :: Position
- move :: Position -> Char -> Position
- moves :: Position -> Text -> Position
- rComb :: Range -> Range -> Range
- rCombMaybe :: Maybe Range -> Maybe Range -> Maybe Range
- rCombs :: [Range] -> Range
- class HasLoc t where
  - getLoc :: t -> Maybe Range
- class HasLoc t => AddLoc t where
  - addLoc :: t -> Range -> t
  - dropLoc :: t -> t
- at :: (HasLoc l, AddLoc t) => l -> t -> t
- combLoc :: (a -> b -> c) -> Located a -> Located b -> Located c

# Documentation

data Located a Source #

Constructors

Located |

Fields

- srcRange :: !Range
- thing :: !a

#### Instances

Instances details

Foldable Located Source # |

Instance details

Defined in Cryptol.Parser.Position

Methods

fold :: Monoid m => Located m -> m Source #

foldMap :: Monoid m => (a -> m) -> Located a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Located a -> m Source #

foldr :: (a -> b -> b) -> b -> Located a -> b Source #

foldr' :: (a -> b -> b) -> b -> Located a -> b Source #

foldl :: (b -> a -> b) -> b -> Located a -> b Source #

foldl' :: (b -> a -> b) -> b -> Located a -> b Source #

foldr1 :: (a -> a -> a) -> Located a -> a Source #

foldl1 :: (a -> a -> a) -> Located a -> a Source #

toList :: Located a -> [a] Source #

null :: Located a -> Bool Source #

length :: Located a -> Int Source #

elem :: Eq a => a -> Located a -> Bool Source #

maximum :: Ord a => Located a -> a Source #

minimum :: Ord a => Located a -> a Source #

sum :: Num a => Located a -> a Source #

product :: Num a => Located a -> a Source #

Traversable Located Source # |
Instance details Defined in Cryptol.Parser.Position Methods traverse :: Applicative f => (a -> f b) -> Located a -> f (Located b) Source # sequenceA :: Applicative f => Located (f a) -> f (Located a) Source # mapM :: Monad m => (a -> m b) -> Located a -> m (Located b) Source # sequence :: Monad m => Located (m a) -> m (Located a) Source #
Functor Located Source # |
Instance details Defined in Cryptol.Parser.Position Methods fmap :: (a -> b) -> Located a -> Located b Source # (<$) :: a -> Located b -> Located a Source #
Generic (Located a) Source # |
Instance details Defined in Cryptol.Parser.Position Associated Types type Rep (Located a) :: Type -> Type Source # Methods from :: Located a -> Rep (Located a) x Source # to :: Rep (Located a) x -> Located a Source #
Show a => Show (Located a) Source # |
Instance details Defined in Cryptol.Parser.Position Methods showsPrec :: Int -> Located a -> ShowS Source # show :: Located a -> String Source # showList :: [Located a] -> ShowS Source #
TraverseNames a => TraverseNames (Located a) Source # |
Instance details Defined in Cryptol.IR.TraverseNames Methods traverseNamesIP :: (Applicative f, ?name :: Name -> f Name) => Located a -> f (Located a) Source #
NoPos (Located t) Source # |
Instance details Defined in Cryptol.Parser.AST Methods noPos :: Located t -> Located t Source #
AddLoc (Located a) Source # |
Instance details Defined in Cryptol.Parser.Position Methods addLoc :: Located a -> Range -> Located a Source # dropLoc :: Located a -> Located a Source #
HasLoc (Located a) Source # |
Instance details Defined in Cryptol.Parser.Position Methods getLoc :: Located a -> Maybe Range Source #
ModuleInstance a => ModuleInstance (Located a) Source # |
Instance details Defined in Cryptol.TypeCheck.ModuleInstance Methods moduleInstance :: Located a -> Located a Source #
ShowParseable a => ShowParseable (Located a) Source # |
Instance details Defined in Cryptol.TypeCheck.Parseable Methods showParseable :: Located a -> Doc Void Source #
PP a => PP (Located a) Source # |
Instance details Defined in Cryptol.Parser.Position Methods ppPrec :: Int -> Located a -> Doc Source #
PPName a => PPName (Located a) Source # |
Instance details Defined in Cryptol.Parser.Position Methods ppNameFixity :: Located a -> Maybe Fixity Source # ppPrefixName :: Located a -> Doc Source # ppInfixName :: Located a -> Doc Source #
NFData a => NFData (Located a) Source # |
Instance details Defined in Cryptol.Parser.Position Methods rnf :: Located a -> () Source #
Eq a => Eq (Located a) Source # |
Instance details Defined in Cryptol.Parser.Position Methods (==) :: Located a -> Located a -> Bool Source # (/=) :: Located a -> Located a -> Bool Source #
Ord a => Ord (Located a) Source # |

Instance details

Defined in Cryptol.Parser.Position

Methods

compare :: Located a -> Located a -> Ordering Source #

(<) :: Located a -> Located a -> Bool Source #

(<=) :: Located a -> Located a -> Bool Source #

(>) :: Located a -> Located a -> Bool Source #

(>=) :: Located a -> Located a -> Bool Source #

max :: Located a -> Located a -> Located a Source #

min :: Located a -> Located a -> Located a Source #

type Rep (Located a) Source # |

Instance details

Defined in Cryptol.Parser.Position

type Rep (Located a) = D1 ('MetaData "Located" "Cryptol.Parser.Position" "cryptol-3.0.0-DBVDUAjB1JeD0WzkHH4ckn" 'False) (C1 ('MetaCons "Located" 'PrefixI 'True) (S1 ('MetaSel ('Just "srcRange") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Range) :*: S1 ('MetaSel ('Just "thing") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a)))

data Position Source #

Constructors

Position |

Fields

- line :: !Int
- col :: !Int

#### Instances

Instances details

Generic Position Source # |
Instance details Defined in Cryptol.Parser.Position Associated Types type Rep Position :: Type -> Type Source # Methods from :: Position -> Rep Position x Source # to :: Rep Position x -> Position Source #
Show Position Source # |
Instance details Defined in Cryptol.Parser.Position Methods showsPrec :: Int -> Position -> ShowS Source # show :: Position -> String Source # showList :: [Position] -> ShowS Source #
PP Position Source # |
Instance details Defined in Cryptol.Parser.Position Methods ppPrec :: Int -> Position -> Doc Source #
NFData Position Source # |
Instance details Defined in Cryptol.Parser.Position Methods rnf :: Position -> () Source #
Eq Position Source # |
Instance details Defined in Cryptol.Parser.Position Methods (==) :: Position -> Position -> Bool Source # (/=) :: Position -> Position -> Bool Source #
Ord Position Source # |
Instance details Defined in Cryptol.Parser.Position Methods compare :: Position -> Position -> Ordering Source # (<) :: Position -> Position -> Bool Source # (<=) :: Position -> Position -> Bool Source # (>) :: Position -> Position -> Bool Source # (>=) :: Position -> Position -> Bool Source # max :: Position -> Position -> Position Source # min :: Position -> Position -> Position Source #
type Rep Position Source # |
Instance details Defined in Cryptol.Parser.Position type Rep Position = D1 ('MetaData "Position" "Cryptol.Parser.Position" "cryptol-3.0.0-DBVDUAjB1JeD0WzkHH4ckn" 'False) (C1 ('MetaCons "Position" 'PrefixI 'True) (S1 ('MetaSel ('Just "line") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "col") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int)))

data Range Source #

Constructors

Range |

Fields

- from :: !Position
- to :: !Position
- source :: FilePath

#### Instances

Instances details

Generic Range Source # |
Instance details Defined in Cryptol.Parser.Position Associated Types type Rep Range :: Type -> Type Source # Methods from :: Range -> Rep Range x Source # to :: Rep Range x -> Range Source #
Show Range Source # |
Instance details Defined in Cryptol.Parser.Position Methods showsPrec :: Int -> Range -> ShowS Source # show :: Range -> String Source # showList :: [Range] -> ShowS Source #
NoPos Range Source # |
Instance details Defined in Cryptol.Parser.AST Methods noPos :: Range -> Range Source #
HasLoc Range Source # |
Instance details Defined in Cryptol.Parser.Position Methods getLoc :: Range -> Maybe Range Source #
PP Range Source # |
Instance details Defined in Cryptol.Parser.Position Methods ppPrec :: Int -> Range -> Doc Source #
NFData Range Source # |
Instance details Defined in Cryptol.Parser.Position Methods rnf :: Range -> () Source #
Eq Range Source # |
Instance details Defined in Cryptol.Parser.Position Methods (==) :: Range -> Range -> Bool Source # (/=) :: Range -> Range -> Bool Source #
Ord Range Source # |
Instance details Defined in Cryptol.Parser.Position Methods compare :: Range -> Range -> Ordering Source # (<) :: Range -> Range -> Bool Source # (<=) :: Range -> Range -> Bool Source # (>) :: Range -> Range -> Bool Source # (>=) :: Range -> Range -> Bool Source # max :: Range -> Range -> Range Source # min :: Range -> Range -> Range Source #
type Rep Range Source # |

Instance details

Defined in Cryptol.Parser.Position

type Rep Range = D1 ('MetaData "Range" "Cryptol.Parser.Position" "cryptol-3.0.0-DBVDUAjB1JeD0WzkHH4ckn" 'False) (C1 ('MetaCons "Range" 'PrefixI 'True) (S1 ('MetaSel ('Just "from") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Position) :*: (S1 ('MetaSel ('Just "to") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Position) :*: S1 ('MetaSel ('Just "source") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath))))

rangeWithin :: Range -> Range -> Bool Source #

Returns `True` if the first range is contained in the second one.

emptyRange :: Range Source #

An empty range.

Caution: using this on the LHS of a use of rComb will cause the empty source to propagate.

start :: Position Source #

move :: Position -> Char -> Position Source #

moves :: Position -> Text -> Position Source #

rComb :: Range -> Range -> Range Source #

rCombMaybe :: Maybe Range -> Maybe Range -> Maybe Range Source #

rCombs :: [Range] -> Range Source #

class HasLoc t where Source #

Methods

getLoc :: t -> Maybe Range Source #

#### Instances

Instances details

HasLoc Range Source # |
Instance details Defined in Cryptol.Parser.Position Methods getLoc :: Range -> Maybe Range Source #
HasLoc Expr Source # |
Instance details Defined in Cryptol.TypeCheck.AST Methods getLoc :: Expr -> Maybe Range Source #
HasLoc (Bind name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: Bind name -> Maybe Range Source #
HasLoc (Decl name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: Decl name -> Maybe Range Source #
HasLoc (Expr name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: Expr name -> Maybe Range Source #
HasLoc (Match name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: Match name -> Maybe Range Source #
HasLoc (ModParam name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: ModParam name -> Maybe Range Source #
HasLoc a => HasLoc (Named a) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: Named a -> Maybe Range Source #
HasLoc (NestedModule name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: NestedModule name -> Maybe Range Source #
HasLoc (Newtype name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: Newtype name -> Maybe Range Source #
HasLoc (ParamDecl name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: ParamDecl name -> Maybe Range Source #
HasLoc (ParameterFun name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: ParameterFun name -> Maybe Range Source #
HasLoc (ParameterType name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: ParameterType name -> Maybe Range Source #
HasLoc (Pattern name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: Pattern name -> Maybe Range Source #
HasLoc (PrimType name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: PrimType name -> Maybe Range Source #
HasLoc (PropSyn name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: PropSyn name -> Maybe Range Source #
HasLoc (Schema name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: Schema name -> Maybe Range Source #
HasLoc (SigDecl name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: SigDecl name -> Maybe Range Source #
HasLoc (TParam name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: TParam name -> Maybe Range Source #
HasLoc (TopDecl name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: TopDecl name -> Maybe Range Source #
HasLoc a => HasLoc (TopLevel a) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: TopLevel a -> Maybe Range Source #
HasLoc (TySyn name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: TySyn name -> Maybe Range Source #
HasLoc (Type name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: Type name -> Maybe Range Source #
HasLoc (Located a) Source # |
Instance details Defined in Cryptol.Parser.Position Methods getLoc :: Located a -> Maybe Range Source #
HasLoc a => HasLoc [a] Source # |
Instance details Defined in Cryptol.Parser.Position Methods getLoc :: [a] -> Maybe Range Source #
HasLoc (ModuleG mname name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: ModuleG mname name -> Maybe Range Source #
(HasLoc a, HasLoc b) => HasLoc (a, b) Source # |
Instance details Defined in Cryptol.Parser.Position Methods getLoc :: (a, b) -> Maybe Range Source #

class HasLoc t => AddLoc t where Source #

Methods

addLoc :: t -> Range -> t Source #

dropLoc :: t -> t Source #

#### Instances

Instances details

AddLoc (Decl name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods addLoc :: Decl name -> Range -> Decl name Source # dropLoc :: Decl name -> Decl name Source #
AddLoc (Expr n) Source # |
Instance details Defined in Cryptol.Parser.AST Methods addLoc :: Expr n -> Range -> Expr n Source # dropLoc :: Expr n -> Expr n Source #
AddLoc (Pattern name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods addLoc :: Pattern name -> Range -> Pattern name Source # dropLoc :: Pattern name -> Pattern name Source #
AddLoc (Schema name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods addLoc :: Schema name -> Range -> Schema name Source # dropLoc :: Schema name -> Schema name Source #
AddLoc (TParam name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods addLoc :: TParam name -> Range -> TParam name Source # dropLoc :: TParam name -> TParam name Source #
AddLoc (Type name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods addLoc :: Type name -> Range -> Type name Source # dropLoc :: Type name -> Type name Source #
AddLoc (Located a) Source # |
Instance details Defined in Cryptol.Parser.Position Methods addLoc :: Located a -> Range -> Located a Source # dropLoc :: Located a -> Located a Source #

at :: (HasLoc l, AddLoc t) => l -> t -> t Source #

combLoc :: (a -> b -> c) -> Located a -> Located b -> Located c Source #