cryptol-2.6.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
  }
- emptyRange :: Range
- start :: Position
- move :: Position -> Char -> Position
- moves :: Position -> Text -> Position
- rComb :: Range -> Range -> 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

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 #
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 #
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 #
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 #
NFData a => NFData (Located a) Source # |
Instance details Defined in Cryptol.Parser.Position Methods rnf :: Located a -> () Source #
PPName a => PPName (Located a) Source # |
Instance details Defined in Cryptol.Parser.Position Methods ppNameFixity :: Located a -> Maybe (Assoc, Int) Source # ppPrefixName :: Located a -> Doc Source # ppInfixName :: Located a -> Doc Source #
PP a => PP (Located a) Source # |
Instance details Defined in Cryptol.Parser.Position Methods ppPrec :: Int -> Located a -> Doc 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 #
NoPos (Located t) Source # |
Instance details Defined in Cryptol.Parser.AST Methods noPos :: Located t -> Located t Source #
ShowParseable a => ShowParseable (Located a) Source # |
Instance details Defined in Cryptol.TypeCheck.Parseable Methods showParseable :: Located a -> Doc Source #
type Rep (Located a) Source # |
Instance details Defined in Cryptol.Parser.Position type Rep (Located a) = D1 (MetaData "Located" "Cryptol.Parser.Position" "cryptol-2.6.0-FO78l5UWBYr51eDL1ksQpO" 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

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 #
Show Position Source # |
Instance details Defined in Cryptol.Parser.Position Methods showsPrec :: Int -> Position -> ShowS Source # show :: Position -> String Source # showList :: [Position] -> ShowS Source #
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 #
NFData Position Source # |
Instance details Defined in Cryptol.Parser.Position Methods rnf :: Position -> () Source #
PP Position Source # |
Instance details Defined in Cryptol.Parser.Position Methods ppPrec :: Int -> Position -> Doc Source #
type Rep Position Source # |
Instance details Defined in Cryptol.Parser.Position type Rep Position = D1 (MetaData "Position" "Cryptol.Parser.Position" "cryptol-2.6.0-FO78l5UWBYr51eDL1ksQpO" 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

Eq Range Source # |
Instance details Defined in Cryptol.Parser.Position Methods (==) :: Range -> Range -> Bool Source # (/=) :: Range -> Range -> Bool 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 #
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 #
NFData Range Source # |
Instance details Defined in Cryptol.Parser.Position Methods rnf :: Range -> () Source #
PP Range Source # |
Instance details Defined in Cryptol.Parser.Position Methods ppPrec :: Int -> Range -> Doc Source #
HasLoc Range Source # |
Instance details Defined in Cryptol.Parser.Position Methods getLoc :: Range -> Maybe Range Source #
type Rep Range Source # |

Instance details

Defined in Cryptol.Parser.Position

type Rep Range = D1 (MetaData "Range" "Cryptol.Parser.Position" "cryptol-2.6.0-FO78l5UWBYr51eDL1ksQpO" 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))))

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 #

rCombs :: [Range] -> Range Source #

class HasLoc t where Source #

Methods

getLoc :: t -> Maybe Range Source #

Instances

HasLoc Range Source # |
Instance details Defined in Cryptol.Parser.Position Methods getLoc :: Range -> Maybe Range Source #
HasLoc a => HasLoc [a] Source # |
Instance details Defined in Cryptol.Parser.Position Methods getLoc :: [a] -> Maybe Range Source #
HasLoc (Located a) Source # |
Instance details Defined in Cryptol.Parser.Position Methods getLoc :: Located a -> Maybe Range Source #
HasLoc (Prop name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: Prop name -> Maybe Range Source #
HasLoc (Type name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: Type name -> Maybe Range Source #
HasLoc (TParam name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: TParam name -> Maybe Range Source #
HasLoc (Schema name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: Schema 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 (Pattern name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: Pattern name -> Maybe Range Source #
HasLoc (Match name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: Match name -> Maybe Range Source #
HasLoc (Expr name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: Expr 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 (Newtype name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: Newtype name -> Maybe Range Source #
HasLoc (Bind name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: Bind 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 (Decl name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: Decl name -> Maybe Range Source #
HasLoc (TopDecl name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: TopDecl name -> Maybe Range Source #
HasLoc (Module name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods getLoc :: Module 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

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 #
AddLoc (Prop name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods addLoc :: Prop name -> Range -> Prop name Source # dropLoc :: Prop name -> Prop 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 (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 (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 (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 (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 (Decl name) Source # |
Instance details Defined in Cryptol.Parser.AST Methods addLoc :: Decl name -> Range -> Decl name Source # dropLoc :: Decl name -> Decl name Source #

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

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