-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Cryptol: The Language of Cryptography -- -- Cryptol is a domain-specific language for specifying cryptographic -- algorithms. A Cryptol implementation of an algorithm resembles its -- mathematical specification more closely than an implementation in a -- general purpose language. For more, see -- http://www.cryptol.net/. @package cryptol @version 2.5.0 module Cryptol.Version commitHash :: String commitShortHash :: String commitBranch :: String commitDirty :: Bool version :: Version module Cryptol.Utils.Patterns newtype Match b Match :: (forall r. r -> (b -> r) -> r) -> Match b type Pat a b = a -> Match b (|||) :: Pat a b -> Pat a b -> Pat a b -- | Check that a value satisfies multiple patterns. For example, an "as" -- pattern is (__ &&& p). (&&&) :: Pat a b -> Pat a c -> Pat a (b, c) -- | Match a value, and modify the result. (~>) :: Pat a b -> (b -> c) -> Pat a c -- | Match a value, and return the given result (~~>) :: Pat a b -> c -> Pat a c -- | View pattern. (<~) :: (a -> b) -> Pat b c -> Pat a c -- | Variable pattern. __ :: Pat a a -- | Constant pattern. succeed :: a -> Pat x a -- | Predicate pattern checkThat :: (a -> Bool) -> Pat a () -- | Check for exact value. lit :: Eq a => a -> Pat a () -- | Match a pattern, using the given default if valure. matchDefault :: a -> Match a -> a -- | Match an irrefutable pattern. Crashes on faliure. match :: Match a -> a matchMaybe :: Match a -> Maybe a list :: [Pat a b] -> Pat [a] [b] (><) :: Pat a b -> Pat x y -> Pat (a, x) (b, y) class Matches thing pats res | pats -> thing res matches :: Matches thing pats res => thing -> pats -> Match res instance GHC.Base.Functor Cryptol.Utils.Patterns.Match instance GHC.Base.Applicative Cryptol.Utils.Patterns.Match instance GHC.Base.Monad Cryptol.Utils.Patterns.Match instance GHC.Base.Alternative Cryptol.Utils.Patterns.Match instance GHC.Base.MonadPlus Cryptol.Utils.Patterns.Match instance (f ~ Cryptol.Utils.Patterns.Pat a a1', a1 ~ Cryptol.Utils.Patterns.Pat a1' r1) => Cryptol.Utils.Patterns.Matches a (f, a1) r1 instance (op ~ Cryptol.Utils.Patterns.Pat a (a1', a2'), a1 ~ Cryptol.Utils.Patterns.Pat a1' r1, a2 ~ Cryptol.Utils.Patterns.Pat a2' r2) => Cryptol.Utils.Patterns.Matches a (op, a1, a2) (r1, r2) instance (op ~ Cryptol.Utils.Patterns.Pat a (a1', a2', a3'), a1 ~ Cryptol.Utils.Patterns.Pat a1' r1, a2 ~ Cryptol.Utils.Patterns.Pat a2' r2, a3 ~ Cryptol.Utils.Patterns.Pat a3' r3) => Cryptol.Utils.Patterns.Matches a (op, a1, a2, a3) (r1, r2, r3) module Cryptol.Utils.Panic panic :: String -> [String] -> a instance GHC.Show.Show Cryptol.Utils.Panic.CryptolPanic instance GHC.Exception.Exception Cryptol.Utils.Panic.CryptolPanic module Cryptol.Utils.Misc -- | Apply a function to all elements of a container. Returns -- Nothing if nothing changed, and Just container -- otherwise. anyJust :: Traversable t => (a -> Maybe a) -> t a -> Maybe (t a) -- | Apply functions to both elements of a pair. Returns Nothing if -- neither changed, and Just pair otherwise. anyJust2 :: (a -> Maybe a) -> (b -> Maybe b) -> (a, b) -> Maybe (a, b) module Cryptol.Utils.Ident -- | Module names are just text. type ModName = Text unpackModName :: ModName -> [String] packModName :: [String] -> ModName modSep :: Text -- | Identifiers, along with a flag that indicates whether or not they're -- infix operators. The boolean is present just as cached information -- from the lexer, and never used during comparisons. data Ident Ident :: Bool -> Text -> Ident packIdent :: String -> Ident packInfix :: String -> Ident unpackIdent :: Ident -> String mkIdent :: Text -> Ident mkInfix :: Text -> Ident isInfixIdent :: Ident -> Bool nullIdent :: Ident -> Bool identText :: Ident -> Text preludeName :: ModName preludeExtrasName :: ModName interactiveName :: ModName instance GHC.Generics.Generic Cryptol.Utils.Ident.Ident instance GHC.Show.Show Cryptol.Utils.Ident.Ident instance GHC.Classes.Eq Cryptol.Utils.Ident.Ident instance GHC.Classes.Ord Cryptol.Utils.Ident.Ident instance Data.String.IsString Cryptol.Utils.Ident.Ident instance Control.DeepSeq.NFData Cryptol.Utils.Ident.Ident module Cryptol.Utils.PP -- | How to display names, inspired by the GHC Outputable module. -- Getting a value of Nothing from the NameDisp function indicates -- that the name is not in scope. data NameDisp EmptyNameDisp :: NameDisp NameDisp :: (ModName -> Ident -> Maybe NameFormat) -> NameDisp data NameFormat UnQualified :: NameFormat Qualified :: !ModName -> NameFormat NotInScope :: NameFormat -- | Never qualify names from this module. neverQualifyMod :: ModName -> NameDisp alwaysQualify :: NameDisp neverQualify :: NameDisp fmtModName :: ModName -> NameFormat -> ModName -- | Compose two naming environments, preferring names from the left -- environment. extend :: NameDisp -> NameDisp -> NameDisp -- | Get the format for a name. When Nothing is returned, the name -- is not currently in scope. getNameFormat :: ModName -> Ident -> NameDisp -> NameFormat -- | Produce a document in the context of the current NameDisp. withNameDisp :: (NameDisp -> Doc) -> Doc -- | Fix the way that names are displayed inside of a doc. fixNameDisp :: NameDisp -> Doc -> Doc newtype Doc Doc :: (NameDisp -> Doc) -> Doc runDoc :: NameDisp -> Doc -> Doc render :: Doc -> String class PP a ppPrec :: PP a => Int -> a -> Doc class PP a => PPName a -- | Fixity information for infix operators ppNameFixity :: PPName a => a -> Maybe (Assoc, Int) -- | Print a name in prefix: f a b or (+) a b) ppPrefixName :: PPName a => a -> Doc -- | Print a name as an infix operator: a + b ppInfixName :: PPName a => a -> Doc pp :: PP a => a -> Doc pretty :: PP a => a -> String optParens :: Bool -> Doc -> Doc -- | Information about associativity. data Assoc LeftAssoc :: Assoc RightAssoc :: Assoc NonAssoc :: Assoc -- | Information about an infix expression of some sort. data Infix op thing Infix :: op -> thing -> thing -> Int -> Assoc -> Infix op thing -- | operator [ieOp] :: Infix op thing -> op -- | left argument [ieLeft] :: Infix op thing -> thing -- | right argumrnt [ieRight] :: Infix op thing -> thing -- | operator precedence [iePrec] :: Infix op thing -> Int -- | operator associativity [ieAssoc] :: Infix op thing -> Assoc commaSep :: [Doc] -> Doc -- | Pretty print an infix expression of some sort. ppInfix :: (PP thing, PP op) => Int -> (thing -> Maybe (Infix op thing)) -> Infix op thing -> Doc -- | Display a numeric values as an ordinar (e.g., 2nd) ordinal :: (Integral a, Show a, Eq a) => a -> Doc -- | The suffix to use when displaying a number as an oridinal ordSuffix :: (Integral a, Eq a) => a -> String liftPJ :: Doc -> Doc liftPJ1 :: (Doc -> Doc) -> Doc -> Doc liftPJ2 :: (Doc -> Doc -> Doc) -> (Doc -> Doc -> Doc) liftSep :: ([Doc] -> Doc) -> ([Doc] -> Doc) (<>) :: Doc -> Doc -> Doc infixl 6 <> (<+>) :: Doc -> Doc -> Doc infixl 6 <+> ($$) :: Doc -> Doc -> Doc infixl 5 $$ sep :: [Doc] -> Doc fsep :: [Doc] -> Doc hsep :: [Doc] -> Doc hcat :: [Doc] -> Doc vcat :: [Doc] -> Doc hang :: Doc -> Int -> Doc -> Doc nest :: Int -> Doc -> Doc parens :: Doc -> Doc braces :: Doc -> Doc brackets :: Doc -> Doc quotes :: Doc -> Doc punctuate :: Doc -> [Doc] -> [Doc] text :: String -> Doc char :: Char -> Doc integer :: Integer -> Doc int :: Int -> Doc comma :: Doc empty :: Doc colon :: Doc instance Control.DeepSeq.NFData Cryptol.Utils.PP.Assoc instance GHC.Generics.Generic Cryptol.Utils.PP.Assoc instance GHC.Classes.Eq Cryptol.Utils.PP.Assoc instance GHC.Show.Show Cryptol.Utils.PP.Assoc instance Control.DeepSeq.NFData Cryptol.Utils.PP.Doc instance GHC.Generics.Generic Cryptol.Utils.PP.Doc instance Control.DeepSeq.NFData Cryptol.Utils.PP.NameDisp instance GHC.Generics.Generic Cryptol.Utils.PP.NameDisp instance GHC.Show.Show Cryptol.Utils.PP.NameFormat instance GHC.Show.Show Cryptol.Utils.PP.NameDisp instance GHC.Base.Monoid Cryptol.Utils.PP.NameDisp instance GHC.Base.Monoid Cryptol.Utils.PP.Doc instance GHC.Show.Show Cryptol.Utils.PP.Doc instance Data.String.IsString Cryptol.Utils.PP.Doc instance Cryptol.Utils.PP.PP Data.Text.Internal.Text instance Cryptol.Utils.PP.PP Cryptol.Utils.Ident.Ident module Cryptol.Utils.Debug trace :: String -> b -> b ppTrace :: Doc -> b -> b -- | This module defines natural numbers with an additional infinity -- element, and various arithmetic operators on them. module Cryptol.TypeCheck.Solver.InfNat -- | Natural numbers with an infinity element data Nat' Nat :: Integer -> Nat' Inf :: Nat' fromNat :: Nat' -> Maybe Integer nAdd :: Nat' -> Nat' -> Nat' -- | Some algebraic properties of interest: -- --
-- 1 * x = x -- x * (y * z) = (x * y) * z -- 0 * x = 0 -- x * y = y * x -- x * (a + b) = x * a + x * b --nMul :: Nat' -> Nat' -> Nat' -- | Some algebraic properties of interest: -- --
-- x ^ 0 = 1 -- x ^ (n + 1) = x * (x ^ n) -- x ^ (m + n) = (x ^ m) * (x ^ n) -- x ^ (m * n) = (x ^ m) ^ n --nExp :: Nat' -> Nat' -> Nat' nMin :: Nat' -> Nat' -> Nat' nMax :: Nat' -> Nat' -> Nat' -- | nSub x y = Just z iff z is the unique value such -- that Add y z = Just x. nSub :: Nat' -> Nat' -> Maybe Nat' -- | Rounds down. -- --
-- y * q + r = x -- x / y = q with remainder r -- 0 <= r && r < y ---- -- We don't allow Inf in the first argument for two reasons: 1. It -- matches the behavior of nMod, 2. The well-formedness -- constraints can be expressed as a conjunction. nDiv :: Nat' -> Nat' -> Maybe Nat' nMod :: Nat' -> Nat' -> Maybe Nat' -- | Rounds up. lg2 x = y, iff y is the smallest number -- such that x <= 2 ^ y nLg2 :: Nat' -> Nat' -- | nWidth n is number of bits needed to represent all numbers -- from 0 to n, inclusive. nWidth x = nLg2 (x + 1). nWidth :: Nat' -> Nat' -- | length ([ x, y .. ] : [_][w]) We don't check that the second -- element fits in w many bits as the second element may not be -- part of the list. For example, the length of [ 0 .. ] : -- [_][0] is nLenFromThen 0 1 0, which should evaluate to -- 1. nLenFromThen :: Nat' -> Nat' -> Nat' -> Maybe Nat' -- |
-- length [ x, y .. z ] --nLenFromThenTo :: Nat' -> Nat' -> Nat' -> Maybe Nat' -- | Compute the logarithm of a number in the given base, rounded down to -- the closest integer. The boolean indicates if we the result is exact -- (i.e., True means no rounding happened, False means we rounded down). -- The logarithm base is the second argument. genLog :: Integer -> Integer -> Maybe (Integer, Bool) -- | Compute the number of bits required to represent the given integer. widthInteger :: Integer -> Integer -- | Compute the exact root of a natural number. The second argument -- specifies which root we are computing. rootExact :: Integer -> Integer -> Maybe Integer -- | Compute the the n-th root of a natural number, rounded down to the -- closest natural number. The boolean indicates if the result is exact -- (i.e., True means no rounding was done, False means rounded down). The -- second argument specifies which root we are computing. genRoot :: Integer -> Integer -> Maybe (Integer, Bool) instance Control.DeepSeq.NFData Cryptol.TypeCheck.Solver.InfNat.Nat' instance GHC.Generics.Generic Cryptol.TypeCheck.Solver.InfNat.Nat' instance GHC.Classes.Ord Cryptol.TypeCheck.Solver.InfNat.Nat' instance GHC.Classes.Eq Cryptol.TypeCheck.Solver.InfNat.Nat' instance GHC.Show.Show Cryptol.TypeCheck.Solver.InfNat.Nat' module Cryptol.TypeCheck.PP type NameMap = IntMap String -- | This packages together a type with some names to be used to display -- the variables. It is used for pretty printing types. data WithNames a WithNames :: a -> NameMap -> WithNames a emptyNameMap :: NameMap ppWithNamesPrec :: PP (WithNames a) => NameMap -> Int -> a -> Doc ppWithNames :: PP (WithNames a) => NameMap -> a -> Doc intToName :: Int -> String -- | Expand a list of base names into an infinite list of variations. nameList :: [String] -> [String] dump :: PP (WithNames a) => a -> String module Cryptol.REPL.Trie -- | Maps string names to values, allowing for partial key matches and -- querying. data Trie a Node :: (Map Char (Trie a)) -> (Maybe a) -> Trie a emptyTrie :: Trie a -- | Insert a value into the Trie. Will call panic if a value -- already exists with that key. insertTrie :: String -> a -> Trie a -> Trie a -- | Return all matches with the given prefix. lookupTrie :: String -> Trie a -> [a] -- | Given a key, return either an exact match for that key, or all matches -- with the given prefix. lookupTrieExact :: String -> Trie a -> [a] -- | Return all of the values from a Trie. leaves :: Trie a -> [a] instance GHC.Show.Show a => GHC.Show.Show (Cryptol.REPL.Trie.Trie a) -- | Convert a literate source file into an ordinary source file. module Cryptol.Parser.Unlit unLit :: PreProc -> Text -> Text data PreProc None :: PreProc Markdown :: PreProc LaTeX :: PreProc guessPreProc :: FilePath -> PreProc knownExts :: [String] module Cryptol.Parser.Position data Located a Located :: !Range -> !a -> Located a [srcRange] :: Located a -> !Range [thing] :: Located a -> !a data Position Position :: !Int -> !Int -> Position [line] :: Position -> !Int [col] :: Position -> !Int data Range Range :: !Position -> !Position -> FilePath -> Range [from] :: Range -> !Position [to] :: Range -> !Position [source] :: Range -> FilePath -- | An empty range. -- -- Caution: using this on the LHS of a use of rComb will cause the empty -- source to propegate. emptyRange :: Range start :: Position move :: Position -> Char -> Position moves :: Position -> Text -> Position rComb :: Range -> Range -> Range rCombs :: [Range] -> Range class HasLoc t getLoc :: HasLoc t => t -> Maybe Range class HasLoc t => AddLoc t addLoc :: AddLoc t => t -> Range -> t dropLoc :: AddLoc t => t -> t at :: (HasLoc l, AddLoc t) => l -> t -> t instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Cryptol.Parser.Position.Located a) instance GHC.Generics.Generic (Cryptol.Parser.Position.Located a) instance GHC.Show.Show a => GHC.Show.Show (Cryptol.Parser.Position.Located a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Cryptol.Parser.Position.Located a) instance Control.DeepSeq.NFData Cryptol.Parser.Position.Range instance GHC.Generics.Generic Cryptol.Parser.Position.Range instance GHC.Show.Show Cryptol.Parser.Position.Range instance GHC.Classes.Eq Cryptol.Parser.Position.Range instance Control.DeepSeq.NFData Cryptol.Parser.Position.Position instance GHC.Generics.Generic Cryptol.Parser.Position.Position instance GHC.Show.Show Cryptol.Parser.Position.Position instance GHC.Classes.Ord Cryptol.Parser.Position.Position instance GHC.Classes.Eq Cryptol.Parser.Position.Position instance GHC.Base.Functor Cryptol.Parser.Position.Located instance Cryptol.Utils.PP.PP Cryptol.Parser.Position.Position instance Cryptol.Utils.PP.PP Cryptol.Parser.Position.Range instance Cryptol.Utils.PP.PP a => Cryptol.Utils.PP.PP (Cryptol.Parser.Position.Located a) instance Cryptol.Utils.PP.PPName a => Cryptol.Utils.PP.PPName (Cryptol.Parser.Position.Located a) instance Cryptol.Parser.Position.HasLoc Cryptol.Parser.Position.Range instance Cryptol.Parser.Position.HasLoc (Cryptol.Parser.Position.Located a) instance (Cryptol.Parser.Position.HasLoc a, Cryptol.Parser.Position.HasLoc b) => Cryptol.Parser.Position.HasLoc (a, b) instance Cryptol.Parser.Position.HasLoc a => Cryptol.Parser.Position.HasLoc [a] instance Cryptol.Parser.Position.AddLoc (Cryptol.Parser.Position.Located a) module Cryptol.Parser.Name -- | Names that originate in the parser. data PName -- | Unqualified names like x, Foo, or +. UnQual :: !Ident -> PName -- | Qualified names like Foo::bar or module::!. Qual :: !ModName -> !Ident -> PName -- | Fresh names generated by a pass. NewName :: !Pass -> !Int -> PName -- | Passes that can generate fresh names. data Pass NoPat :: Pass MonoValues :: Pass mkUnqual :: Ident -> PName mkQual :: ModName -> Ident -> PName getModName :: PName -> Maybe ModName getIdent :: PName -> Ident instance GHC.Generics.Generic Cryptol.Parser.Name.PName instance GHC.Show.Show Cryptol.Parser.Name.PName instance GHC.Classes.Ord Cryptol.Parser.Name.PName instance GHC.Classes.Eq Cryptol.Parser.Name.PName instance GHC.Generics.Generic Cryptol.Parser.Name.Pass instance GHC.Show.Show Cryptol.Parser.Name.Pass instance GHC.Classes.Ord Cryptol.Parser.Name.Pass instance GHC.Classes.Eq Cryptol.Parser.Name.Pass instance Control.DeepSeq.NFData Cryptol.Parser.Name.PName instance Control.DeepSeq.NFData Cryptol.Parser.Name.Pass instance Cryptol.Utils.PP.PP Cryptol.Parser.Name.PName instance Cryptol.Utils.PP.PPName Cryptol.Parser.Name.PName module Cryptol.Prims.Syntax -- | Built-in types. data TFun -- |
-- : Num -> Num -> Num --TCAdd :: TFun -- |
-- : Num -> Num -> Num --TCSub :: TFun -- |
-- : Num -> Num -> Num --TCMul :: TFun -- |
-- : Num -> Num -> Num --TCDiv :: TFun -- |
-- : Num -> Num -> Num --TCMod :: TFun -- |
-- : Num -> Num -> Num --TCExp :: TFun -- |
-- : Num -> Num --TCWidth :: TFun -- |
-- : Num -> Num -> Num --TCMin :: TFun -- |
-- : Num -> Num -> Num --TCMax :: TFun -- | : Num -> Num -> Num -> Num Example: [ 1, 5 .. ] -- :: [lengthFromThen 1 5 b][b] TCLenFromThen :: TFun -- | : Num -> Num -> Num -> Num Example: [ 1, 5 .. 9 -- ] :: [lengthFromThenTo 1 5 9][b] TCLenFromThenTo :: TFun tBinOpPrec :: Map TFun (Assoc, Int) -- | Type functions, with their arity and function constructor. tfunNames :: Map PName (Int, TFun) instance Control.DeepSeq.NFData Cryptol.Prims.Syntax.TFun instance GHC.Generics.Generic Cryptol.Prims.Syntax.TFun instance GHC.Enum.Enum Cryptol.Prims.Syntax.TFun instance GHC.Enum.Bounded Cryptol.Prims.Syntax.TFun instance GHC.Classes.Ord Cryptol.Prims.Syntax.TFun instance GHC.Classes.Eq Cryptol.Prims.Syntax.TFun instance GHC.Show.Show Cryptol.Prims.Syntax.TFun instance Cryptol.Utils.PP.PPName Cryptol.Prims.Syntax.TFun instance Cryptol.Utils.PP.PP Cryptol.Prims.Syntax.TFun -- | At present Alex generates code with too many warnings. module Cryptol.Parser.Lexer -- | Returns the tokens and the last position of the input that we -- processed. The tokens include whte space tokens. primLexer :: Config -> Text -> ([Located Token], Position) -- | Returns the tokens in the last position of the input that we -- processed. White space is removed, and layout processing is done as -- requested. This stream is fed to the parser. lexer :: Config -> Text -> ([Located Token], Position) data Layout Layout :: Layout NoLayout :: Layout data Token Token :: !TokenT -> !Text -> Token [tokenType] :: Token -> !TokenT [tokenText] :: Token -> !Text data TokenT -- | value, base, number of digits Num :: !Integer -> !Int -> !Int -> TokenT -- | character literal ChrLit :: !Char -> TokenT -- | (qualified) identifier Ident :: ![Text] -> !Text -> TokenT -- | string literal StrLit :: !String -> TokenT -- | keyword KW :: !TokenKW -> TokenT -- | operator Op :: !TokenOp -> TokenT -- | symbol Sym :: !TokenSym -> TokenT -- | virtual token (for layout) Virt :: !TokenV -> TokenT -- | white space token White :: !TokenW -> TokenT -- | error token Err :: !TokenErr -> TokenT EOF :: TokenT -- | Virtual tokens, inserted by layout processing. data TokenV VCurlyL :: TokenV VCurlyR :: TokenV VSemi :: TokenV data TokenKW KW_Arith :: TokenKW KW_Bit :: TokenKW KW_Cmp :: TokenKW KW_else :: TokenKW KW_Eq :: TokenKW KW_extern :: TokenKW KW_fin :: TokenKW KW_if :: TokenKW KW_private :: TokenKW KW_include :: TokenKW KW_inf :: TokenKW KW_lg2 :: TokenKW KW_lengthFromThen :: TokenKW KW_lengthFromThenTo :: TokenKW KW_max :: TokenKW KW_min :: TokenKW KW_module :: TokenKW KW_newtype :: TokenKW KW_pragma :: TokenKW KW_property :: TokenKW KW_then :: TokenKW KW_type :: TokenKW KW_where :: TokenKW KW_let :: TokenKW KW_x :: TokenKW KW_import :: TokenKW KW_as :: TokenKW KW_hiding :: TokenKW KW_infixl :: TokenKW KW_infixr :: TokenKW KW_infix :: TokenKW KW_primitive :: TokenKW data TokenErr UnterminatedComment :: TokenErr UnterminatedString :: TokenErr UnterminatedChar :: TokenErr InvalidString :: TokenErr InvalidChar :: TokenErr LexicalError :: TokenErr data TokenSym Bar :: TokenSym ArrL :: TokenSym ArrR :: TokenSym FatArrR :: TokenSym Lambda :: TokenSym EqDef :: TokenSym Comma :: TokenSym Semi :: TokenSym Dot :: TokenSym DotDot :: TokenSym DotDotDot :: TokenSym Colon :: TokenSym BackTick :: TokenSym ParenL :: TokenSym ParenR :: TokenSym BracketL :: TokenSym BracketR :: TokenSym CurlyL :: TokenSym CurlyR :: TokenSym TriL :: TokenSym TriR :: TokenSym Underscore :: TokenSym data TokenW BlockComment :: TokenW LineComment :: TokenW Space :: TokenW DocStr :: TokenW data Located a Located :: !Range -> !a -> Located a [srcRange] :: Located a -> !Range [thing] :: Located a -> !a data Config Config :: !FilePath -> !Layout -> PreProc -> [FilePath] -> Bool -> Config -- | File that we are working on [cfgSource] :: Config -> !FilePath -- | Settings for layout processing [cfgLayout] :: Config -> !Layout -- | Preprocessor settings [cfgPreProc] :: Config -> PreProc -- | Implicit includes [cfgAutoInclude] :: Config -> [FilePath] -- | When we do layout processing should we add a vCurly (i.e., are we -- parsing a list of things). [cfgModuleScope] :: Config -> Bool defaultConfig :: Config module Cryptol.Parser.AST -- | Identifiers, along with a flag that indicates whether or not they're -- infix operators. The boolean is present just as cached information -- from the lexer, and never used during comparisons. data Ident mkIdent :: Text -> Ident mkInfix :: Text -> Ident isInfixIdent :: Ident -> Bool nullIdent :: Ident -> Bool identText :: Ident -> Text -- | Module names are just text. type ModName = Text modRange :: Module name -> Range -- | Names that originate in the parser. data PName -- | Unqualified names like x, Foo, or +. UnQual :: !Ident -> PName -- | Qualified names like Foo::bar or module::!. Qual :: !ModName -> !Ident -> PName -- | Fresh names generated by a pass. NewName :: !Pass -> !Int -> PName getModName :: PName -> Maybe ModName getIdent :: PName -> Ident mkUnqual :: Ident -> PName mkQual :: ModName -> Ident -> PName data Named a Named :: Located Ident -> a -> Named a [name] :: Named a -> Located Ident [value] :: Named a -> a -- | Passes that can generate fresh names. data Pass NoPat :: Pass MonoValues :: Pass -- | Information about associativity. data Assoc LeftAssoc :: Assoc RightAssoc :: Assoc NonAssoc :: Assoc data Schema n Forall :: [TParam n] -> [Prop n] -> (Type n) -> (Maybe Range) -> Schema n data TParam n TParam :: n -> Maybe Kind -> Maybe Range -> TParam n [tpName] :: TParam n -> n [tpKind] :: TParam n -> Maybe Kind [tpRange] :: TParam n -> Maybe Range data Kind KNum :: Kind KType :: Kind data Type n -- |
-- [8] -> [8] --TFun :: (Type n) -> (Type n) -> Type n -- |
-- [8] a --TSeq :: (Type n) -> (Type n) -> Type n -- |
-- Bit --TBit :: Type n -- |
-- 10 --TNum :: Integer -> Type n -- |
-- a --TChar :: Char -> Type n -- |
-- inf --TInf :: Type n -- | A type variable or synonym TUser :: n -> [Type n] -> Type n -- |
-- 2 + x --TApp :: TFun -> [Type n] -> Type n -- |
-- { x : [8], y : [32] }
--
TRecord :: [Named (Type n)] -> Type n
-- | -- ([8], [32]) --TTuple :: [Type n] -> Type n -- | _, just some type. TWild :: Type n -- | Location information TLocated :: (Type n) -> Range -> Type n -- |
-- (ty) --TParens :: (Type n) -> Type n -- |
-- ty + ty --TInfix :: (Type n) -> (Located n) -> Fixity -> (Type n) -> Type n tconNames :: Map PName (Type PName) data Prop n -- |
-- fin x --CFin :: (Type n) -> Prop n -- |
-- x == 10 --CEqual :: (Type n) -> (Type n) -> Prop n -- |
-- x >= 10 --CGeq :: (Type n) -> (Type n) -> Prop n -- |
-- Arith a --CArith :: (Type n) -> Prop n -- |
-- Cmp a --CCmp :: (Type n) -> Prop n -- | Location information CLocated :: (Prop n) -> Range -> Prop n -- | After parsing CType :: (Type n) -> Prop n data Module name Module :: Located ModName -> [Located Import] -> [TopDecl name] -> Module name [mName] :: Module name -> Located ModName [mImports] :: Module name -> [Located Import] [mDecls] :: Module name -> [TopDecl name] newtype Program name Program :: [TopDecl name] -> Program name data TopDecl name Decl :: (TopLevel (Decl name)) -> TopDecl name TDNewtype :: (TopLevel (Newtype name)) -> TopDecl name Include :: (Located FilePath) -> TopDecl name data Decl name DSignature :: [Located name] -> (Schema name) -> Decl name DFixity :: !Fixity -> [Located name] -> Decl name DPragma :: [Located name] -> Pragma -> Decl name DBind :: (Bind name) -> Decl name DPatBind :: (Pattern name) -> (Expr name) -> Decl name DType :: (TySyn name) -> Decl name DLocated :: (Decl name) -> Range -> Decl name data Fixity Fixity :: !Assoc -> !Int -> Fixity [fAssoc] :: Fixity -> !Assoc [fLevel] :: Fixity -> !Int -- | The fixity used when none is provided. defaultFixity :: Fixity data FixityCmp FCError :: FixityCmp FCLeft :: FixityCmp FCRight :: FixityCmp compareFixity :: Fixity -> Fixity -> FixityCmp data TySyn n TySyn :: (Located n) -> [TParam n] -> (Type n) -> TySyn n -- | Bindings. Notes: -- --
-- x --EVar :: n -> Expr n -- |
-- 0x10 --ELit :: Literal -> Expr n -- |
-- (1,2,3) --ETuple :: [Expr n] -> Expr n -- |
-- { x = 1, y = 2 }
--
ERecord :: [Named (Expr n)] -> Expr n
-- | -- e.l --ESel :: (Expr n) -> Selector -> Expr n -- |
-- [1,2,3] --EList :: [Expr n] -> Expr n -- |
-- [1, 5 .. 117 ] --EFromTo :: (Type n) -> (Maybe (Type n)) -> (Maybe (Type n)) -> Expr n -- |
-- [1, 3 ...] --EInfFrom :: (Expr n) -> (Maybe (Expr n)) -> Expr n -- |
-- [ 1 | x <- xs ] --EComp :: (Expr n) -> [[Match n]] -> Expr n -- |
-- f x --EApp :: (Expr n) -> (Expr n) -> Expr n -- |
-- f `{x = 8}, f`{8}
--
EAppT :: (Expr n) -> [(TypeInst n)] -> Expr n
-- | -- if ok then e1 else e2 --EIf :: (Expr n) -> (Expr n) -> (Expr n) -> Expr n -- |
-- 1 + x where { x = 2 }
--
EWhere :: (Expr n) -> [Decl n] -> Expr n
-- | -- 1 : [8] --ETyped :: (Expr n) -> (Type n) -> Expr n -- | `(x + 1), x is a type ETypeVal :: (Type n) -> Expr n -- |
-- \x y -> x --EFun :: [Pattern n] -> (Expr n) -> Expr n -- | position annotation ELocated :: (Expr n) -> Range -> Expr n -- | (e) (Removed by Fixity) EParens :: (Expr n) -> Expr n -- | a + b (Removed by Fixity) EInfix :: (Expr n) -> (Located n) -> Fixity -> (Expr n) -> Expr n -- | Literals. data Literal -- | 0x10 (HexLit 2) ECNum :: Integer -> NumInfo -> Literal -- |
-- "hello" --ECString :: String -> Literal -- | Infromation about the representation of a numeric constant. data NumInfo -- | n-digit binary literal BinLit :: Int -> NumInfo -- | n-digit octal literal OctLit :: Int -> NumInfo -- | overloaded decimal literal DecLit :: NumInfo -- | n-digit hex literal HexLit :: Int -> NumInfo -- | character literal CharLit :: NumInfo -- | polynomial literal PolyLit :: Int -> NumInfo data Match name -- | p <- e Match :: (Pattern name) -> (Expr name) -> Match name MatchLet :: (Bind name) -> Match name data Pattern n -- |
-- x --PVar :: (Located n) -> Pattern n -- |
-- _ --PWild :: Pattern n -- |
-- (x,y,z) --PTuple :: [Pattern n] -> Pattern n -- |
-- { x = (a,b,c), y = z }
--
PRecord :: [Named (Pattern n)] -> Pattern n
-- | -- [ x, y, z ] --PList :: [Pattern n] -> Pattern n -- |
-- x : [8] --PTyped :: (Pattern n) -> (Type n) -> Pattern n -- |
-- (x # y) --PSplit :: (Pattern n) -> (Pattern n) -> Pattern n -- | Location information PLocated :: (Pattern n) -> Range -> Pattern n -- | Selectors are used for projecting from various components. Each -- selector has an option spec to specify the shape of the thing that is -- being selected. Currently, there is no surface syntax for list -- selectors, but they are used during the desugaring of patterns. data Selector -- | Zero-based tuple selection. Optionally specifies the shape of the -- tuple (one-based). TupleSel :: Int -> (Maybe Int) -> Selector -- | Record selection. Optionally specifies the shape of the record. RecordSel :: Ident -> (Maybe [Ident]) -> Selector -- | List selection. Optionally specifies the length of the list. ListSel :: Int -> (Maybe Int) -> Selector data TypeInst name NamedInst :: (Named (Type name)) -> TypeInst name PosInst :: (Type name) -> TypeInst name data Located a Located :: !Range -> !a -> Located a [srcRange] :: Located a -> !Range [thing] :: Located a -> !a -- | A name with location information. type LPName = Located PName -- | A string with location information. type LString = Located String -- | An identifier with location information. type LIdent = Located Ident class NoPos t noPos :: NoPos t => t -> t -- | Conversational printing of kinds (e.g., to use in error -- messages) cppKind :: Kind -> Doc -- | Display the thing selected by the selector, nicely. ppSelector :: Selector -> Doc instance GHC.Show.Show name => GHC.Show.Show (Cryptol.Parser.AST.Program name) instance Control.DeepSeq.NFData name => Control.DeepSeq.NFData (Cryptol.Parser.AST.Module name) instance GHC.Generics.Generic (Cryptol.Parser.AST.Module name) instance GHC.Show.Show name => GHC.Show.Show (Cryptol.Parser.AST.Module name) instance Control.DeepSeq.NFData name => Control.DeepSeq.NFData (Cryptol.Parser.AST.TopDecl name) instance GHC.Generics.Generic (Cryptol.Parser.AST.TopDecl name) instance GHC.Show.Show name => GHC.Show.Show (Cryptol.Parser.AST.TopDecl name) instance GHC.Show.Show name => GHC.Show.Show (Cryptol.Parser.AST.ReplInput name) instance GHC.Classes.Eq name => GHC.Classes.Eq (Cryptol.Parser.AST.ReplInput name) instance Control.DeepSeq.NFData name => Control.DeepSeq.NFData (Cryptol.Parser.AST.BindDef name) instance GHC.Generics.Generic (Cryptol.Parser.AST.BindDef name) instance GHC.Show.Show name => GHC.Show.Show (Cryptol.Parser.AST.BindDef name) instance GHC.Classes.Eq name => GHC.Classes.Eq (Cryptol.Parser.AST.BindDef name) instance Control.DeepSeq.NFData name => Control.DeepSeq.NFData (Cryptol.Parser.AST.Bind name) instance GHC.Generics.Generic (Cryptol.Parser.AST.Bind name) instance GHC.Show.Show name => GHC.Show.Show (Cryptol.Parser.AST.Bind name) instance GHC.Classes.Eq name => GHC.Classes.Eq (Cryptol.Parser.AST.Bind name) instance Control.DeepSeq.NFData name => Control.DeepSeq.NFData (Cryptol.Parser.AST.Match name) instance GHC.Generics.Generic (Cryptol.Parser.AST.Match name) instance GHC.Show.Show name => GHC.Show.Show (Cryptol.Parser.AST.Match name) instance GHC.Classes.Eq name => GHC.Classes.Eq (Cryptol.Parser.AST.Match name) instance Control.DeepSeq.NFData n => Control.DeepSeq.NFData (Cryptol.Parser.AST.Expr n) instance GHC.Generics.Generic (Cryptol.Parser.AST.Expr n) instance GHC.Show.Show n => GHC.Show.Show (Cryptol.Parser.AST.Expr n) instance GHC.Classes.Eq n => GHC.Classes.Eq (Cryptol.Parser.AST.Expr n) instance Control.DeepSeq.NFData name => Control.DeepSeq.NFData (Cryptol.Parser.AST.Decl name) instance GHC.Generics.Generic (Cryptol.Parser.AST.Decl name) instance GHC.Show.Show name => GHC.Show.Show (Cryptol.Parser.AST.Decl name) instance GHC.Classes.Eq name => GHC.Classes.Eq (Cryptol.Parser.AST.Decl name) instance Control.DeepSeq.NFData n => Control.DeepSeq.NFData (Cryptol.Parser.AST.Schema n) instance GHC.Generics.Generic (Cryptol.Parser.AST.Schema n) instance GHC.Show.Show n => GHC.Show.Show (Cryptol.Parser.AST.Schema n) instance GHC.Classes.Eq n => GHC.Classes.Eq (Cryptol.Parser.AST.Schema n) instance Control.DeepSeq.NFData n => Control.DeepSeq.NFData (Cryptol.Parser.AST.Prop n) instance GHC.Generics.Generic (Cryptol.Parser.AST.Prop n) instance GHC.Show.Show n => GHC.Show.Show (Cryptol.Parser.AST.Prop n) instance GHC.Classes.Eq n => GHC.Classes.Eq (Cryptol.Parser.AST.Prop n) instance Control.DeepSeq.NFData n => Control.DeepSeq.NFData (Cryptol.Parser.AST.TySyn n) instance GHC.Generics.Generic (Cryptol.Parser.AST.TySyn n) instance GHC.Show.Show n => GHC.Show.Show (Cryptol.Parser.AST.TySyn n) instance GHC.Classes.Eq n => GHC.Classes.Eq (Cryptol.Parser.AST.TySyn n) instance Control.DeepSeq.NFData name => Control.DeepSeq.NFData (Cryptol.Parser.AST.Newtype name) instance GHC.Generics.Generic (Cryptol.Parser.AST.Newtype name) instance GHC.Show.Show name => GHC.Show.Show (Cryptol.Parser.AST.Newtype name) instance GHC.Classes.Eq name => GHC.Classes.Eq (Cryptol.Parser.AST.Newtype name) instance Control.DeepSeq.NFData name => Control.DeepSeq.NFData (Cryptol.Parser.AST.TypeInst name) instance GHC.Generics.Generic (Cryptol.Parser.AST.TypeInst name) instance GHC.Show.Show name => GHC.Show.Show (Cryptol.Parser.AST.TypeInst name) instance GHC.Classes.Eq name => GHC.Classes.Eq (Cryptol.Parser.AST.TypeInst name) instance Control.DeepSeq.NFData n => Control.DeepSeq.NFData (Cryptol.Parser.AST.Pattern n) instance GHC.Generics.Generic (Cryptol.Parser.AST.Pattern n) instance GHC.Show.Show n => GHC.Show.Show (Cryptol.Parser.AST.Pattern n) instance GHC.Classes.Eq n => GHC.Classes.Eq (Cryptol.Parser.AST.Pattern n) instance Control.DeepSeq.NFData n => Control.DeepSeq.NFData (Cryptol.Parser.AST.Type n) instance GHC.Generics.Generic (Cryptol.Parser.AST.Type n) instance GHC.Show.Show n => GHC.Show.Show (Cryptol.Parser.AST.Type n) instance GHC.Classes.Eq n => GHC.Classes.Eq (Cryptol.Parser.AST.Type n) instance Control.DeepSeq.NFData n => Control.DeepSeq.NFData (Cryptol.Parser.AST.TParam n) instance GHC.Generics.Generic (Cryptol.Parser.AST.TParam n) instance GHC.Show.Show n => GHC.Show.Show (Cryptol.Parser.AST.TParam n) instance GHC.Classes.Eq n => GHC.Classes.Eq (Cryptol.Parser.AST.TParam n) instance Control.DeepSeq.NFData Cryptol.Parser.AST.Kind instance GHC.Generics.Generic Cryptol.Parser.AST.Kind instance GHC.Show.Show Cryptol.Parser.AST.Kind instance GHC.Classes.Eq Cryptol.Parser.AST.Kind instance GHC.Base.Functor Cryptol.Parser.AST.Named instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Cryptol.Parser.AST.Named a) instance GHC.Generics.Generic (Cryptol.Parser.AST.Named a) instance Data.Traversable.Traversable Cryptol.Parser.AST.Named instance Data.Foldable.Foldable Cryptol.Parser.AST.Named instance GHC.Show.Show a => GHC.Show.Show (Cryptol.Parser.AST.Named a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Cryptol.Parser.AST.Named a) instance Control.DeepSeq.NFData Cryptol.Parser.AST.Selector instance GHC.Generics.Generic Cryptol.Parser.AST.Selector instance GHC.Classes.Ord Cryptol.Parser.AST.Selector instance GHC.Show.Show Cryptol.Parser.AST.Selector instance GHC.Classes.Eq Cryptol.Parser.AST.Selector instance Control.DeepSeq.NFData Cryptol.Parser.AST.Literal instance GHC.Generics.Generic Cryptol.Parser.AST.Literal instance GHC.Show.Show Cryptol.Parser.AST.Literal instance GHC.Classes.Eq Cryptol.Parser.AST.Literal instance Control.DeepSeq.NFData Cryptol.Parser.AST.NumInfo instance GHC.Generics.Generic Cryptol.Parser.AST.NumInfo instance GHC.Show.Show Cryptol.Parser.AST.NumInfo instance GHC.Classes.Eq Cryptol.Parser.AST.NumInfo instance Control.DeepSeq.NFData name => Control.DeepSeq.NFData (Cryptol.Parser.AST.ExportSpec name) instance GHC.Generics.Generic (Cryptol.Parser.AST.ExportSpec name) instance GHC.Show.Show name => GHC.Show.Show (Cryptol.Parser.AST.ExportSpec name) instance Data.Traversable.Traversable Cryptol.Parser.AST.TopLevel instance Data.Foldable.Foldable Cryptol.Parser.AST.TopLevel instance GHC.Base.Functor Cryptol.Parser.AST.TopLevel instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Cryptol.Parser.AST.TopLevel a) instance GHC.Generics.Generic (Cryptol.Parser.AST.TopLevel a) instance GHC.Show.Show a => GHC.Show.Show (Cryptol.Parser.AST.TopLevel a) instance Control.DeepSeq.NFData Cryptol.Parser.AST.ExportType instance GHC.Generics.Generic Cryptol.Parser.AST.ExportType instance GHC.Classes.Ord Cryptol.Parser.AST.ExportType instance GHC.Show.Show Cryptol.Parser.AST.ExportType instance GHC.Classes.Eq Cryptol.Parser.AST.ExportType instance Control.DeepSeq.NFData Cryptol.Parser.AST.Pragma instance GHC.Generics.Generic Cryptol.Parser.AST.Pragma instance GHC.Show.Show Cryptol.Parser.AST.Pragma instance GHC.Classes.Eq Cryptol.Parser.AST.Pragma instance GHC.Classes.Eq Cryptol.Parser.AST.FixityCmp instance GHC.Show.Show Cryptol.Parser.AST.FixityCmp instance Control.DeepSeq.NFData Cryptol.Parser.AST.Fixity instance GHC.Generics.Generic Cryptol.Parser.AST.Fixity instance GHC.Show.Show Cryptol.Parser.AST.Fixity instance GHC.Classes.Eq Cryptol.Parser.AST.Fixity instance Control.DeepSeq.NFData Cryptol.Parser.AST.Import instance GHC.Generics.Generic Cryptol.Parser.AST.Import instance GHC.Show.Show Cryptol.Parser.AST.Import instance GHC.Classes.Eq Cryptol.Parser.AST.Import instance Control.DeepSeq.NFData Cryptol.Parser.AST.ImportSpec instance GHC.Generics.Generic Cryptol.Parser.AST.ImportSpec instance GHC.Show.Show Cryptol.Parser.AST.ImportSpec instance GHC.Classes.Eq Cryptol.Parser.AST.ImportSpec instance GHC.Classes.Ord name => GHC.Base.Monoid (Cryptol.Parser.AST.ExportSpec name) instance Cryptol.Parser.Position.AddLoc (Cryptol.Parser.AST.Expr n) instance Cryptol.Parser.Position.HasLoc (Cryptol.Parser.AST.Expr name) instance Cryptol.Parser.Position.HasLoc (Cryptol.Parser.AST.TParam name) instance Cryptol.Parser.Position.AddLoc (Cryptol.Parser.AST.TParam name) instance Cryptol.Parser.Position.HasLoc (Cryptol.Parser.AST.Type name) instance Cryptol.Parser.Position.AddLoc (Cryptol.Parser.AST.Type name) instance Cryptol.Parser.Position.HasLoc (Cryptol.Parser.AST.Prop name) instance Cryptol.Parser.Position.AddLoc (Cryptol.Parser.AST.Prop name) instance Cryptol.Parser.Position.AddLoc (Cryptol.Parser.AST.Pattern name) instance Cryptol.Parser.Position.HasLoc (Cryptol.Parser.AST.Pattern name) instance Cryptol.Parser.Position.HasLoc (Cryptol.Parser.AST.Bind name) instance Cryptol.Parser.Position.HasLoc (Cryptol.Parser.AST.Match name) instance Cryptol.Parser.Position.HasLoc a => Cryptol.Parser.Position.HasLoc (Cryptol.Parser.AST.Named a) instance Cryptol.Parser.Position.HasLoc (Cryptol.Parser.AST.Schema name) instance Cryptol.Parser.Position.AddLoc (Cryptol.Parser.AST.Schema name) instance Cryptol.Parser.Position.HasLoc (Cryptol.Parser.AST.Decl name) instance Cryptol.Parser.Position.AddLoc (Cryptol.Parser.AST.Decl name) instance Cryptol.Parser.Position.HasLoc a => Cryptol.Parser.Position.HasLoc (Cryptol.Parser.AST.TopLevel a) instance Cryptol.Parser.Position.HasLoc (Cryptol.Parser.AST.TopDecl name) instance Cryptol.Parser.Position.HasLoc (Cryptol.Parser.AST.Module name) instance Cryptol.Parser.Position.HasLoc (Cryptol.Parser.AST.Newtype name) instance (GHC.Show.Show name, Cryptol.Utils.PP.PPName name) => Cryptol.Utils.PP.PP (Cryptol.Parser.AST.Module name) instance (GHC.Show.Show name, Cryptol.Utils.PP.PPName name) => Cryptol.Utils.PP.PP (Cryptol.Parser.AST.Program name) instance (GHC.Show.Show name, Cryptol.Utils.PP.PPName name) => Cryptol.Utils.PP.PP (Cryptol.Parser.AST.TopDecl name) instance (GHC.Show.Show name, Cryptol.Utils.PP.PPName name) => Cryptol.Utils.PP.PP (Cryptol.Parser.AST.Decl name) instance Cryptol.Utils.PP.PPName name => Cryptol.Utils.PP.PP (Cryptol.Parser.AST.Newtype name) instance Cryptol.Utils.PP.PP Cryptol.Parser.AST.Import instance Cryptol.Utils.PP.PP Cryptol.Parser.AST.ImportSpec instance Cryptol.Utils.PP.PP a => Cryptol.Utils.PP.PP (Cryptol.Parser.AST.TopLevel a) instance Cryptol.Utils.PP.PP Cryptol.Parser.AST.Pragma instance (GHC.Show.Show name, Cryptol.Utils.PP.PPName name) => Cryptol.Utils.PP.PP (Cryptol.Parser.AST.Bind name) instance (GHC.Show.Show name, Cryptol.Utils.PP.PPName name) => Cryptol.Utils.PP.PP (Cryptol.Parser.AST.BindDef name) instance Cryptol.Utils.PP.PPName name => Cryptol.Utils.PP.PP (Cryptol.Parser.AST.TySyn name) instance Cryptol.Utils.PP.PP Cryptol.Parser.AST.Literal instance Cryptol.Utils.PP.PPName name => Cryptol.Utils.PP.PP (Cryptol.Parser.AST.TypeInst name) instance (GHC.Show.Show name, Cryptol.Utils.PP.PPName name) => Cryptol.Utils.PP.PP (Cryptol.Parser.AST.Expr name) instance Cryptol.Utils.PP.PP Cryptol.Parser.AST.Selector instance Cryptol.Utils.PP.PPName name => Cryptol.Utils.PP.PP (Cryptol.Parser.AST.Pattern name) instance (GHC.Show.Show name, Cryptol.Utils.PP.PPName name) => Cryptol.Utils.PP.PP (Cryptol.Parser.AST.Match name) instance Cryptol.Utils.PP.PPName name => Cryptol.Utils.PP.PP (Cryptol.Parser.AST.Schema name) instance Cryptol.Utils.PP.PP Cryptol.Parser.AST.Kind instance Cryptol.Utils.PP.PPName name => Cryptol.Utils.PP.PP (Cryptol.Parser.AST.TParam name) instance Cryptol.Utils.PP.PPName name => Cryptol.Utils.PP.PP (Cryptol.Parser.AST.Type name) instance Cryptol.Utils.PP.PPName name => Cryptol.Utils.PP.PP (Cryptol.Parser.AST.Prop name) instance Cryptol.Parser.AST.NoPos (Cryptol.Parser.Position.Located t) instance Cryptol.Parser.AST.NoPos t => Cryptol.Parser.AST.NoPos (Cryptol.Parser.AST.Named t) instance Cryptol.Parser.AST.NoPos t => Cryptol.Parser.AST.NoPos [t] instance Cryptol.Parser.AST.NoPos t => Cryptol.Parser.AST.NoPos (GHC.Base.Maybe t) instance Cryptol.Parser.AST.NoPos (Cryptol.Parser.AST.Program name) instance Cryptol.Parser.AST.NoPos (Cryptol.Parser.AST.Module name) instance Cryptol.Parser.AST.NoPos (Cryptol.Parser.AST.TopDecl name) instance Cryptol.Parser.AST.NoPos a => Cryptol.Parser.AST.NoPos (Cryptol.Parser.AST.TopLevel a) instance Cryptol.Parser.AST.NoPos (Cryptol.Parser.AST.Decl name) instance Cryptol.Parser.AST.NoPos (Cryptol.Parser.AST.Newtype name) instance Cryptol.Parser.AST.NoPos (Cryptol.Parser.AST.Bind name) instance Cryptol.Parser.AST.NoPos Cryptol.Parser.AST.Pragma instance Cryptol.Parser.AST.NoPos (Cryptol.Parser.AST.TySyn name) instance Cryptol.Parser.AST.NoPos (Cryptol.Parser.AST.Expr name) instance Cryptol.Parser.AST.NoPos (Cryptol.Parser.AST.TypeInst name) instance Cryptol.Parser.AST.NoPos (Cryptol.Parser.AST.Match name) instance Cryptol.Parser.AST.NoPos (Cryptol.Parser.AST.Pattern name) instance Cryptol.Parser.AST.NoPos (Cryptol.Parser.AST.Schema name) instance Cryptol.Parser.AST.NoPos (Cryptol.Parser.AST.TParam name) instance Cryptol.Parser.AST.NoPos (Cryptol.Parser.AST.Type name) instance Cryptol.Parser.AST.NoPos (Cryptol.Parser.AST.Prop name) -- | This module defines the scoping rules for value- and type-level names -- in Cryptol. module Cryptol.Parser.Names modExports :: Ord name => Module name -> ExportSpec name -- | The names defined by a newtype. tnamesNT :: Newtype name -> ([Located name], ()) -- | The names defined and used by a group of mutually recursive -- declarations. namesDs :: Ord name => [Decl name] -> ([Located name], Set name) -- | The names defined and used by a single declarations. namesD :: Ord name => Decl name -> ([Located name], Set name) -- | The names defined and used by a single declarations in such a way that -- they cannot be duplicated in a file. For example, it is fine to use -- x on the RHS of two bindings, but not on the LHS of two type -- signatures. allNamesD :: Ord name => Decl name -> [Located name] tsName :: TySyn name -> Located name -- | The names defined and used by a single binding. namesB :: Ord name => Bind name -> ([Located name], Set name) namesDef :: Ord name => BindDef name -> Set name -- | The names used by an expression. namesE :: Ord name => Expr name -> Set name -- | The names defined by a group of patterns. namesPs :: [Pattern name] -> [Located name] -- | The names defined by a pattern. These will always be unqualified -- names. namesP :: Pattern name -> [Located name] -- | The names defined and used by a match. namesM :: Ord name => Match name -> ([Located name], Set name) -- | The names defined and used by an arm of alist comprehension. namesArm :: Ord name => [Match name] -> ([Located name], Set name) -- | Remove some defined variables from a set of free variables. boundNames :: Ord name => [Located name] -> Set name -> Set name -- | Given the set of type variables that are in scope, compute the type -- synonyms used by a type. namesT :: Ord name => Set name -> Type name -> Set name -- | The type names defined and used by a group of mutually recursive -- declarations. tnamesDs :: Ord name => [Decl name] -> ([Located name], Set name) -- | The type names defined and used by a single declaration. tnamesD :: Ord name => Decl name -> ([Located name], Set name) -- | The type names used by a single binding. tnamesB :: Ord name => Bind name -> Set name tnamesDef :: Ord name => BindDef name -> Set name -- | The type names used by an expression. tnamesE :: Ord name => Expr name -> Set name tnamesTI :: Ord name => TypeInst name -> Set name -- | The type names used by a pattern. tnamesP :: Ord name => Pattern name -> Set name -- | The type names used by a match. tnamesM :: Ord name => Match name -> Set name -- | The type names used by a type schema. tnamesS :: Ord name => Schema name -> Set name -- | The type names used by a prop. tnamesC :: Ord name => Prop name -> Set name -- | Compute the type synonyms/type variables used by a type. tnamesT :: Ord name => Type name -> Set name -- | The purpose of this module is to convert all patterns to variable -- patterns. It also eliminates pattern bindings by de-sugaring them into -- Bind. Furthermore, here we associate signatures and pragmas -- with the names to which they belong. module Cryptol.Parser.NoPat class RemovePatterns t -- | Eliminate all patterns in a program. removePatterns :: RemovePatterns t => t -> (t, [Error]) data Error MultipleSignatures :: PName -> [Located (Schema PName)] -> Error SignatureNoBind :: (Located PName) -> (Schema PName) -> Error PragmaNoBind :: (Located PName) -> Pragma -> Error MultipleFixities :: PName -> [Range] -> Error FixityNoBind :: (Located PName) -> Error MultipleDocs :: PName -> [Range] -> Error instance Control.DeepSeq.NFData Cryptol.Parser.NoPat.Error instance GHC.Generics.Generic Cryptol.Parser.NoPat.Error instance GHC.Show.Show Cryptol.Parser.NoPat.Error instance Cryptol.Parser.NoPat.RemovePatterns (Cryptol.Parser.AST.Program Cryptol.Parser.Name.PName) instance Cryptol.Parser.NoPat.RemovePatterns (Cryptol.Parser.AST.Expr Cryptol.Parser.Name.PName) instance Cryptol.Parser.NoPat.RemovePatterns (Cryptol.Parser.AST.Module Cryptol.Parser.Name.PName) instance Cryptol.Parser.NoPat.RemovePatterns [Cryptol.Parser.AST.Decl Cryptol.Parser.Name.PName] instance GHC.Base.Functor Cryptol.Parser.NoPat.NoPatM instance GHC.Base.Applicative Cryptol.Parser.NoPat.NoPatM instance GHC.Base.Monad Cryptol.Parser.NoPat.NoPatM instance Cryptol.Utils.PP.PP Cryptol.Parser.NoPat.Error -- | Utility functions that are also useful for translating programs from -- previous Cryptol versions. module Cryptol.Parser.Utils translateExprToNumT :: Expr PName -> Maybe (Type PName) widthIdent :: Ident module Cryptol.Parser parseModule :: Config -> Text -> Either ParseError (Module PName) parseProgram :: Layout -> Text -> Either ParseError (Program PName) parseProgramWith :: Config -> Text -> Either ParseError (Program PName) parseExpr :: Text -> Either ParseError (Expr PName) parseExprWith :: Config -> Text -> Either ParseError (Expr PName) parseDecl :: Text -> Either ParseError (Decl PName) parseDeclWith :: Config -> Text -> Either ParseError (Decl PName) parseDecls :: Text -> Either ParseError [Decl PName] parseDeclsWith :: Config -> Text -> Either ParseError [Decl PName] parseLetDecl :: Text -> Either ParseError (Decl PName) parseLetDeclWith :: Config -> Text -> Either ParseError (Decl PName) parseRepl :: Text -> Either ParseError (ReplInput PName) parseReplWith :: Config -> Text -> Either ParseError (ReplInput PName) parseSchema :: Text -> Either ParseError (Schema PName) parseSchemaWith :: Config -> Text -> Either ParseError (Schema PName) parseModName :: String -> Maybe ModName parseHelpName :: String -> Maybe PName data ParseError HappyError :: FilePath -> Position -> (Maybe Token) -> ParseError HappyErrorMsg :: Range -> String -> ParseError ppError :: ParseError -> Doc data Layout Layout :: Layout NoLayout :: Layout data Config Config :: !FilePath -> !Layout -> PreProc -> [FilePath] -> Bool -> Config -- | File that we are working on [cfgSource] :: Config -> !FilePath -- | Settings for layout processing [cfgLayout] :: Config -> !Layout -- | Preprocessor settings [cfgPreProc] :: Config -> PreProc -- | Implicit includes [cfgAutoInclude] :: Config -> [FilePath] -- | When we do layout processing should we add a vCurly (i.e., are we -- parsing a list of things). [cfgModuleScope] :: Config -> Bool defaultConfig :: Config guessPreProc :: FilePath -> PreProc data PreProc None :: PreProc Markdown :: PreProc LaTeX :: PreProc module Cryptol.Parser.NoInclude removeIncludesModule :: FilePath -> Module PName -> IO (Either [IncludeError] (Module PName)) data IncludeError IncludeFailed :: (Located FilePath) -> IncludeError IncludeParseError :: ParseError -> IncludeError IncludeCycle :: [Located FilePath] -> IncludeError ppIncludeError :: IncludeError -> Doc instance Control.DeepSeq.NFData Cryptol.Parser.NoInclude.IncludeError instance GHC.Generics.Generic Cryptol.Parser.NoInclude.IncludeError instance GHC.Show.Show Cryptol.Parser.NoInclude.IncludeError instance GHC.Base.Functor Cryptol.Parser.NoInclude.NoIncM instance GHC.Base.Applicative Cryptol.Parser.NoInclude.NoIncM instance GHC.Base.Monad Cryptol.Parser.NoInclude.NoIncM module Cryptol.ModuleSystem.Name data Name -- | Information about the binding site of the name. data NameInfo -- | This name refers to a declaration from this module Declared :: !ModName -> NameInfo -- | This name is a parameter (function or type) Parameter :: NameInfo nameUnique :: Name -> Int nameIdent :: Name -> Ident nameInfo :: Name -> NameInfo nameLoc :: Name -> Range nameFixity :: Name -> Maybe Fixity asPrim :: Name -> Maybe Ident -- | Compare two names lexically. cmpNameLexical :: Name -> Name -> Ordering -- | Compare two names by the way they would be displayed. cmpNameDisplay :: NameDisp -> Name -> Name -> Ordering -- | Pretty-print a name with its source location information. ppLocName :: Name -> Doc -- | Make a new name for a declaration. mkDeclared :: ModName -> Ident -> Maybe Fixity -> Range -> Supply -> (Name, Supply) -- | Make a new parameter name. mkParameter :: Ident -> Range -> Supply -> (Name, Supply) class Monad m => FreshM m liftSupply :: FreshM m => (Supply -> (a, Supply)) -> m a -- | Retrieve the next unique from the supply. nextUniqueM :: FreshM m => m Int -- | A monad for easing the use of the supply. data SupplyT m a runSupplyT :: Monad m => Supply -> SupplyT m a -> m (a, Supply) data Supply -- | This should only be used once at library initialization, and threaded -- through the rest of the session. The supply is started at 0x1000 to -- leave us plenty of room for names that the compiler needs to know -- about (wired-in constants). emptySupply :: Supply nextUnique :: Supply -> (Int, Supply) -- | A mapping from an identifier defined in some module to its real name. data PrimMap PrimMap :: Map Ident Name -> Map Ident Name -> PrimMap [primDecls] :: PrimMap -> Map Ident Name [primTypes] :: PrimMap -> Map Ident Name -- | It's assumed that we're looking things up that we know already exist, -- so this will panic if it doesn't find the name. lookupPrimDecl :: Ident -> PrimMap -> Name -- | It's assumed that we're looking things up that we know already exist, -- so this will panic if it doesn't find the name. lookupPrimType :: Ident -> PrimMap -> Name instance Control.DeepSeq.NFData Cryptol.ModuleSystem.Name.PrimMap instance GHC.Generics.Generic Cryptol.ModuleSystem.Name.PrimMap instance GHC.Show.Show Cryptol.ModuleSystem.Name.PrimMap instance Control.DeepSeq.NFData Cryptol.ModuleSystem.Name.Supply instance GHC.Generics.Generic Cryptol.ModuleSystem.Name.Supply instance GHC.Show.Show Cryptol.ModuleSystem.Name.Supply instance Control.DeepSeq.NFData Cryptol.ModuleSystem.Name.Name instance GHC.Generics.Generic Cryptol.ModuleSystem.Name.Name instance GHC.Show.Show Cryptol.ModuleSystem.Name.Name instance Control.DeepSeq.NFData Cryptol.ModuleSystem.Name.NameInfo instance GHC.Generics.Generic Cryptol.ModuleSystem.Name.NameInfo instance GHC.Show.Show Cryptol.ModuleSystem.Name.NameInfo instance GHC.Classes.Eq Cryptol.ModuleSystem.Name.NameInfo instance GHC.Classes.Eq Cryptol.ModuleSystem.Name.Name instance GHC.Classes.Ord Cryptol.ModuleSystem.Name.Name instance Cryptol.Utils.PP.PP Cryptol.ModuleSystem.Name.Name instance Cryptol.Utils.PP.PPName Cryptol.ModuleSystem.Name.Name instance Cryptol.ModuleSystem.Name.FreshM m => Cryptol.ModuleSystem.Name.FreshM (MonadLib.ExceptionT i m) instance (GHC.Base.Monoid i, Cryptol.ModuleSystem.Name.FreshM m) => Cryptol.ModuleSystem.Name.FreshM (MonadLib.WriterT i m) instance Cryptol.ModuleSystem.Name.FreshM m => Cryptol.ModuleSystem.Name.FreshM (MonadLib.ReaderT i m) instance Cryptol.ModuleSystem.Name.FreshM m => Cryptol.ModuleSystem.Name.FreshM (MonadLib.StateT i m) instance GHC.Base.Monad m => Cryptol.ModuleSystem.Name.FreshM (Cryptol.ModuleSystem.Name.SupplyT m) instance GHC.Base.Monad m => GHC.Base.Functor (Cryptol.ModuleSystem.Name.SupplyT m) instance GHC.Base.Monad m => GHC.Base.Applicative (Cryptol.ModuleSystem.Name.SupplyT m) instance GHC.Base.Monad m => GHC.Base.Monad (Cryptol.ModuleSystem.Name.SupplyT m) instance MonadLib.MonadT Cryptol.ModuleSystem.Name.SupplyT instance MonadLib.BaseM m n => MonadLib.BaseM (Cryptol.ModuleSystem.Name.SupplyT m) n instance MonadLib.RunM m (a, Cryptol.ModuleSystem.Name.Supply) r => MonadLib.RunM (Cryptol.ModuleSystem.Name.SupplyT m) a (Cryptol.ModuleSystem.Name.Supply -> r) instance Control.Monad.Fix.MonadFix m => Control.Monad.Fix.MonadFix (Cryptol.ModuleSystem.Name.SupplyT m) module Cryptol.TypeCheck.Type -- | Kinds, classify types. data Kind KType :: Kind KNum :: Kind KProp :: Kind (:->) :: Kind -> Kind -> Kind -- | The types of polymorphic values. data Schema Forall :: [TParam] -> [Prop] -> Type -> Schema [sVars] :: Schema -> [TParam] [sProps] :: Schema -> [Prop] [sType] :: Schema -> Type -- | Type parameters. data TParam TParam :: !Int -> Kind -> Maybe Name -> TParam -- | Parameter identifier [tpUnique] :: TParam -> !Int -- | Kind of parameter [tpKind] :: TParam -> Kind -- | Name from source, if any. [tpName] :: TParam -> Maybe Name -- | The internal representation of types. These are assumed to be kind -- correct. data Type -- | Type constant with args TCon :: !TCon -> ![Type] -> Type -- | Type variable (free or bound) TVar :: TVar -> Type -- | This is just a type annotation, for a type that was written as a type -- synonym. It is useful so that we can use it to report nicer errors. -- Example: `TUser T ts t` is really just the type t that was -- written as `T ts` by the user. TUser :: !Name -> ![Type] -> !Type -> Type -- | Record type TRec :: ![(Ident, Type)] -> Type -- | Type variables. data TVar -- | Unique, kind, ids of bound type variables that are in scope The -- Doc is a description of how this type came to be. TVFree :: !Int -> Kind -> (Set TVar) -> Doc -> TVar TVBound :: !Int -> Kind -> TVar -- | The type is supposed to be of kind KProp type Prop = Type -- | Type constants. data TCon TC :: TC -> TCon PC :: PC -> TCon TF :: TFun -> TCon TError :: Kind -> TCErrorMessage -> TCon -- | Predicate symbols. data PC -- |
-- _ == _ --PEqual :: PC -- |
-- _ /= _ --PNeq :: PC -- |
-- _ >= _ --PGeq :: PC -- |
-- fin _ --PFin :: PC -- | Has sel type field does not appear in schemas PHas :: Selector -> PC -- |
-- Arith _ --PArith :: PC -- |
-- Cmp _ --PCmp :: PC -- | This is useful when simplifying things in place PAnd :: PC -- | Ditto PTrue :: PC -- | 1-1 constants. data TC -- | Numbers TCNum :: Integer -> TC -- | Inf TCInf :: TC -- | Bit TCBit :: TC -- |
-- [_] _ --TCSeq :: TC -- |
-- _ -> _ --TCFun :: TC -- |
-- (_, _, _) --TCTuple :: Int -> TC -- | user-defined, T TCNewtype :: UserTC -> TC data UserTC UserTC :: Name -> Kind -> UserTC data TCErrorMessage TCErrorMessage :: !String -> TCErrorMessage [tcErrorMessage] :: TCErrorMessage -> !String -- | Type synonym. data TySyn TySyn :: Name -> [TParam] -> [Prop] -> Type -> TySyn -- | Name [tsName] :: TySyn -> Name -- | Parameters [tsParams] :: TySyn -> [TParam] -- | Ensure body is OK [tsConstraints] :: TySyn -> [Prop] -- | Definition [tsDef] :: TySyn -> Type -- | Named records data Newtype Newtype :: Name -> [TParam] -> [Prop] -> [(Ident, Type)] -> Newtype [ntName] :: Newtype -> Name [ntParams] :: Newtype -> [TParam] [ntConstraints] :: Newtype -> [Prop] [ntFields] :: Newtype -> [(Ident, Type)] class HasKind t kindOf :: HasKind t => t -> Kind quickApply :: Kind -> [a] -> Kind kindResult :: Kind -> Kind tpVar :: TParam -> TVar -- | The type is "simple" (i.e., it contains no type functions). type SType = Type newtypeConType :: Newtype -> Schema isFreeTV :: TVar -> Bool isBoundTV :: TVar -> Bool tIsError :: Type -> Maybe TCErrorMessage tIsNat' :: Type -> Maybe Nat' tIsNum :: Type -> Maybe Integer tIsInf :: Type -> Bool tIsVar :: Type -> Maybe TVar tIsFun :: Type -> Maybe (Type, Type) tIsSeq :: Type -> Maybe (Type, Type) tIsBit :: Type -> Bool tIsTuple :: Type -> Maybe [Type] tIsBinFun :: TFun -> Type -> Maybe (Type, Type) -- | Split up repeated occurances of the given binary type-level function. tSplitFun :: TFun -> Type -> [Type] pIsFin :: Prop -> Maybe Type pIsGeq :: Prop -> Maybe (Type, Type) pIsEq :: Prop -> Maybe (Type, Type) pIsArith :: Prop -> Maybe Type pIsCmp :: Prop -> Maybe Type pIsTrue :: Prop -> Bool pIsWidth :: Prop -> Maybe Type tNum :: Integral a => a -> Type tZero :: Type tOne :: Type tTwo :: Type tInf :: Type tNat' :: Nat' -> Type tBit :: Type tWord :: Type -> Type tSeq :: Type -> Type -> Type tChar :: Type tString :: Int -> Type tRec :: [(Ident, Type)] -> Type tTuple :: [Type] -> Type newtypeTyCon :: Newtype -> TCon -- | Make a function type. tFun :: Type -> Type -> Type infixr 5 `tFun` -- | Eliminate outermost type synonyms. tNoUser :: Type -> Type -- | Make a malformed numeric type. tBadNumber :: TCErrorMessage -> Type tf1 :: TFun -> Type -> Type tf2 :: TFun -> Type -> Type -> Type tf3 :: TFun -> Type -> Type -> Type -> Type tSub :: Type -> Type -> Type tMul :: Type -> Type -> Type tDiv :: Type -> Type -> Type tMod :: Type -> Type -> Type tExp :: Type -> Type -> Type tMin :: Type -> Type -> Type tWidth :: Type -> Type tLenFromThen :: Type -> Type -> Type -> Type tLenFromThenTo :: Type -> Type -> Type -> Type -- | Equality for numeric types. (=#=) :: Type -> Type -> Prop infix 4 =#= (=/=) :: Type -> Type -> Prop pArith :: Type -> Prop pCmp :: Type -> Prop -- | Make a greater-than-or-equal-to constraint. (>==) :: Type -> Type -> Prop infix 4 >== -- | A Has constraint, used for tuple and record selection. pHas :: Selector -> Type -> Type -> Prop pTrue :: Prop pAnd :: [Prop] -> Prop pSplitAnd :: Prop -> [Prop] pFin :: Type -> Prop -- | Make a malformed property. pError :: TCErrorMessage -> Prop class FVS t fvs :: FVS t => t -> Set TVar addTNames :: [TParam] -> NameMap -> NameMap ppNewtypeShort :: Newtype -> Doc -- | Built-in types. data TFun -- |
-- : Num -> Num -> Num --TCAdd :: TFun -- |
-- : Num -> Num -> Num --TCSub :: TFun -- |
-- : Num -> Num -> Num --TCMul :: TFun -- |
-- : Num -> Num -> Num --TCDiv :: TFun -- |
-- : Num -> Num -> Num --TCMod :: TFun -- |
-- : Num -> Num -> Num --TCExp :: TFun -- |
-- : Num -> Num --TCWidth :: TFun -- |
-- : Num -> Num -> Num --TCMin :: TFun -- |
-- : Num -> Num -> Num --TCMax :: TFun -- | : Num -> Num -> Num -> Num Example: [ 1, 5 .. ] -- :: [lengthFromThen 1 5 b][b] TCLenFromThen :: TFun -- | : Num -> Num -> Num -> Num Example: [ 1, 5 .. 9 -- ] :: [lengthFromThenTo 1 5 9][b] TCLenFromThenTo :: TFun instance Control.DeepSeq.NFData Cryptol.TypeCheck.Type.Newtype instance GHC.Generics.Generic Cryptol.TypeCheck.Type.Newtype instance GHC.Show.Show Cryptol.TypeCheck.Type.Newtype instance Control.DeepSeq.NFData Cryptol.TypeCheck.Type.TySyn instance GHC.Generics.Generic Cryptol.TypeCheck.Type.TySyn instance GHC.Show.Show Cryptol.TypeCheck.Type.TySyn instance Control.DeepSeq.NFData Cryptol.TypeCheck.Type.Schema instance GHC.Generics.Generic Cryptol.TypeCheck.Type.Schema instance GHC.Show.Show Cryptol.TypeCheck.Type.Schema instance GHC.Classes.Eq Cryptol.TypeCheck.Type.Schema instance Control.DeepSeq.NFData Cryptol.TypeCheck.Type.Type instance GHC.Generics.Generic Cryptol.TypeCheck.Type.Type instance GHC.Show.Show Cryptol.TypeCheck.Type.Type instance Control.DeepSeq.NFData Cryptol.TypeCheck.Type.TCon instance GHC.Generics.Generic Cryptol.TypeCheck.Type.TCon instance GHC.Classes.Ord Cryptol.TypeCheck.Type.TCon instance GHC.Classes.Eq Cryptol.TypeCheck.Type.TCon instance GHC.Show.Show Cryptol.TypeCheck.Type.TCon instance Control.DeepSeq.NFData Cryptol.TypeCheck.Type.TCErrorMessage instance GHC.Generics.Generic Cryptol.TypeCheck.Type.TCErrorMessage instance GHC.Classes.Ord Cryptol.TypeCheck.Type.TCErrorMessage instance GHC.Classes.Eq Cryptol.TypeCheck.Type.TCErrorMessage instance GHC.Show.Show Cryptol.TypeCheck.Type.TCErrorMessage instance Control.DeepSeq.NFData Cryptol.TypeCheck.Type.TC instance GHC.Generics.Generic Cryptol.TypeCheck.Type.TC instance GHC.Classes.Ord Cryptol.TypeCheck.Type.TC instance GHC.Classes.Eq Cryptol.TypeCheck.Type.TC instance GHC.Show.Show Cryptol.TypeCheck.Type.TC instance Control.DeepSeq.NFData Cryptol.TypeCheck.Type.UserTC instance GHC.Generics.Generic Cryptol.TypeCheck.Type.UserTC instance GHC.Show.Show Cryptol.TypeCheck.Type.UserTC instance Control.DeepSeq.NFData Cryptol.TypeCheck.Type.PC instance GHC.Generics.Generic Cryptol.TypeCheck.Type.PC instance GHC.Classes.Ord Cryptol.TypeCheck.Type.PC instance GHC.Classes.Eq Cryptol.TypeCheck.Type.PC instance GHC.Show.Show Cryptol.TypeCheck.Type.PC instance Control.DeepSeq.NFData Cryptol.TypeCheck.Type.TVar instance GHC.Generics.Generic Cryptol.TypeCheck.Type.TVar instance GHC.Show.Show Cryptol.TypeCheck.Type.TVar instance Control.DeepSeq.NFData Cryptol.TypeCheck.Type.TParam instance GHC.Generics.Generic Cryptol.TypeCheck.Type.TParam instance GHC.Show.Show Cryptol.TypeCheck.Type.TParam instance Control.DeepSeq.NFData Cryptol.TypeCheck.Type.Kind instance GHC.Generics.Generic Cryptol.TypeCheck.Type.Kind instance GHC.Show.Show Cryptol.TypeCheck.Type.Kind instance GHC.Classes.Ord Cryptol.TypeCheck.Type.Kind instance GHC.Classes.Eq Cryptol.TypeCheck.Type.Kind instance Cryptol.TypeCheck.Type.HasKind Cryptol.TypeCheck.Type.TVar instance Cryptol.TypeCheck.Type.HasKind Cryptol.TypeCheck.Type.TCon instance Cryptol.TypeCheck.Type.HasKind Cryptol.TypeCheck.Type.UserTC instance Cryptol.TypeCheck.Type.HasKind Cryptol.TypeCheck.Type.TC instance Cryptol.TypeCheck.Type.HasKind Cryptol.TypeCheck.Type.PC instance Cryptol.TypeCheck.Type.HasKind Cryptol.Prims.Syntax.TFun instance Cryptol.TypeCheck.Type.HasKind Cryptol.TypeCheck.Type.Type instance Cryptol.TypeCheck.Type.HasKind Cryptol.TypeCheck.Type.TySyn instance Cryptol.TypeCheck.Type.HasKind Cryptol.TypeCheck.Type.Newtype instance Cryptol.TypeCheck.Type.HasKind Cryptol.TypeCheck.Type.TParam instance GHC.Classes.Eq Cryptol.TypeCheck.Type.Type instance GHC.Classes.Ord Cryptol.TypeCheck.Type.Type instance GHC.Classes.Eq Cryptol.TypeCheck.Type.TParam instance GHC.Classes.Ord Cryptol.TypeCheck.Type.TParam instance GHC.Classes.Eq Cryptol.TypeCheck.Type.UserTC instance GHC.Classes.Ord Cryptol.TypeCheck.Type.UserTC instance GHC.Classes.Eq Cryptol.TypeCheck.Type.TVar instance GHC.Classes.Ord Cryptol.TypeCheck.Type.TVar instance Cryptol.TypeCheck.Type.FVS Cryptol.TypeCheck.Type.Type instance Cryptol.TypeCheck.Type.FVS a => Cryptol.TypeCheck.Type.FVS (GHC.Base.Maybe a) instance Cryptol.TypeCheck.Type.FVS a => Cryptol.TypeCheck.Type.FVS [a] instance (Cryptol.TypeCheck.Type.FVS a, Cryptol.TypeCheck.Type.FVS b) => Cryptol.TypeCheck.Type.FVS (a, b) instance Cryptol.TypeCheck.Type.FVS Cryptol.TypeCheck.Type.Schema instance Cryptol.Utils.PP.PP Cryptol.TypeCheck.Type.TParam instance Cryptol.Utils.PP.PP (Cryptol.TypeCheck.PP.WithNames Cryptol.TypeCheck.Type.TParam) instance Cryptol.Utils.PP.PP Cryptol.TypeCheck.Type.Schema instance Cryptol.Utils.PP.PP (Cryptol.TypeCheck.PP.WithNames Cryptol.TypeCheck.Type.Schema) instance Cryptol.Utils.PP.PP Cryptol.TypeCheck.Type.TySyn instance Cryptol.Utils.PP.PP (Cryptol.TypeCheck.PP.WithNames Cryptol.TypeCheck.Type.TySyn) instance Cryptol.Utils.PP.PP (Cryptol.TypeCheck.PP.WithNames Cryptol.TypeCheck.Type.Type) instance Cryptol.Utils.PP.PP Cryptol.TypeCheck.Type.Kind instance Cryptol.Utils.PP.PP (Cryptol.TypeCheck.PP.WithNames Cryptol.TypeCheck.Type.TVar) instance Cryptol.Utils.PP.PP Cryptol.TypeCheck.Type.TVar instance Cryptol.Utils.PP.PP Cryptol.TypeCheck.Type.Type instance Cryptol.Utils.PP.PP Cryptol.TypeCheck.Type.TCon instance Cryptol.Utils.PP.PP Cryptol.TypeCheck.Type.TCErrorMessage instance Cryptol.Utils.PP.PP Cryptol.TypeCheck.Type.PC instance Cryptol.Utils.PP.PP Cryptol.TypeCheck.Type.TC instance Cryptol.Utils.PP.PP Cryptol.TypeCheck.Type.UserTC module Cryptol.TypeCheck.AST -- | A Cryptol module. data Module Module :: !ModName -> ExportSpec Name -> [Import] -> Map Name TySyn -> Map Name Newtype -> [DeclGroup] -> Module [mName] :: Module -> !ModName [mExports] :: Module -> ExportSpec Name [mImports] :: Module -> [Import] [mTySyns] :: Module -> Map Name TySyn [mNewtypes] :: Module -> Map Name Newtype [mDecls] :: Module -> [DeclGroup] data Expr -- | List value (with type of elements) EList :: [Expr] -> Type -> Expr -- | Tuple value ETuple :: [Expr] -> Expr -- | Record value ERec :: [(Ident, Expr)] -> Expr -- | Elimination for tuplerecordlist ESel :: Expr -> Selector -> Expr -- | If-then-else EIf :: Expr -> Expr -> Expr -> Expr -- | List comprehensions The types cache the length of the sequence and its -- element type. EComp :: Type -> Type -> Expr -> [[Match]] -> Expr -- | Use of a bound variable EVar :: Name -> Expr -- | Function Value ETAbs :: TParam -> Expr -> Expr -- | Type application ETApp :: Expr -> Type -> Expr -- | Function application EApp :: Expr -> Expr -> Expr -- | Function value EAbs :: Name -> Type -> Expr -> Expr -- | Proof abstraction. Because we don't keep proofs around we don't need -- to name the assumption, but we still need to record the assumption. -- The assumption is the Type term, which should be of kind -- KProp. EProofAbs :: Prop -> Expr -> Expr -- | If `e : p => t`, then `EProofApp e : t`, as long as we can prove -- p. -- -- We don't record the actual proofs, as they are not used for anything. -- It may be nice to keep them around for sanity checking. EProofApp :: Expr -> Expr EWhere :: Expr -> [DeclGroup] -> Expr data Match -- | Type arguments are the length and element type of the sequence -- expression From :: Name -> Type -> Type -> Expr -> Match Let :: Decl -> Match data DeclGroup -- | Mutually recursive declarations Recursive :: [Decl] -> DeclGroup -- | Non-recursive declaration NonRecursive :: Decl -> DeclGroup groupDecls :: DeclGroup -> [Decl] data Decl Decl :: !Name -> Schema -> DeclDef -> [Pragma] -> !Bool -> Maybe Fixity -> Maybe String -> Decl [dName] :: Decl -> !Name [dSignature] :: Decl -> Schema [dDefinition] :: Decl -> DeclDef [dPragmas] :: Decl -> [Pragma] [dInfix] :: Decl -> !Bool [dFixity] :: Decl -> Maybe Fixity [dDoc] :: Decl -> Maybe String data DeclDef DPrim :: DeclDef DExpr :: Expr -> DeclDef -- | Construct a primitive, given a map to the unique names of the Cryptol -- module. ePrim :: PrimMap -> Ident -> Expr -- | Make an expression that is error pre-applied to a type and a -- message. eError :: PrimMap -> Type -> String -> Expr eString :: PrimMap -> String -> Expr eChar :: PrimMap -> Char -> Expr ppLam :: NameMap -> Int -> [TParam] -> [Prop] -> [(Name, Type)] -> Expr -> Doc splitWhile :: (a -> Maybe (b, a)) -> a -> ([b], a) splitAbs :: Expr -> Maybe ((Name, Type), Expr) splitTAbs :: Expr -> Maybe (TParam, Expr) splitProofAbs :: Expr -> Maybe (Prop, Expr) data Name -- | Built-in types. data TFun -- |
-- : Num -> Num -> Num --TCAdd :: TFun -- |
-- : Num -> Num -> Num --TCSub :: TFun -- |
-- : Num -> Num -> Num --TCMul :: TFun -- |
-- : Num -> Num -> Num --TCDiv :: TFun -- |
-- : Num -> Num -> Num --TCMod :: TFun -- |
-- : Num -> Num -> Num --TCExp :: TFun -- |
-- : Num -> Num --TCWidth :: TFun -- |
-- : Num -> Num -> Num --TCMin :: TFun -- |
-- : Num -> Num -> Num --TCMax :: TFun -- | : Num -> Num -> Num -> Num Example: [ 1, 5 .. ] -- :: [lengthFromThen 1 5 b][b] TCLenFromThen :: TFun -- | : Num -> Num -> Num -> Num Example: [ 1, 5 .. 9 -- ] :: [lengthFromThenTo 1 5 9][b] TCLenFromThenTo :: TFun -- | Selectors are used for projecting from various components. Each -- selector has an option spec to specify the shape of the thing that is -- being selected. Currently, there is no surface syntax for list -- selectors, but they are used during the desugaring of patterns. data Selector -- | Zero-based tuple selection. Optionally specifies the shape of the -- tuple (one-based). TupleSel :: Int -> (Maybe Int) -> Selector -- | Record selection. Optionally specifies the shape of the record. RecordSel :: Ident -> (Maybe [Ident]) -> Selector -- | List selection. Optionally specifies the length of the list. ListSel :: Int -> (Maybe Int) -> Selector -- | An import declaration. data Import Import :: !ModName -> Maybe ModName -> Maybe ImportSpec -> Import [iModule] :: Import -> !ModName [iAs] :: Import -> Maybe ModName [iSpec] :: Import -> Maybe ImportSpec -- | The list of names following an import. -- -- INVARIANT: All of the Name entries in the list are expected -- to be unqualified names; the QName or NewName -- constructors should not be present. data ImportSpec Hiding :: [Ident] -> ImportSpec Only :: [Ident] -> ImportSpec -- | Export information for a declaration. data ExportType Public :: ExportType Private :: ExportType data ExportSpec name ExportSpec :: Set name -> Set name -> ExportSpec name [eTypes] :: ExportSpec name -> Set name [eBinds] :: ExportSpec name -> Set name -- | Check to see if a binding is exported. isExportedBind :: Ord name => name -> ExportSpec name -> Bool -- | Check to see if a type synonym is exported. isExportedType :: Ord name => name -> ExportSpec name -> Bool data Pragma PragmaNote :: String -> Pragma PragmaProperty :: Pragma data Fixity Fixity :: !Assoc -> !Int -> Fixity [fAssoc] :: Fixity -> !Assoc [fLevel] :: Fixity -> !Int -- | A mapping from an identifier defined in some module to its real name. data PrimMap PrimMap :: Map Ident Name -> Map Ident Name -> PrimMap [primDecls] :: PrimMap -> Map Ident Name [primTypes] :: PrimMap -> Map Ident Name data TCErrorMessage TCErrorMessage :: !String -> TCErrorMessage [tcErrorMessage] :: TCErrorMessage -> !String instance Control.DeepSeq.NFData Cryptol.TypeCheck.AST.Module instance GHC.Generics.Generic Cryptol.TypeCheck.AST.Module instance GHC.Show.Show Cryptol.TypeCheck.AST.Module instance Control.DeepSeq.NFData Cryptol.TypeCheck.AST.Match instance GHC.Generics.Generic Cryptol.TypeCheck.AST.Match instance GHC.Show.Show Cryptol.TypeCheck.AST.Match instance Control.DeepSeq.NFData Cryptol.TypeCheck.AST.Decl instance GHC.Generics.Generic Cryptol.TypeCheck.AST.Decl instance GHC.Show.Show Cryptol.TypeCheck.AST.Decl instance Control.DeepSeq.NFData Cryptol.TypeCheck.AST.DeclGroup instance GHC.Generics.Generic Cryptol.TypeCheck.AST.DeclGroup instance GHC.Show.Show Cryptol.TypeCheck.AST.DeclGroup instance Control.DeepSeq.NFData Cryptol.TypeCheck.AST.Expr instance GHC.Generics.Generic Cryptol.TypeCheck.AST.Expr instance GHC.Show.Show Cryptol.TypeCheck.AST.Expr instance Control.DeepSeq.NFData Cryptol.TypeCheck.AST.DeclDef instance GHC.Generics.Generic Cryptol.TypeCheck.AST.DeclDef instance GHC.Show.Show Cryptol.TypeCheck.AST.DeclDef instance Cryptol.Utils.PP.PP (Cryptol.TypeCheck.PP.WithNames Cryptol.TypeCheck.AST.Expr) instance Cryptol.Utils.PP.PP Cryptol.TypeCheck.AST.Expr instance Cryptol.Utils.PP.PP (Cryptol.TypeCheck.PP.WithNames Cryptol.TypeCheck.AST.Match) instance Cryptol.Utils.PP.PP Cryptol.TypeCheck.AST.Match instance Cryptol.Utils.PP.PP (Cryptol.TypeCheck.PP.WithNames Cryptol.TypeCheck.AST.DeclGroup) instance Cryptol.Utils.PP.PP Cryptol.TypeCheck.AST.DeclGroup instance Cryptol.Utils.PP.PP (Cryptol.TypeCheck.PP.WithNames Cryptol.TypeCheck.AST.Decl) instance Cryptol.Utils.PP.PP (Cryptol.TypeCheck.PP.WithNames Cryptol.TypeCheck.AST.DeclDef) instance Cryptol.Utils.PP.PP Cryptol.TypeCheck.AST.Decl instance Cryptol.Utils.PP.PP Cryptol.TypeCheck.AST.Module instance Cryptol.Utils.PP.PP (Cryptol.TypeCheck.PP.WithNames Cryptol.TypeCheck.AST.Module) -- | The sytnax of numeric propositions. module Cryptol.TypeCheck.Solver.Numeric.AST data Name UserName :: TVar -> Name SysName :: Int -> Name -- | Pretty print a name. ppName :: Name -> Doc -- | Propopsitions, representing Cryptol's numeric constraints (and a bit -- more). data Prop Fin :: Expr -> Prop (:==) :: Expr -> Expr -> Prop (:>=) :: Expr -> Expr -> Prop (:>) :: Expr -> Expr -> Prop (:==:) :: Expr -> Expr -> Prop (:>:) :: Expr -> Expr -> Prop (:&&) :: Prop -> Prop -> Prop (:||) :: Prop -> Prop -> Prop Not :: Prop -> Prop PFalse :: Prop PTrue :: Prop -- | Compute all expressions in a property. cryPropExprs :: Prop -> [Expr] -- | Compute the free variables in a proposition. cryPropFVS :: Prop -> Set Name -- | Pretty print a top-level property. ppProp :: Prop -> Doc -- | Pretty print a proposition, in the given precedence context. ppPropPrec :: Int -> Prop -> Doc -- | Expressions, representing Cryptol's numeric types. data Expr K :: Nat' -> Expr Var :: Name -> Expr (:+) :: Expr -> Expr -> Expr (:-) :: Expr -> Expr -> Expr (:*) :: Expr -> Expr -> Expr Div :: Expr -> Expr -> Expr Mod :: Expr -> Expr -> Expr (:^^) :: Expr -> Expr -> Expr Min :: Expr -> Expr -> Expr Max :: Expr -> Expr -> Expr Width :: Expr -> Expr LenFromThen :: Expr -> Expr -> Expr -> Expr LenFromThenTo :: Expr -> Expr -> Expr -> Expr -- | The constant 0. zero :: Expr -- | The constant 1. one :: Expr -- | The constant 2. two :: Expr -- | The constant infinity. inf :: Expr -- | Make a conjucntion of the given properties. cryAnds :: [Prop] -> Prop -- | Make a disjunction of the given properties. cryOrs :: [Prop] -> Prop -- | Compute the immediate sub-expressions of an expression. cryExprExprs :: Expr -> [Expr] -- | Rebuild an expression, using the top-level strucutre of the first -- expression, but the second list of expressions as sub-expressions. cryRebuildExpr :: Expr -> [Expr] -> Expr -- | Compute the free variables in an expression. cryExprFVS :: Expr -> Set Name -- | Pretty print an expression at the top level. ppExpr :: Expr -> Doc -- | Pretty print an expression, in the given precedence context. ppExprPrec :: Int -> Expr -> Doc -- | Natural numbers with an infinity element data Nat' Nat :: Integer -> Nat' Inf :: Nat' type IfExpr = IfExpr' Prop data IfExpr' p a If :: p -> (IfExpr' p a) -> (IfExpr' p a) -> IfExpr' p a Return :: a -> IfExpr' p a Impossible :: IfExpr' p a -- | Pretty print an experssion with ifs. ppIf :: (p -> Doc) -> (a -> Doc) -> IfExpr' p a -> Doc -- | Pretty print an experssion with ifs. ppIfExpr :: IfExpr Expr -> Doc type Subst = Map Name Expr -- | Replaces occurances of the name with the expression. Returns -- Nothing if there were no occurances of the name. class HasVars ast apSubst :: HasVars ast => Subst -> ast -> Maybe ast cryLet :: HasVars e => Name -> Expr -> e -> Maybe e composeSubst :: Subst -> Subst -> Subst doAppSubst :: HasVars a => Subst -> a -> a instance (GHC.Classes.Eq a, GHC.Classes.Eq p) => GHC.Classes.Eq (Cryptol.TypeCheck.Solver.Numeric.AST.IfExpr' p a) instance GHC.Generics.Generic Cryptol.TypeCheck.Solver.Numeric.AST.Prop instance GHC.Show.Show Cryptol.TypeCheck.Solver.Numeric.AST.Prop instance GHC.Classes.Eq Cryptol.TypeCheck.Solver.Numeric.AST.Prop instance GHC.Classes.Ord Cryptol.TypeCheck.Solver.Numeric.AST.Expr instance GHC.Generics.Generic Cryptol.TypeCheck.Solver.Numeric.AST.Expr instance GHC.Show.Show Cryptol.TypeCheck.Solver.Numeric.AST.Expr instance GHC.Classes.Eq Cryptol.TypeCheck.Solver.Numeric.AST.Expr instance GHC.Generics.Generic Cryptol.TypeCheck.Solver.Numeric.AST.Name instance GHC.Classes.Ord Cryptol.TypeCheck.Solver.Numeric.AST.Name instance GHC.Classes.Eq Cryptol.TypeCheck.Solver.Numeric.AST.Name instance GHC.Show.Show Cryptol.TypeCheck.Solver.Numeric.AST.Name instance GHC.Base.Monad (Cryptol.TypeCheck.Solver.Numeric.AST.IfExpr' p) instance GHC.Base.Functor (Cryptol.TypeCheck.Solver.Numeric.AST.IfExpr' p) instance GHC.Base.Applicative (Cryptol.TypeCheck.Solver.Numeric.AST.IfExpr' p) instance Cryptol.TypeCheck.Solver.Numeric.AST.HasVars GHC.Types.Bool instance Cryptol.TypeCheck.Solver.Numeric.AST.HasVars Cryptol.TypeCheck.Solver.Numeric.AST.Expr instance Cryptol.TypeCheck.Solver.Numeric.AST.HasVars Cryptol.TypeCheck.Solver.Numeric.AST.Prop module Cryptol.TypeCheck.Solver.Numeric.Defined -- | A condition ensure that the given *basic* proposition makes sense. cryDefinedProp :: Prop -> Prop -- | Generate a property ensuring that the expression is well-defined. This -- might be a bit too strict. For example, we reject things like max -- inf (0 - 1), which one might think would simplify to -- inf. cryDefined :: Expr -> Prop -- | Simplification of expressions. The result of simplifying an expression -- e, is a new expression e', which satisfies the -- property: -- -- if e is well-defined then e and e' will evaluate to the same type. module Cryptol.TypeCheck.Solver.Numeric.SimplifyExpr -- | Simplify an expression, if possible. crySimpExpr :: Expr -> Expr -- | Perform simplification from the leaves up. Returns Nothing if -- there were no changes. crySimpExprMaybe :: Expr -> Maybe Expr data Sign Pos :: Sign Neg :: Sign otherSign :: Sign -> Sign signed :: Sign -> Integer -> Integer splitSum :: Expr -> [(Sign, Expr)] normSum :: Expr -> Expr crySimpExprStep :: Expr -> Maybe Expr -- | Make a simplification step, assuming the expression is well-formed. crySimpExprStep1 :: Expr -> Maybe Expr instance GHC.Show.Show Cryptol.TypeCheck.Solver.Numeric.SimplifyExpr.Sign -- | TODO: - Putting in a normal form to spot "prove by assumption" - -- Additional simplification rules, namely various cancelation. - Things -- like: lg2 e(x) = x, where we know thate is increasing. module Cryptol.TypeCheck.Solver.Numeric.Simplify -- | Simplify a property, if possible. crySimplify :: Prop -> Prop -- | Simplify a property, if possible. crySimplifyMaybe :: Prop -> Maybe Prop -- | Simplify only the Expr parts of a Prop. crySimpPropExpr :: Prop -> Prop -- | Simplify only the Expr parts of a Prop. Returns Nothing if -- there were no changes. crySimpPropExprMaybe :: Prop -> Maybe Prop -- | Separate Non-Linear Constraints When we spot a non-linear expression, -- we name it and add it to a map. -- -- If we see the same expression multiple times, then we give it the same -- name. -- -- The body of the non-linear expression is not processed further, so the -- resulting map should not contain any of the newly minted names. module Cryptol.TypeCheck.Solver.Numeric.NonLin -- | Factor-out non-linear terms, by naming them. nonLinProp :: NonLinS -> Prop -> ([Prop], NonLinS) data NonLinS -- | Get the known non-linear terms. nonLinSubst :: NonLinS -> Subst -- | The initial state for the linearization process. initialNonLinS :: NonLinS -- | Apply a substituin to the non-linear expression database. Returns -- Nothing if nothing was affected. Otherwise returns Just, -- and a substitution for non-linear expressions that became linear. -- -- The definitions of NL terms do not contain other named NL terms, so it -- does not matter if the substitution contains bindings like _a = -- e. -- -- There should be no bindings that mention NL term names in the -- definitions of the substition (i.e, things like x = _a are -- NOT ok). apSubstNL :: Subst -> NonLinS -> Maybe (Subst, [Prop], NonLinS) lookupNL :: Name -> NonLinS -> Maybe Expr instance GHC.Show.Show Cryptol.TypeCheck.Solver.Numeric.NonLin.NonLinS -- | An interval interpretation of types. module Cryptol.TypeCheck.Solver.Numeric.Interval -- | Only meaningful for numeric types typeInterval :: Map TVar Interval -> Type -> Interval data IntervalUpdate NoChange :: IntervalUpdate InvalidInterval :: TVar -> IntervalUpdate NewIntervals :: (Map TVar Interval) -> IntervalUpdate updateInterval :: (TVar, Interval) -> Map TVar Interval -> IntervalUpdate computePropIntervals :: Map TVar Interval -> [Prop] -> IntervalUpdate -- | What we learn about variables from a single prop. propInterval :: Map TVar Interval -> Prop -> [(TVar, Interval)] data Interval Interval :: Nat' -> Maybe Nat' -> Interval -- | lower bound (inclusive) [iLower] :: Interval -> Nat' -- | upper bound (inclusive) If there is no upper bound, than all *natural* -- numbers. [iUpper] :: Interval -> Maybe Nat' ppIntervals :: Map TVar Interval -> Doc ppInterval :: Interval -> Doc iIsExact :: Interval -> Maybe Nat' iIsFin :: Interval -> Bool -- | Returns True when the intervals definitely overlap, and -- False otherwise. iDisjoint :: Interval -> Interval -> Bool -- | Intersect two intervals, yielding a new one that describes the space -- where they overlap. If the two intervals are disjoint, the result will -- be Nothing. iIntersect :: Interval -> Interval -> Maybe Interval -- | Any value iAny :: Interval -- | Any finite value iAnyFin :: Interval -- | Exactly this value iConst :: Nat' -> Interval iAdd :: Interval -> Interval -> Interval iMul :: Interval -> Interval -> Interval iExp :: Interval -> Interval -> Interval iMin :: Interval -> Interval -> Interval iMax :: Interval -> Interval -> Interval iSub :: Interval -> Interval -> Interval iDiv :: Interval -> Interval -> Interval iMod :: Interval -> Interval -> Interval iWidth :: Interval -> Interval iLenFromThen :: Interval -> Interval -> Interval -> Interval iLenFromThenTo :: Interval -> Interval -> Interval -> Interval instance GHC.Show.Show Cryptol.TypeCheck.Solver.Numeric.Interval.IntervalUpdate instance GHC.Show.Show Cryptol.TypeCheck.Solver.Numeric.Interval.Interval instance GHC.Classes.Eq Cryptol.TypeCheck.Solver.Numeric.Interval.Interval -- | Desugar into SMTLIB Terminology module Cryptol.TypeCheck.Solver.Numeric.SMT -- | Assumes simplified, linear, defined. desugarProp :: Prop -> IfExpr Prop -- | The name of a variable in the SMT translation. smtName :: Name -> String -- | The name of a boolean variable, representing `fin x`. smtFinName :: Name -> String ifPropToSmtLib :: IfExpr Prop -> SExpr -- | Given a model, compute an improving substitution, implied by the -- model. The entries in the substitution look like this: -- --
-- Bit --TVBit :: TValue -- |
-- [n]a --TVSeq :: Integer -> TValue -> TValue -- |
-- [inf]t --TVStream :: TValue -> TValue -- |
-- (a, b, c ) --TVTuple :: [TValue] -> TValue -- |
-- { x : a, y : b, z : c }
--
TVRec :: [(Ident, TValue)] -> TValue
-- | -- a -> b --TVFun :: TValue -> TValue -> TValue -- | Convert a type value back into a regular type tValTy :: TValue -> Type -- | True if the evaluated value is Bit isTBit :: TValue -> Bool -- | Produce a sequence type value tvSeq :: Nat' -> TValue -> TValue -- | Coerce an extended natural into an integer, for values known to be -- finite finNat' :: Nat' -> Integer type TypeEnv = Map TVar (Either Nat' TValue) -- | Evaluation for types (kind * or #). evalType :: TypeEnv -> Type -> Either Nat' TValue -- | Evaluation for value types (kind *). evalValType :: TypeEnv -> Type -> TValue -- | Evaluation for number types (kind #). evalNumType :: TypeEnv -> Type -> Nat' -- | Reduce type functions, raising an exception for undefined values. evalTF :: TFun -> [Nat'] -> Nat' instance Control.DeepSeq.NFData Cryptol.Eval.Type.TValue instance GHC.Generics.Generic Cryptol.Eval.Type.TValue instance GHC.Show.Show Cryptol.Eval.Type.TValue -- | Architecture-specific parts of the concrete evaluator go here. module Cryptol.Eval.Arch -- | This is the widest word we can have before gmp will fail to allocate -- and bring down the whole program. According to -- https://gmplib.org/list-archives/gmp-bugs/2009-July/001538.html -- the sizes are 2^32-1 for 32-bit, and 2^37 for 64-bit, however -- experiments show that it's somewhere under 2^37 at least on 64-bit Mac -- OS X. maxBigIntWidth :: Integer module Cryptol.Eval.Value -- | Concrete bitvector values: width, value Invariant: The value must be -- within the range 0 .. 2^width-1 data BV BV :: !Integer -> !Integer -> BV -- | Apply an integer function to the values of bitvectors. This function -- assumes both bitvectors are the same width. binBV :: (Integer -> Integer -> Integer) -> BV -> BV -> BV -- | Apply an integer function to the values of a bitvector. This function -- assumes the function will not require masking. unaryBV :: (Integer -> Integer) -> BV -> BV bvVal :: BV -> Integer -- | Smart constructor for BVs that checks for the width limit mkBv :: Integer -> Integer -> BV -- | A sequence map represents a mapping from nonnegative integer indices -- to values. These are used to represent both finite and infinite -- sequences. data SeqMap b w IndexSeqMap :: !(Integer -> Eval (GenValue b w)) -> SeqMap b w UpdateSeqMap :: !(Map Integer (Eval (GenValue b w))) -> !(Integer -> Eval (GenValue b w)) -> SeqMap b w lookupSeqMap :: SeqMap b w -> Integer -> Eval (GenValue b w) type SeqValMap = SeqMap Bool BV -- | Generate a finite sequence map from a list of values finiteSeqMap :: [Eval (GenValue b w)] -> SeqMap b w -- | Generate an infinite sequence map from a stream of values infiniteSeqMap :: [Eval (GenValue b w)] -> Eval (SeqMap b w) -- | Create a finite list of length n of the values from [0..n-1] -- in the given the sequence emap. enumerateSeqMap :: (Integral n) => n -> SeqMap b w -> [Eval (GenValue b w)] -- | Create an infinite stream of all the values in a sequence map streamSeqMap :: SeqMap b w -> [Eval (GenValue b w)] -- | Reverse the order of a finite sequence map reverseSeqMap :: Integer -> SeqMap b w -> SeqMap b w updateSeqMap :: SeqMap b w -> Integer -> Eval (GenValue b w) -> SeqMap b w -- | Given a number n and a sequence map, return two new sequence -- maps: the first containing the values from `[0..n-1]` and the next -- containing the values from n onward. splitSeqMap :: Integer -> SeqMap b w -> (SeqMap b w, SeqMap b w) -- | Given a sequence map, return a new sequence map that is memoized using -- a finite map memo table. memoMap :: SeqMap b w -> Eval (SeqMap b w) -- | Apply the given evaluation function pointwise to the two given -- sequence maps. zipSeqMap :: (GenValue b w -> GenValue b w -> Eval (GenValue b w)) -> SeqMap b w -> SeqMap b w -> Eval (SeqMap b w) -- | Apply the given function to each value in the given sequence map mapSeqMap :: (GenValue b w -> Eval (GenValue b w)) -> SeqMap b w -> Eval (SeqMap b w) -- | For efficency reasons, we handle finite sequences of bits as special -- cases in the evaluator. In cases where we know it is safe to do so, we -- prefer to used a "packed word" representation of bit sequences. This -- allows us to rely directly on Integer types (in the concrete -- evalautor) and SBV's Word types (in the symbolic simulator). -- -- However, if we cannot be sure all the bits of the sequence will -- eventually be forced, we must instead rely on an explicit sequence of -- bits representation. data WordValue b w -- | Packed word representation for bit sequences. WordVal :: !w -> WordValue b w -- | Sequence of thunks representing bits. BitsVal :: !(Seq (Eval b)) -> WordValue b w -- | Force a word value into packed word form asWordVal :: BitWord b w => WordValue b w -> Eval w -- | Force a word value into a sequence of bits asBitsVal :: BitWord b w => WordValue b w -> Seq (Eval b) -- | Select an individual bit from a word value indexWordValue :: BitWord b w => WordValue b w -> Integer -> Eval b -- | Generic value type, parameterized by bit and word types. -- -- NOTE: we maintain an important invariant regarding sequence types. -- VSeq must never be used for finite sequences of bits. Always -- use the VWord constructor instead! Infinite sequences of bits -- are handled by the VStream constructor, just as for other -- types. data GenValue b w -- |
-- { .. }
--
VRecord :: ![(Ident, Eval (GenValue b w))] -> GenValue b w
-- | -- ( .. ) --VTuple :: ![Eval (GenValue b w)] -> GenValue b w -- |
-- Bit --VBit :: !b -> GenValue b w -- | [n]a Invariant: VSeq is never a sequence of bits VSeq :: !Integer -> !(SeqMap b w) -> GenValue b w -- |
-- [n]Bit --VWord :: !Integer -> !(Eval (WordValue b w)) -> GenValue b w -- |
-- [inf]a --VStream :: !(SeqMap b w) -> GenValue b w -- | functions VFun :: (Eval (GenValue b w) -> Eval (GenValue b w)) -> GenValue b w -- | polymorphic values (kind *) VPoly :: (TValue -> Eval (GenValue b w)) -> GenValue b w -- | polymorphic values (kind #) VNumPoly :: (Nat' -> Eval (GenValue b w)) -> GenValue b w -- | Force the evaluation of a word value forceWordValue :: WordValue b w -> Eval () -- | Force the evaluation of a value forceValue :: GenValue b w -> Eval () type Value = GenValue Bool BV data PPOpts PPOpts :: Bool -> Int -> Int -> PPOpts [useAscii] :: PPOpts -> Bool [useBase] :: PPOpts -> Int [useInfLength] :: PPOpts -> Int defaultPPOpts :: PPOpts atFst :: Functor f => (a -> f b) -> (a, c) -> f (b, c) atSnd :: Functor f => (a -> f b) -> (c, a) -> f (c, b) ppValue :: forall b w. BitWord b w => PPOpts -> GenValue b w -> Eval Doc asciiMode :: PPOpts -> Integer -> Bool integerToChar :: Integer -> Char ppBV :: PPOpts -> BV -> Doc -- | This type class defines a collection of operations on bits and words -- that are necessary to define generic evaluator primitives that operate -- on both concrete and symbolic values uniformly. class BitWord b w | b -> w, w -> b -- | Pretty-print an individual bit ppBit :: BitWord b w => b -> Doc -- | Pretty-print a word value ppWord :: BitWord b w => PPOpts -> w -> Doc -- | Attempt to render a word value as an ASCII character. Return -- Nothing if the character value is unknown (e.g., for symbolic -- values). wordAsChar :: BitWord b w => w -> Maybe Char -- | The number of bits in a word value. wordLen :: BitWord b w => w -> Integer -- | Construct a literal bit value from a boolean. bitLit :: BitWord b w => Bool -> b -- | Construct a literal word value given a bit width and a value. wordLit :: BitWord b w => Integer -> Integer -> w -- | Construct a word value from a finite sequence of bits. NOTE: this -- assumes that the sequence of bits is big-endian and finite, so the -- first element of the list will be the most significant bit. packWord :: BitWord b w => [b] -> w -- | Deconstruct a packed word value in to a finite sequence of bits. NOTE: -- this produces a list of bits that represent a big-endian word, so the -- most significant bit is the first element of the list. unpackWord :: BitWord b w => w -> [b] -- | Concatenate the two given word values. NOTE: the first argument -- represents the more-significant bits joinWord :: BitWord b w => w -> w -> w -- | Take the most-significant bits, and return those bits and the -- remainder. The first element of the pair is the most significant bits. -- The two integer sizes must sum to the length of the given word value. splitWord :: BitWord b w => Integer -> Integer -> w -> (w, w) -- | Extract a subsequence of bits from a packed word value. The first -- integer argument is the number of bits in the resulting word. The -- second integer argument is the number of less-significant digits to -- discard. Stated another way, the operation `extractWord n i w` is -- equivelant to first shifting w right by i bits, and -- then truncating to n bits. extractWord :: BitWord b w => Integer -> Integer -> w -> w -- | 2's complement addition of packed words. The arguments must have equal -- bit width, and the result is of the same width. Overflow is silently -- discarded. wordPlus :: BitWord b w => w -> w -> w -- | 2's complement subtraction of packed words. The arguments must have -- equal bit width, and the result is of the same width. Overflow is -- silently discarded. wordMinus :: BitWord b w => w -> w -> w -- | 2's complement multiplication of packed words. The arguments must have -- equal bit width, and the result is of the same width. The high bits of -- the multiplication are silently discarded. wordMult :: BitWord b w => w -> w -> w -- | This class defines additional operations necessary to define generic -- evaluation functions. class BitWord b w => EvalPrims b w -- | Eval prim binds primitive declarations to the primitive values that -- implement them. evalPrim :: EvalPrims b w => Decl -> GenValue b w -- | ifthenelse operation. Choose either the 'then' value or the -- 'else' value depending on the value of the test bit. iteValue :: EvalPrims b w => b -> Eval (GenValue b w) -> Eval (GenValue b w) -> Eval (GenValue b w) mask :: Integer -> Integer -> Integer -- | Create a packed word of n bits. word :: BitWord b w => Integer -> Integer -> GenValue b w lam :: (Eval (GenValue b w) -> Eval (GenValue b w)) -> GenValue b w -- | Functions that assume word inputs wlam :: BitWord b w => (w -> Eval (GenValue b w)) -> GenValue b w -- | A type lambda that expects a Type. tlam :: (TValue -> GenValue b w) -> GenValue b w -- | A type lambda that expects a Type of kind #. nlam :: (Nat' -> GenValue b w) -> GenValue b w -- | Generate a stream. toStream :: [GenValue b w] -> Eval (GenValue b w) toFinSeq :: BitWord b w => Integer -> TValue -> [GenValue b w] -> GenValue b w -- | This is strict! boolToWord :: [Bool] -> Value -- | Construct either a finite sequence, or a stream. In the finite case, -- record whether or not the elements were bits, to aid pretty-printing. toSeq :: BitWord b w => Nat' -> TValue -> [GenValue b w] -> Eval (GenValue b w) -- | Construct either a finite sequence, or a stream. In the finite case, -- record whether or not the elements were bits, to aid pretty-printing. mkSeq :: Nat' -> TValue -> SeqMap b w -> GenValue b w -- | Extract a bit value. fromVBit :: GenValue b w -> b bitsSeq :: BitWord b w => WordValue b w -> Integer -> Eval b -- | Extract a sequence. fromSeq :: forall b w. BitWord b w => String -> GenValue b w -> Eval (SeqMap b w) fromStr :: Value -> Eval String fromWordVal :: String -> GenValue b w -> Eval (WordValue b w) -- | Extract a packed word. fromVWord :: BitWord b w => String -> GenValue b w -> Eval w vWordLen :: BitWord b w => GenValue b w -> Maybe Integer -- | If the given list of values are all fully-evaluated thunks containing -- bits, return a packed word built from the same bits. However, if any -- value is not a fully-evaluated bit, return Nothing. tryFromBits :: BitWord b w => [Eval (GenValue b w)] -> Maybe w -- | Turn a value into an integer represented by w bits. fromWord :: String -> Value -> Eval Integer -- | Extract a function from a value. fromVFun :: GenValue b w -> (Eval (GenValue b w) -> Eval (GenValue b w)) -- | Extract a polymorphic function from a value. fromVPoly :: GenValue b w -> (TValue -> Eval (GenValue b w)) -- | Extract a polymorphic function from a value. fromVNumPoly :: GenValue b w -> (Nat' -> Eval (GenValue b w)) -- | Extract a tuple from a value. fromVTuple :: GenValue b w -> [Eval (GenValue b w)] -- | Extract a record from a value. fromVRecord :: GenValue b w -> [(Ident, Eval (GenValue b w))] -- | Lookup a field in a record. lookupRecord :: Ident -> GenValue b w -> Eval (GenValue b w) -- | Given an expected type, returns an expression that evaluates to this -- value, if we can determine it. -- -- XXX: View patterns would probably clean up this definition a lot. toExpr :: PrimMap -> Type -> Value -> Eval (Maybe Expr) instance (Control.DeepSeq.NFData w, Control.DeepSeq.NFData b) => Control.DeepSeq.NFData (Cryptol.Eval.Value.GenValue b w) instance GHC.Generics.Generic (Cryptol.Eval.Value.GenValue b w) instance (Control.DeepSeq.NFData b, Control.DeepSeq.NFData w) => Control.DeepSeq.NFData (Cryptol.Eval.Value.WordValue b w) instance GHC.Generics.Generic (Cryptol.Eval.Value.WordValue b w) instance Control.DeepSeq.NFData Cryptol.Eval.Value.BV instance GHC.Generics.Generic Cryptol.Eval.Value.BV instance GHC.Show.Show Cryptol.Eval.Value.BV instance Control.DeepSeq.NFData (Cryptol.Eval.Value.SeqMap b w) instance (GHC.Show.Show b, GHC.Show.Show w) => GHC.Show.Show (Cryptol.Eval.Value.GenValue b w) instance Cryptol.Eval.Value.BitWord GHC.Types.Bool Cryptol.Eval.Value.BV module Cryptol.Eval.Env data GenEvalEnv b w EvalEnv :: !(Map Name (Eval (GenValue b w))) -> !TypeEnv -> GenEvalEnv b w [envVars] :: GenEvalEnv b w -> !(Map Name (Eval (GenValue b w))) [envTypes] :: GenEvalEnv b w -> !TypeEnv ppEnv :: BitWord b w => PPOpts -> GenEvalEnv b w -> Eval Doc -- | Evaluation environment with no bindings emptyEnv :: GenEvalEnv b w -- | Bind a variable in the evaluation environment. bindVar :: Name -> Eval (GenValue b w) -> GenEvalEnv b w -> Eval (GenEvalEnv b w) -- | Bind a variable to a value in the evaluation environment, without -- creating a thunk. bindVarDirect :: Name -> GenValue b w -> GenEvalEnv b w -> Eval (GenEvalEnv b w) -- | Lookup a variable in the environment. lookupVar :: Name -> GenEvalEnv b w -> Maybe (Eval (GenValue b w)) -- | Bind a type variable of kind *. bindType :: TVar -> Either Nat' TValue -> GenEvalEnv b w -> GenEvalEnv b w -- | Lookup a type variable. lookupType :: TVar -> GenEvalEnv b w -> Maybe (Either Nat' TValue) instance (Control.DeepSeq.NFData b, Control.DeepSeq.NFData w) => Control.DeepSeq.NFData (Cryptol.Eval.Env.GenEvalEnv b w) instance GHC.Generics.Generic (Cryptol.Eval.Env.GenEvalEnv b w) instance GHC.Base.Monoid (Cryptol.Eval.Env.GenEvalEnv b w) module Cryptol.Symbolic.Value type SBool = SVal type SWord = SVal literalSWord :: Int -> Integer -> SWord fromBitsLE :: [SBool] -> SWord forallBV_ :: Int -> Symbolic SWord existsBV_ :: Int -> Symbolic SWord forallSBool_ :: Symbolic SBool existsSBool_ :: Symbolic SBool type Value = GenValue SBool SWord -- | An evaluated type of kind *. These types do not contain type -- variables, type synonyms, or type functions. data TValue -- | True if the evaluated value is Bit isTBit :: TValue -> Bool -- | Produce a sequence type value tvSeq :: Nat' -> TValue -> TValue -- | Generic value type, parameterized by bit and word types. -- -- NOTE: we maintain an important invariant regarding sequence types. -- VSeq must never be used for finite sequences of bits. Always -- use the VWord constructor instead! Infinite sequences of bits -- are handled by the VStream constructor, just as for other -- types. data GenValue b w -- |
-- { .. }
--
VRecord :: ![(Ident, Eval (GenValue b w))] -> GenValue b w
-- | -- ( .. ) --VTuple :: ![Eval (GenValue b w)] -> GenValue b w -- |
-- Bit --VBit :: !b -> GenValue b w -- | [n]a Invariant: VSeq is never a sequence of bits VSeq :: !Integer -> !(SeqMap b w) -> GenValue b w -- |
-- [n]Bit --VWord :: !Integer -> !(Eval (WordValue b w)) -> GenValue b w -- |
-- [inf]a --VStream :: !(SeqMap b w) -> GenValue b w -- | functions VFun :: (Eval (GenValue b w) -> Eval (GenValue b w)) -> GenValue b w -- | polymorphic values (kind *) VPoly :: (TValue -> Eval (GenValue b w)) -> GenValue b w -- | polymorphic values (kind #) VNumPoly :: (Nat' -> Eval (GenValue b w)) -> GenValue b w lam :: (Eval (GenValue b w) -> Eval (GenValue b w)) -> GenValue b w -- | A type lambda that expects a Type. tlam :: (TValue -> GenValue b w) -> GenValue b w -- | Generate a stream. toStream :: [GenValue b w] -> Eval (GenValue b w) toFinSeq :: BitWord b w => Integer -> TValue -> [GenValue b w] -> GenValue b w -- | Construct either a finite sequence, or a stream. In the finite case, -- record whether or not the elements were bits, to aid pretty-printing. toSeq :: BitWord b w => Nat' -> TValue -> [GenValue b w] -> Eval (GenValue b w) -- | Extract a bit value. fromVBit :: GenValue b w -> b -- | Extract a function from a value. fromVFun :: GenValue b w -> (Eval (GenValue b w) -> Eval (GenValue b w)) -- | Extract a polymorphic function from a value. fromVPoly :: GenValue b w -> (TValue -> Eval (GenValue b w)) -- | Extract a tuple from a value. fromVTuple :: GenValue b w -> [Eval (GenValue b w)] -- | Extract a record from a value. fromVRecord :: GenValue b w -> [(Ident, Eval (GenValue b w))] -- | Lookup a field in a record. lookupRecord :: Ident -> GenValue b w -> Eval (GenValue b w) -- | Extract a sequence. fromSeq :: forall b w. BitWord b w => String -> GenValue b w -> Eval (SeqMap b w) -- | Extract a packed word. fromVWord :: BitWord b w => String -> GenValue b w -> Eval w evalPanic :: String -> [String] -> a iteSValue :: SBool -> Value -> Value -> Value mergeValue :: Bool -> SBool -> Value -> Value -> Value mergeWord :: Bool -> SBool -> WordValue SBool SWord -> WordValue SBool SWord -> WordValue SBool SWord mergeBit :: Bool -> SBool -> SBool -> SBool -> SBool mergeBits :: Bool -> SBool -> Seq (Eval SBool) -> Seq (Eval SBool) -> Seq (Eval SBool) mergeSeqMap :: Bool -> SBool -> SeqMap SBool SWord -> SeqMap SBool SWord -> SeqMap SBool SWord instance Cryptol.Eval.Value.BitWord Cryptol.Symbolic.Value.SBool Cryptol.Symbolic.Value.SWord module Cryptol.Testing.Concrete -- | A test result is either a pass, a failure due to evaluating to -- False, or a failure due to an exception raised during -- evaluation data TestResult Pass :: TestResult FailFalse :: [Value] -> TestResult FailError :: EvalError -> [Value] -> TestResult isPass :: TestResult -> Bool -- | Apply a testable value to some arguments. Note that this function -- assumes that the values come from a call to testableType (i.e., -- things are type-correct). We run in the IO monad in order to catch any -- EvalErrors. runOneTest :: Value -> [Value] -> IO TestResult -- | Given a (function) type, compute all possible inputs for it. We also -- return the total number of test (i.e., the length of the outer list. testableType :: Type -> Maybe (Integer, [[Value]]) -- | Given a fully-evaluated type, try to compute the number of values in -- it. Returns Nothing for infinite types, user-defined types, -- polymorhic types, and, currently, function spaces. Of course, we can -- easily compute the sizes of function spaces, but we can't easily -- enumerate their inhabitants. typeSize :: Type -> Maybe Integer -- | Returns all the values in a type. Returns an empty list of values, for -- types where typeSize returned Nothing. typeValues :: Type -> [Value] data TestSpec m s TestSpec :: (Integer -> s -> m (TestResult, s)) -> String -> Integer -> Integer -> (Integer -> Integer -> m ()) -> m () -> (TestResult -> m ()) -> m () -> TestSpec m s [testFn] :: TestSpec m s -> Integer -> s -> m (TestResult, s) -- | The property as entered by the user [testProp] :: TestSpec m s -> String [testTotal] :: TestSpec m s -> Integer [testPossible] :: TestSpec m s -> Integer [testRptProgress] :: TestSpec m s -> Integer -> Integer -> m () [testClrProgress] :: TestSpec m s -> m () [testRptFailure] :: TestSpec m s -> TestResult -> m () [testRptSuccess] :: TestSpec m s -> m () data TestReport TestReport :: TestResult -> String -> Integer -> Integer -> TestReport [reportResult] :: TestReport -> TestResult -- | The property as entered by the user [reportProp] :: TestReport -> String [reportTestsRun] :: TestReport -> Integer [reportTestsPossible] :: TestReport -> Integer runTests :: Monad m => TestSpec m s -> s -> m TestReport -- | This module generates random values for Cryptol types. module Cryptol.Testing.Random type Gen g = Integer -> g -> (Value, g) -- | Apply a testable value to some randomly-generated arguments. Returns -- Nothing if the function returned True, or `Just -- counterexample` if it returned False. -- -- Please note that this function assumes that the generators match the -- supplied value, otherwise we'll panic. runOneTest :: RandomGen g => Value -> [Gen g] -> Integer -> g -> IO (TestResult, g) -- | Given a (function) type, compute generators for the function's -- arguments. Currently we do not support polymorphic functions. In -- principle, we could apply these to random types, and test the results. testableType :: RandomGen g => Type -> Maybe [Gen g] -- | A generator for values of the given type. This fails if we are given a -- type that lacks a suitable random value generator. randomValue :: RandomGen g => Type -> Maybe (Gen g) -- | Generate a random bit value. randomBit :: RandomGen g => Gen g -- | Generate a random word of the given length (i.e., a value of type -- [w]) The size parameter is assumed to vary between 1 and 100, -- and we use it to generate smaller numbers first. randomWord :: RandomGen g => Integer -> Gen g -- | Generate a random infinite stream value. randomStream :: RandomGen g => Gen g -> Gen g -- | Generate a random sequence. This should be used for sequences other -- than bits. For sequences of bits use "randomWord". randomSequence :: RandomGen g => Integer -> Gen g -> Gen g -- | Generate a random tuple value. randomTuple :: RandomGen g => [Gen g] -> Gen g -- | Generate a random record value. randomRecord :: RandomGen g => [(Ident, Gen g)] -> Gen g module Cryptol.Prims.Eval primTable :: Map Ident Value -- | Make a numeric constant. ecDemoteV :: BitWord b w => GenValue b w divModPoly :: Integer -> Int -> Integer -> Int -> (Integer, Integer) -- | Create a packed word modExp :: Integer -> BV -> BV -> Eval BV doubleAndAdd :: Integer -> Integer -> Integer -> Integer type Binary b w = TValue -> GenValue b w -> GenValue b w -> Eval (GenValue b w) binary :: Binary b w -> GenValue b w type Unary b w = TValue -> GenValue b w -> Eval (GenValue b w) unary :: Unary b w -> GenValue b w -- | Turn a normal binop on Integers into one that can also deal with a -- bitsize. liftBinArith :: (Integer -> Integer -> Integer) -> BinArith BV -- | Turn a normal binop on Integers into one that can also deal with a -- bitsize. Generate a thunk that throws a divide by 0 error when forced -- if the second argument is 0. liftDivArith :: (Integer -> Integer -> Integer) -> BinArith BV type BinArith w = Integer -> w -> w -> Eval w arithBinary :: forall b w. BitWord b w => BinArith w -> Binary b w type UnaryArith w = Integer -> w -> Eval w liftUnaryArith :: (Integer -> Integer) -> UnaryArith BV arithUnary :: forall b w. BitWord b w => UnaryArith w -> Unary b w lg2 :: Integer -> Integer -- | Lexicographic ordering on two values. lexCompare :: String -> TValue -> Value -> Value -> Eval Ordering zipLexCompare :: String -> [TValue] -> [Eval Value] -> [Eval Value] -> Eval Ordering -- | Process two elements based on their lexicographic ordering. cmpOrder :: String -> (Ordering -> Bool) -> Binary Bool BV withOrder :: String -> (Ordering -> TValue -> Value -> Value -> Value) -> Binary Bool BV maxV :: Ordering -> TValue -> Value -> Value -> Value minV :: Ordering -> TValue -> Value -> Value -> Value funCmp :: (Ordering -> Bool) -> Value zeroV :: forall b w. BitWord b w => TValue -> GenValue b w joinWordVal :: BitWord b w => WordValue b w -> WordValue b w -> WordValue b w joinWords :: forall b w. BitWord b w => Integer -> Integer -> SeqMap b w -> Eval (GenValue b w) joinSeq :: BitWord b w => Nat' -> Integer -> TValue -> SeqMap b w -> Eval (GenValue b w) -- | Join a sequence of sequences into a single sequence. joinV :: BitWord b w => Nat' -> Integer -> TValue -> GenValue b w -> Eval (GenValue b w) splitWordVal :: BitWord b w => Integer -> Integer -> WordValue b w -> (WordValue b w, WordValue b w) splitAtV :: BitWord b w => Nat' -> Nat' -> TValue -> GenValue b w -> Eval (GenValue b w) extractWordVal :: BitWord b w => Integer -> Integer -> WordValue b w -> WordValue b w -- | Split implementation. ecSplitV :: BitWord b w => GenValue b w reverseV :: forall b w. BitWord b w => GenValue b w -> Eval (GenValue b w) transposeV :: BitWord b w => Nat' -> Nat' -> TValue -> GenValue b w -> Eval (GenValue b w) ccatV :: (Show b, Show w, BitWord b w) => Nat' -> Nat' -> TValue -> (GenValue b w) -> (GenValue b w) -> Eval (GenValue b w) wordValLogicOp :: BitWord b w => (b -> b -> b) -> (w -> w -> w) -> WordValue b w -> WordValue b w -> WordValue b w -- | Merge two values given a binop. This is used for and, or and xor. logicBinary :: forall b w. BitWord b w => (b -> b -> b) -> (w -> w -> w) -> Binary b w wordValUnaryOp :: BitWord b w => (b -> b) -> (w -> w) -> WordValue b w -> WordValue b w logicUnary :: forall b w. BitWord b w => (b -> b) -> (w -> w) -> Unary b w logicShift :: (Integer -> Integer -> Integer -> Integer) -> (Integer -> Seq (Eval Bool) -> Integer -> Seq (Eval Bool)) -> (Nat' -> TValue -> SeqValMap -> Integer -> SeqValMap) -> Value shiftLW :: Integer -> Integer -> Integer -> Integer shiftLB :: Integer -> Seq (Eval Bool) -> Integer -> Seq (Eval Bool) shiftLS :: Nat' -> TValue -> SeqValMap -> Integer -> SeqValMap shiftRW :: Integer -> Integer -> Integer -> Integer shiftRB :: Integer -> Seq (Eval Bool) -> Integer -> Seq (Eval Bool) shiftRS :: Nat' -> TValue -> SeqValMap -> Integer -> SeqValMap rotateLW :: Integer -> Integer -> Integer -> Integer rotateLB :: Integer -> Seq (Eval Bool) -> Integer -> Seq (Eval Bool) rotateLS :: Nat' -> TValue -> SeqValMap -> Integer -> SeqValMap rotateRW :: Integer -> Integer -> Integer -> Integer rotateRB :: Integer -> Seq (Eval Bool) -> Integer -> Seq (Eval Bool) rotateRS :: Nat' -> TValue -> SeqValMap -> Integer -> SeqValMap -- | Indexing operations that return one element. indexPrimOne :: BitWord b w => (Maybe Integer -> TValue -> SeqMap b w -> Seq b -> Eval (GenValue b w)) -> (Maybe Integer -> TValue -> SeqMap b w -> w -> Eval (GenValue b w)) -> GenValue b w indexFront :: Maybe Integer -> TValue -> SeqValMap -> BV -> Eval Value indexFront_bits :: Maybe Integer -> TValue -> SeqValMap -> Seq Bool -> Eval Value indexBack :: Maybe Integer -> TValue -> SeqValMap -> BV -> Eval Value indexBack_bits :: Maybe Integer -> TValue -> SeqValMap -> Seq Bool -> Eval Value -- | Indexing operations that return many elements. indexPrimMany :: BitWord b w => (Maybe Integer -> TValue -> SeqMap b w -> Seq b -> Eval (GenValue b w)) -> (Maybe Integer -> TValue -> SeqMap b w -> w -> Eval (GenValue b w)) -> GenValue b w updateFront :: Nat' -> TValue -> SeqMap Bool BV -> WordValue Bool BV -> Eval (GenValue Bool BV) -> Eval (SeqMap Bool BV) updateFront_bits :: Nat' -> TValue -> Seq (Eval Bool) -> WordValue Bool BV -> Eval (GenValue Bool BV) -> Eval (Seq (Eval Bool)) updateBack :: Nat' -> TValue -> SeqMap Bool BV -> WordValue Bool BV -> Eval (GenValue Bool BV) -> Eval (SeqMap Bool BV) updateBack_bits :: Nat' -> TValue -> Seq (Eval Bool) -> WordValue Bool BV -> Eval (GenValue Bool BV) -> Eval (Seq (Eval Bool)) updatePrim :: BitWord b w => (Nat' -> TValue -> Seq (Eval b) -> WordValue b w -> Eval (GenValue b w) -> Eval (Seq (Eval b))) -> (Nat' -> TValue -> SeqMap b w -> WordValue b w -> Eval (GenValue b w) -> Eval (SeqMap b w)) -> GenValue b w fromThenV :: BitWord b w => GenValue b w fromToV :: BitWord b w => GenValue b w fromThenToV :: BitWord b w => GenValue b w infFromV :: BitWord b w => GenValue b w infFromThenV :: BitWord b w => GenValue b w -- | Produce a random value with the given seed. If we do not support -- making values of the given type, return zero of that type. TODO: do -- better than returning zero randomV :: TValue -> Integer -> Value errorV :: forall b w. BitWord b w => TValue -> String -> Eval (GenValue b w) instance Cryptol.Eval.Value.EvalPrims GHC.Types.Bool Cryptol.Eval.Value.BV module Cryptol.Symbolic.Prims traverseSnd :: Functor f => (a -> f b) -> (t, a) -> f (t, b) primTable :: Map Ident Value iteWord :: SBool -> Eval (WordValue SBool SWord) -> Eval (WordValue SBool SWord) -> Eval (WordValue SBool SWord) -- | Barrel-shifter algorithm. Takes a list of bits in big-endian order. shifter :: Monad m => (SBool -> a -> a -> a) -> (a -> Integer -> m a) -> a -> [SBool] -> m a logicShift :: String -> (SWord -> SWord -> SWord) -> (Nat' -> Integer -> Integer -> Maybe Integer) -> Value selectV :: forall a. (SBool -> Eval a -> Eval a -> Eval a) -> WordValue SBool SWord -> (Integer -> Eval a) -> Eval a indexFront :: Maybe Integer -> TValue -> SeqMap SBool SWord -> SWord -> Eval Value indexBack :: Maybe Integer -> TValue -> SeqMap SBool SWord -> SWord -> Eval Value indexFront_bits :: Maybe Integer -> TValue -> SeqMap SBool SWord -> Seq SBool -> Eval Value indexBack_bits :: Maybe Integer -> TValue -> SeqMap SBool SWord -> Seq SBool -> Eval Value updateFrontSym :: Nat' -> TValue -> SeqMap SBool SWord -> WordValue SBool SWord -> Eval (GenValue SBool SWord) -> Eval (SeqMap SBool SWord) updateFrontSym_bits :: Nat' -> TValue -> Seq (Eval SBool) -> WordValue SBool SWord -> Eval (GenValue SBool SWord) -> Eval (Seq (Eval SBool)) updateBackSym :: Nat' -> TValue -> SeqMap SBool SWord -> WordValue SBool SWord -> Eval (GenValue SBool SWord) -> Eval (SeqMap SBool SWord) updateBackSym_bits :: Nat' -> TValue -> Seq (Eval SBool) -> WordValue SBool SWord -> Eval (GenValue SBool SWord) -> Eval (Seq (Eval SBool)) asBitList :: [Eval SBool] -> Maybe [SBool] asWordList :: [WordValue SBool SWord] -> Maybe [SWord] liftBinArith :: (SWord -> SWord -> SWord) -> BinArith SWord sExp :: Integer -> SWord -> SWord -> Eval SWord -- | Ceiling (log_2 x) sLg2 :: Integer -> SWord -> Eval SWord cmpValue :: (SBool -> SBool -> Eval a -> Eval a) -> (SWord -> SWord -> Eval a -> Eval a) -> (Value -> Value -> Eval a -> Eval a) cmpEq :: SWord -> SWord -> Eval SBool -> Eval SBool cmpNotEq :: SWord -> SWord -> Eval SBool -> Eval SBool cmpLt :: SWord -> SWord -> Eval SBool -> Eval SBool cmpGt :: SWord -> SWord -> Eval SBool -> Eval SBool cmpLtEq :: SWord -> SWord -> Eval SBool -> Eval SBool cmpGtEq :: SWord -> SWord -> Eval SBool -> Eval SBool cmpBinary :: (SBool -> SBool -> Eval SBool -> Eval SBool) -> (SWord -> SWord -> Eval SBool -> Eval SBool) -> SBool -> Binary SBool SWord -- | Add two polynomials addPoly :: [SBool] -> [SBool] -> [SBool] ites :: SBool -> [SBool] -> [SBool] -> [SBool] degree :: [SBool] -> Int mdp :: [SBool] -> [SBool] -> ([SBool], [SBool]) nth :: [SBool] -> Int -> SBool divx :: Int -> Int -> [SBool] -> [SBool] -> ([SBool], [SBool]) instance Cryptol.Eval.Value.EvalPrims Cryptol.Symbolic.Value.SBool Cryptol.Symbolic.Value.SWord module Cryptol.Eval -- | Extend the given evaluation environment with all the declarations -- contained in the given module. moduleEnv :: EvalPrims b w => Module -> GenEvalEnv b w -> Eval (GenEvalEnv b w) -- | Execute the given evaluation action. runEval :: Eval a -> IO a -- | The monad for Cryptol evaluation. data Eval a type EvalEnv = GenEvalEnv Bool BV -- | Evaluation environment with no bindings emptyEnv :: GenEvalEnv b w -- | Evaluate a Cryptol expression to a value. This evaluator is -- parameterized by the EvalPrims class, which defines the -- behavior of bits and words, in addition to providing implementations -- for all the primitives. evalExpr :: EvalPrims b w => GenEvalEnv b w -> Expr -> Eval (GenValue b w) -- | Extend the given evaluation environment with the result of evaluating -- the given collection of declaration groups. evalDecls :: EvalPrims b w => [DeclGroup] -> GenEvalEnv b w -> Eval (GenEvalEnv b w) -- | Data type describing errors that can occur during evaluation. data EvalError -- | Out-of-bounds index InvalidIndex :: Integer -> EvalError -- | Non-numeric type passed to demote function TypeCannotBeDemoted :: Type -> EvalError -- | Division or modulus by 0 DivideByZero :: EvalError -- | Bitvector too large WordTooWide :: Integer -> EvalError -- | Call to the Cryptol error primitive UserError :: String -> EvalError -- | Detectable nontermination LoopError :: String -> EvalError -- | Force the evaluation of a value forceValue :: GenValue b w -> Eval () instance GHC.Base.Monoid (Cryptol.Eval.ListEnv b w) module Cryptol.ModuleSystem.Env data ModuleEnv ModuleEnv :: LoadedModules -> NameSeeds -> EvalEnv -> Maybe ModName -> [FilePath] -> DynamicEnv -> !Bool -> SolverConfig -> CoreLint -> !Supply -> ModuleEnv [meLoadedModules] :: ModuleEnv -> LoadedModules [meNameSeeds] :: ModuleEnv -> NameSeeds [meEvalEnv] :: ModuleEnv -> EvalEnv [meFocusedModule] :: ModuleEnv -> Maybe ModName [meSearchPath] :: ModuleEnv -> [FilePath] [meDynEnv] :: ModuleEnv -> DynamicEnv [meMonoBinds] :: ModuleEnv -> !Bool [meSolverConfig] :: ModuleEnv -> SolverConfig [meCoreLint] :: ModuleEnv -> CoreLint [meSupply] :: ModuleEnv -> !Supply data CoreLint -- | Don't run core lint NoCoreLint :: CoreLint -- | Run core lint CoreLint :: CoreLint resetModuleEnv :: ModuleEnv -> ModuleEnv initialModuleEnv :: IO ModuleEnv -- | Try to focus a loaded module in the module environment. focusModule :: ModName -> ModuleEnv -> Maybe ModuleEnv -- | Get a list of all the loaded modules. Each module in the resulting -- list depends only on other modules that precede it. loadedModules :: ModuleEnv -> [Module] -- | Produce an ifaceDecls that represents the focused environment of the -- module system, as well as a NameDisp for pretty-printing names -- according to the imports. -- -- XXX This could really do with some better error handling, just -- returning mempty when one of the imports fails isn't really desirable. focusedEnv :: ModuleEnv -> (IfaceDecls, NamingEnv, NameDisp) -- | The unqualified declarations and name environment for the dynamic -- environment. dynamicEnv :: ModuleEnv -> (IfaceDecls, NamingEnv, NameDisp) -- | Retrieve all IfaceDecls referenced by a module, as well as all -- of its public and private declarations, checking expressions qualifiedEnv :: ModuleEnv -> IfaceDecls -- | Invariant: All the dependencies of any module m must precede -- m in the list. newtype LoadedModules LoadedModules :: [LoadedModule] -> LoadedModules [getLoadedModules] :: LoadedModules -> [LoadedModule] data LoadedModule LoadedModule :: ModName -> FilePath -> FilePath -> Iface -> Module -> LoadedModule [lmName] :: LoadedModule -> ModName -- | The file path used to load this module (may not be canonical) [lmFilePath] :: LoadedModule -> FilePath -- | The canonical version of the path of this module [lmCanonicalPath] :: LoadedModule -> FilePath [lmInterface] :: LoadedModule -> Iface [lmModule] :: LoadedModule -> Module isLoaded :: ModName -> LoadedModules -> Bool lookupModule :: ModName -> ModuleEnv -> Maybe LoadedModule addLoadedModule :: FilePath -> FilePath -> Module -> LoadedModules -> LoadedModules removeLoadedModule :: FilePath -> LoadedModules -> LoadedModules -- | Extra information we need to carry around to dynamically extend an -- environment outside the context of a single module. Particularly -- useful when dealing with interactive declarations as in :let -- or it. data DynamicEnv DEnv :: NamingEnv -> [DeclGroup] -> EvalEnv -> DynamicEnv [deNames] :: DynamicEnv -> NamingEnv [deDecls] :: DynamicEnv -> [DeclGroup] [deEnv] :: DynamicEnv -> EvalEnv -- | Build IfaceDecls that correspond to all of the bindings in the -- dynamic environment. -- -- XXX: if we ever add type synonyms or newtypes at the REPL, revisit -- this. deIfaceDecls :: DynamicEnv -> IfaceDecls instance Control.DeepSeq.NFData Cryptol.ModuleSystem.Env.ModuleEnv instance GHC.Generics.Generic Cryptol.ModuleSystem.Env.ModuleEnv instance Control.DeepSeq.NFData Cryptol.ModuleSystem.Env.DynamicEnv instance GHC.Generics.Generic Cryptol.ModuleSystem.Env.DynamicEnv instance Control.DeepSeq.NFData Cryptol.ModuleSystem.Env.LoadedModules instance GHC.Generics.Generic Cryptol.ModuleSystem.Env.LoadedModules instance GHC.Show.Show Cryptol.ModuleSystem.Env.LoadedModules instance Control.DeepSeq.NFData Cryptol.ModuleSystem.Env.LoadedModule instance GHC.Generics.Generic Cryptol.ModuleSystem.Env.LoadedModule instance GHC.Show.Show Cryptol.ModuleSystem.Env.LoadedModule instance Control.DeepSeq.NFData Cryptol.ModuleSystem.Env.CoreLint instance GHC.Generics.Generic Cryptol.ModuleSystem.Env.CoreLint instance GHC.Base.Monoid Cryptol.ModuleSystem.Env.LoadedModules instance GHC.Base.Monoid Cryptol.ModuleSystem.Env.DynamicEnv module Cryptol.ModuleSystem.Monad data ImportSource FromModule :: ModName -> ImportSource FromImport :: (Located Import) -> ImportSource importedModule :: ImportSource -> ModName data ModuleError -- | Unable to find the module given, tried looking in these paths ModuleNotFound :: ModName -> [FilePath] -> ModuleError -- | Unable to open a file CantFindFile :: FilePath -> ModuleError -- | Some other IO error occurred while reading this file OtherIOError :: FilePath -> IOException -> ModuleError -- | Generated this parse error when parsing the file for module m ModuleParseError :: FilePath -> ParseError -> ModuleError -- | Recursive module group discovered RecursiveModules :: [ImportSource] -> ModuleError -- | Problems during the renaming phase RenamerErrors :: ImportSource -> [RenamerError] -> ModuleError -- | Problems during the NoPat phase NoPatErrors :: ImportSource -> [Error] -> ModuleError -- | Problems during the NoInclude phase NoIncludeErrors :: ImportSource -> [IncludeError] -> ModuleError -- | Problems during type checking TypeCheckingFailed :: ImportSource -> [(Range, Error)] -> ModuleError -- | Problems after type checking, eg. specialization OtherFailure :: String -> ModuleError -- | Module loaded by 'import' statement has the wrong module name ModuleNameMismatch :: ModName -> (Located ModName) -> ModuleError -- | Two modules loaded from different files have the same module name DuplicateModuleName :: ModName -> FilePath -> FilePath -> ModuleError moduleNotFound :: ModName -> [FilePath] -> ModuleM a cantFindFile :: FilePath -> ModuleM a otherIOError :: FilePath -> IOException -> ModuleM a moduleParseError :: FilePath -> ParseError -> ModuleM a recursiveModules :: [ImportSource] -> ModuleM a renamerErrors :: [RenamerError] -> ModuleM a noPatErrors :: [Error] -> ModuleM a noIncludeErrors :: [IncludeError] -> ModuleM a typeCheckingFailed :: [(Range, Error)] -> ModuleM a moduleNameMismatch :: ModName -> Located ModName -> ModuleM a duplicateModuleName :: ModName -> FilePath -> FilePath -> ModuleM a data ModuleWarning TypeCheckWarnings :: [(Range, Warning)] -> ModuleWarning RenamerWarnings :: [RenamerWarning] -> ModuleWarning warn :: [ModuleWarning] -> ModuleM () typeCheckWarnings :: [(Range, Warning)] -> ModuleM () renamerWarnings :: [RenamerWarning] -> ModuleM () data RO RO :: [ImportSource] -> RO [roLoading] :: RO -> [ImportSource] emptyRO :: RO newtype ModuleT m a ModuleT :: ReaderT RO (StateT ModuleEnv (ExceptionT ModuleError (WriterT [ModuleWarning] m))) a -> ModuleT m a [unModuleT] :: ModuleT m a -> ReaderT RO (StateT ModuleEnv (ExceptionT ModuleError (WriterT [ModuleWarning] m))) a runModuleT :: Monad m => ModuleEnv -> ModuleT m a -> m (Either ModuleError (a, ModuleEnv), [ModuleWarning]) type ModuleM = ModuleT IO runModuleM :: ModuleEnv -> ModuleM a -> IO (Either ModuleError (a, ModuleEnv), [ModuleWarning]) io :: BaseM m IO => IO a -> ModuleT m a getModuleEnv :: Monad m => ModuleT m ModuleEnv setModuleEnv :: Monad m => ModuleEnv -> ModuleT m () modifyModuleEnv :: Monad m => (ModuleEnv -> ModuleEnv) -> ModuleT m () isLoaded :: ModName -> ModuleM Bool loadingImport :: Located Import -> ModuleM a -> ModuleM a loadingModule :: ModName -> ModuleM a -> ModuleM a -- | Push an "interactive" context onto the loading stack. A bit of a hack, -- as it uses a faked module name interactive :: ModuleM a -> ModuleM a loading :: ImportSource -> ModuleM a -> ModuleM a -- | Get the currently focused import source. getImportSource :: ModuleM ImportSource getIface :: ModName -> ModuleM Iface getNameSeeds :: ModuleM NameSeeds getSupply :: ModuleM Supply getMonoBinds :: ModuleM Bool setMonoBinds :: Bool -> ModuleM () setNameSeeds :: NameSeeds -> ModuleM () setSupply :: Supply -> ModuleM () -- | Remove a module from the set of loaded module, by its path. unloadModule :: FilePath -> ModuleM () loadedModule :: FilePath -> FilePath -> Module -> ModuleM () modifyEvalEnv :: (EvalEnv -> Eval EvalEnv) -> ModuleM () getEvalEnv :: ModuleM EvalEnv getFocusedModule :: ModuleM (Maybe ModName) setFocusedModule :: ModName -> ModuleM () getSearchPath :: ModuleM [FilePath] -- | Run a ModuleM action in a context with a prepended search path. -- Useful for temporarily looking in other places while resolving -- imports, for example. withPrependedSearchPath :: [FilePath] -> ModuleM a -> ModuleM a getFocusedEnv :: ModuleM (IfaceDecls, NamingEnv, NameDisp) getQualifiedEnv :: ModuleM IfaceDecls getDynEnv :: ModuleM DynamicEnv setDynEnv :: DynamicEnv -> ModuleM () setSolver :: SolverConfig -> ModuleM () getSolverConfig :: ModuleM SolverConfig instance Control.DeepSeq.NFData Cryptol.ModuleSystem.Monad.ModuleWarning instance GHC.Generics.Generic Cryptol.ModuleSystem.Monad.ModuleWarning instance GHC.Show.Show Cryptol.ModuleSystem.Monad.ModuleWarning instance GHC.Show.Show Cryptol.ModuleSystem.Monad.ModuleError instance Control.DeepSeq.NFData Cryptol.ModuleSystem.Monad.ImportSource instance GHC.Generics.Generic Cryptol.ModuleSystem.Monad.ImportSource instance GHC.Show.Show Cryptol.ModuleSystem.Monad.ImportSource instance GHC.Classes.Eq Cryptol.ModuleSystem.Monad.ImportSource instance Cryptol.Utils.PP.PP Cryptol.ModuleSystem.Monad.ImportSource instance Control.DeepSeq.NFData Cryptol.ModuleSystem.Monad.ModuleError instance Cryptol.Utils.PP.PP Cryptol.ModuleSystem.Monad.ModuleError instance Cryptol.Utils.PP.PP Cryptol.ModuleSystem.Monad.ModuleWarning instance GHC.Base.Monad m => GHC.Base.Functor (Cryptol.ModuleSystem.Monad.ModuleT m) instance GHC.Base.Monad m => GHC.Base.Applicative (Cryptol.ModuleSystem.Monad.ModuleT m) instance GHC.Base.Monad m => GHC.Base.Monad (Cryptol.ModuleSystem.Monad.ModuleT m) instance MonadLib.MonadT Cryptol.ModuleSystem.Monad.ModuleT instance GHC.Base.Monad m => Cryptol.ModuleSystem.Name.FreshM (Cryptol.ModuleSystem.Monad.ModuleT m) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Cryptol.ModuleSystem.Monad.ModuleT m) module Cryptol.ModuleSystem.Base rename :: ModName -> NamingEnv -> RenameM a -> ModuleM a -- | Rename a module in the context of its imported modules. renameModule :: Module PName -> ModuleM (IfaceDecls, NamingEnv, Module Name) -- | Run the noPat pass. noPat :: RemovePatterns a => a -> ModuleM a parseModule :: FilePath -> ModuleM (Module PName) -- | Load a module by its path. loadModuleByPath :: FilePath -> ModuleM Module -- | Load the module specified by an import. loadImport :: Located Import -> ModuleM () -- | Load dependencies, typecheck, and add to the eval environment. loadModule :: FilePath -> Module PName -> ModuleM Module -- | Rewrite an import declaration to be of the form: -- --
-- import foo as foo [ [hiding] (a,b,c) ] --fullyQualified :: Import -> Import -- | Find the interface referenced by an import, and generate the naming -- environment that it describes. importIface :: Import -> ModuleM (IfaceDecls, NamingEnv) -- | Load a series of interfaces, merging their public interfaces. importIfaces :: [Import] -> ModuleM (IfaceDecls, NamingEnv) moduleFile :: ModName -> String -> FilePath -- | Discover a module. findModule :: ModName -> ModuleM FilePath -- | Discover a file. This is distinct from findModule in that we -- assume we've already been given a particular file name. findFile :: FilePath -> ModuleM FilePath -- | Add the prelude to the import list if it's not already mentioned. addPrelude :: Module PName -> Module PName -- | Load the dependencies of a module into the environment. loadDeps :: Module name -> ModuleM () -- | Load the local environment, which consists of the environment for the -- currently opened module, shadowed by the dynamic environment. getLocalEnv :: ModuleM (IfaceDecls, NamingEnv) -- | Typecheck a single expression, yielding a renamed parsed expression, -- typechecked core expression, and a type schema. checkExpr :: Expr PName -> ModuleM (Expr Name, Expr, Schema) -- | Typecheck a group of declarations. -- -- INVARIANT: This assumes that NoPat has already been run on the -- declarations. checkDecls :: [TopDecl PName] -> ModuleM (NamingEnv, [DeclGroup]) -- | Generate the primitive map. If the prelude is currently being loaded, -- this should be generated directly from the naming environment given to -- the renamer instead. getPrimMap :: ModuleM PrimMap -- | Typecheck a module. checkModule :: FilePath -> Module PName -> ModuleM Module data TCLinter o TCLinter :: (o -> InferInput -> Either Error [ProofObligation]) -> Maybe ModName -> TCLinter o [lintCheck] :: TCLinter o -> o -> InferInput -> Either Error [ProofObligation] [lintModule] :: TCLinter o -> Maybe ModName exprLinter :: TCLinter (Expr, Schema) declsLinter :: TCLinter [DeclGroup] moduleLinter :: ModName -> TCLinter Module data TCAction i o TCAction :: (i -> InferInput -> IO (InferOutput o)) -> TCLinter o -> PrimMap -> TCAction i o [tcAction] :: TCAction i o -> i -> InferInput -> IO (InferOutput o) [tcLinter] :: TCAction i o -> TCLinter o [tcPrims] :: TCAction i o -> PrimMap typecheck :: (Show i, Show o, HasLoc i) => TCAction i o -> i -> IfaceDecls -> ModuleM o -- | Generate input for the typechecker. genInferInput :: Range -> PrimMap -> IfaceDecls -> ModuleM InferInput evalExpr :: Expr -> ModuleM Value evalDecls :: [DeclGroup] -> ModuleM () module Cryptol.ModuleSystem data ModuleEnv ModuleEnv :: LoadedModules -> NameSeeds -> EvalEnv -> Maybe ModName -> [FilePath] -> DynamicEnv -> !Bool -> SolverConfig -> CoreLint -> !Supply -> ModuleEnv [meLoadedModules] :: ModuleEnv -> LoadedModules [meNameSeeds] :: ModuleEnv -> NameSeeds [meEvalEnv] :: ModuleEnv -> EvalEnv [meFocusedModule] :: ModuleEnv -> Maybe ModName [meSearchPath] :: ModuleEnv -> [FilePath] [meDynEnv] :: ModuleEnv -> DynamicEnv [meMonoBinds] :: ModuleEnv -> !Bool [meSolverConfig] :: ModuleEnv -> SolverConfig [meCoreLint] :: ModuleEnv -> CoreLint [meSupply] :: ModuleEnv -> !Supply initialModuleEnv :: IO ModuleEnv -- | Extra information we need to carry around to dynamically extend an -- environment outside the context of a single module. Particularly -- useful when dealing with interactive declarations as in :let -- or it. data DynamicEnv DEnv :: NamingEnv -> [DeclGroup] -> EvalEnv -> DynamicEnv [deNames] :: DynamicEnv -> NamingEnv [deDecls] :: DynamicEnv -> [DeclGroup] [deEnv] :: DynamicEnv -> EvalEnv data ModuleError -- | Unable to find the module given, tried looking in these paths ModuleNotFound :: ModName -> [FilePath] -> ModuleError -- | Unable to open a file CantFindFile :: FilePath -> ModuleError -- | Some other IO error occurred while reading this file OtherIOError :: FilePath -> IOException -> ModuleError -- | Generated this parse error when parsing the file for module m ModuleParseError :: FilePath -> ParseError -> ModuleError -- | Recursive module group discovered RecursiveModules :: [ImportSource] -> ModuleError -- | Problems during the renaming phase RenamerErrors :: ImportSource -> [RenamerError] -> ModuleError -- | Problems during the NoPat phase NoPatErrors :: ImportSource -> [Error] -> ModuleError -- | Problems during the NoInclude phase NoIncludeErrors :: ImportSource -> [IncludeError] -> ModuleError -- | Problems during type checking TypeCheckingFailed :: ImportSource -> [(Range, Error)] -> ModuleError -- | Problems after type checking, eg. specialization OtherFailure :: String -> ModuleError -- | Module loaded by 'import' statement has the wrong module name ModuleNameMismatch :: ModName -> (Located ModName) -> ModuleError -- | Two modules loaded from different files have the same module name DuplicateModuleName :: ModName -> FilePath -> FilePath -> ModuleError data ModuleWarning TypeCheckWarnings :: [(Range, Warning)] -> ModuleWarning RenamerWarnings :: [RenamerWarning] -> ModuleWarning type ModuleCmd a = ModuleEnv -> IO (ModuleRes a) type ModuleRes a = (Either ModuleError (a, ModuleEnv), [ModuleWarning]) -- | Find the file associated with a module name in the module search path. findModule :: ModName -> ModuleCmd FilePath -- | Load the module contained in the given file. loadModuleByPath :: FilePath -> ModuleCmd Module -- | Load the given parsed module. loadModule :: FilePath -> Module PName -> ModuleCmd Module -- | Check the type of an expression. Give back the renamed expression, the -- core expression, and its type schema. checkExpr :: Expr PName -> ModuleCmd (Expr Name, Expr, Schema) -- | Evaluate an expression. evalExpr :: Expr -> ModuleCmd Value -- | Typecheck top-level declarations. checkDecls :: [TopDecl PName] -> ModuleCmd (NamingEnv, [DeclGroup]) -- | Evaluate declarations and add them to the extended environment. evalDecls :: [DeclGroup] -> ModuleCmd () noPat :: RemovePatterns a => a -> ModuleCmd a -- | Produce an ifaceDecls that represents the focused environment of the -- module system, as well as a NameDisp for pretty-printing names -- according to the imports. -- -- XXX This could really do with some better error handling, just -- returning mempty when one of the imports fails isn't really desirable. focusedEnv :: ModuleEnv -> (IfaceDecls, NamingEnv, NameDisp) getPrimMap :: ModuleCmd PrimMap renameVar :: NamingEnv -> PName -> ModuleCmd Name renameType :: NamingEnv -> PName -> ModuleCmd Name -- | The resulting interface generated by a module that has been -- typechecked. data Iface Iface :: !ModName -> IfaceDecls -> IfaceDecls -> Iface [ifModName] :: Iface -> !ModName [ifPublic] :: Iface -> IfaceDecls [ifPrivate] :: Iface -> IfaceDecls data IfaceDecls IfaceDecls :: Map Name IfaceTySyn -> Map Name IfaceNewtype -> Map Name IfaceDecl -> IfaceDecls [ifTySyns] :: IfaceDecls -> Map Name IfaceTySyn [ifNewtypes] :: IfaceDecls -> Map Name IfaceNewtype [ifDecls] :: IfaceDecls -> Map Name IfaceDecl -- | Generate an Iface from a typechecked module. genIface :: Module -> Iface type IfaceTySyn = TySyn data IfaceDecl IfaceDecl :: !Name -> Schema -> [Pragma] -> Bool -> Maybe Fixity -> Maybe String -> IfaceDecl [ifDeclName] :: IfaceDecl -> !Name [ifDeclSig] :: IfaceDecl -> Schema [ifDeclPragmas] :: IfaceDecl -> [Pragma] [ifDeclInfix] :: IfaceDecl -> Bool [ifDeclFixity] :: IfaceDecl -> Maybe Fixity [ifDeclDoc] :: IfaceDecl -> Maybe String module Cryptol.Eval.Reference -- | Value type for the reference evaluator. data Value -- | Bit booleans VBit :: (Either EvalError Bool) -> Value -- | [n]a finite or infinite lists VList :: [Value] -> Value -- | ( .. ) tuples VTuple :: [Value] -> Value -- | { .. } records VRecord :: [(Ident, Value)] -> Value -- | functions VFun :: (Value -> Value) -> Value -- | polymorphic values (kind *) VPoly :: (TValue -> Value) -> Value -- | polymorphic values (kind #) VNumPoly :: (Nat' -> Value) -> Value evaluate :: Expr -> ModuleCmd Value ppValue :: Value -> Doc instance GHC.Base.Monoid Cryptol.Eval.Reference.Env module Cryptol.Transform.Specialize -- | A Name should have an entry in the SpecCache iff it is specializable. -- Each Name starts out with an empty TypesMap. type SpecCache = Map Name (Decl, TypesMap (Name, Maybe Decl)) -- | The specializer monad. type SpecT m a = StateT SpecCache (ModuleT m) a type SpecM a = SpecT IO a runSpecT :: SpecCache -> SpecT m a -> ModuleT m (a, SpecCache) liftSpecT :: Monad m => ModuleT m a -> SpecT m a getSpecCache :: Monad m => SpecT m SpecCache setSpecCache :: Monad m => SpecCache -> SpecT m () modifySpecCache :: Monad m => (SpecCache -> SpecCache) -> SpecT m () modify :: StateM m s => (s -> s) -> m () -- | Add a `where` clause to the given expression containing -- type-specialized versions of all functions called (transitively) by -- the body of the expression. specialize :: Expr -> ModuleCmd Expr specializeExpr :: Expr -> SpecM Expr specializeMatch :: Match -> SpecM Match -- | Add the declarations to the SpecCache, run the given monadic action, -- and then pull the specialized declarations back out of the SpecCache -- state. Return the result along with the declarations and a table of -- names of specialized bindings. withDeclGroups :: [DeclGroup] -> SpecM a -> SpecM (a, [DeclGroup], Map Name (TypesMap Name)) -- | Compute the specialization of `EWhere e dgs`. A decl within -- dgs is replicated once for each monomorphic type instance at -- which it is used; decls not mentioned in e (even monomorphic -- ones) are simply dropped. specializeEWhere :: Expr -> [DeclGroup] -> SpecM Expr -- | Transform the given declaration groups into a set of monomorphic -- declarations. All of the original declarations with monomorphic types -- are kept; additionally the result set includes instantiated versions -- of polymorphic decls that are referenced by the monomorphic bindings. -- We also return a map relating generated names to the names from the -- original declarations. specializeDeclGroups :: [DeclGroup] -> SpecM ([DeclGroup], Map Name (TypesMap Name)) specializeConst :: Expr -> SpecM Expr destEProofApps :: Expr -> (Expr, Int) destETApps :: Expr -> (Expr, [Type]) destEProofAbs :: Expr -> ([Prop], Expr) destETAbs :: Expr -> ([TParam], Expr) -- | Freshen a name by giving it a new unique. freshName :: Name -> [Type] -> SpecM Name instantiateSchema :: [Type] -> Int -> Schema -> SpecM Schema -- | Reduce `length ts` outermost type abstractions and n proof -- abstractions. instantiateExpr :: [Type] -> Int -> Expr -> SpecM Expr allDeclGroups :: ModuleEnv -> [DeclGroup] allLoadedModules :: ModuleEnv -> [LoadedModule] allPublicNames :: ModuleEnv -> [Name] traverseSnd :: Functor f => (b -> f c) -> (a, b) -> f (a, c) module Cryptol.Symbolic type EvalEnv = GenEvalEnv SBool SWord proverConfigs :: [(String, SMTConfig)] proverNames :: [String] lookupProver :: String -> SMTConfig type SatResult = [(Type, Expr, Value)] data SatNum AllSat :: SatNum SomeSat :: Int -> SatNum data QueryType SatQuery :: SatNum -> QueryType ProveQuery :: QueryType data ProverCommand ProverCommand :: QueryType -> String -> Bool -> !(IORef ProverStats) -> [DeclGroup] -> Maybe FilePath -> Expr -> Schema -> ProverCommand -- | The type of query to run [pcQueryType] :: ProverCommand -> QueryType -- | Which prover to use (one of the strings in proverConfigs) [pcProverName] :: ProverCommand -> String -- | Verbosity flag passed to SBV [pcVerbose] :: ProverCommand -> Bool -- | Record timing information here [pcProverStats] :: ProverCommand -> !(IORef ProverStats) -- | Extra declarations to bring into scope for symbolic simulation [pcExtraDecls] :: ProverCommand -> [DeclGroup] -- | Optionally output the SMTLIB query to a file [pcSmtFile] :: ProverCommand -> Maybe FilePath -- | The typechecked expression to evaluate [pcExpr] :: ProverCommand -> Expr -- | The Schema of pcExpr [pcSchema] :: ProverCommand -> Schema type ProverStats = NominalDiffTime -- | A prover result is either an error message, an empty result (eg for -- the offline prover), a counterexample or a lazy list of satisfying -- assignments. data ProverResult AllSatResult :: [SatResult] -> ProverResult ThmResult :: [Type] -> ProverResult EmptyResult :: ProverResult ProverError :: String -> ProverResult satSMTResults :: SatResult -> [SMTResult] allSatSMTResults :: AllSatResult -> [SMTResult] thmSMTResults :: ThmResult -> [SMTResult] proverError :: String -> ModuleCmd (Maybe Solver, ProverResult) satProve :: ProverCommand -> ModuleCmd (Maybe Solver, ProverResult) satProveOffline :: ProverCommand -> ModuleCmd (Either String String) protectStack :: (String -> ModuleCmd a) -> ModuleCmd a -> ModuleCmd a parseValues :: [FinType] -> [CW] -> ([Value], [CW]) parseValue :: FinType -> [CW] -> (Value, [CW]) allDeclGroups :: ModuleEnv -> [DeclGroup] data FinType FTBit :: FinType FTSeq :: Int -> FinType -> FinType FTTuple :: [FinType] -> FinType FTRecord :: [(Ident, FinType)] -> FinType numType :: Integer -> Maybe Int finType :: TValue -> Maybe FinType unFinType :: FinType -> Type predArgTypes :: Schema -> Either String [FinType] forallFinType :: FinType -> Symbolic Value existsFinType :: FinType -> Symbolic Value instance GHC.Show.Show Cryptol.Symbolic.QueryType instance GHC.Show.Show Cryptol.Symbolic.SatNum module Cryptol.REPL.Monad -- | REPL_ context with InputT handling. newtype REPL a REPL :: (IORef RW -> IO a) -> REPL a [unREPL] :: REPL a -> IORef RW -> IO a -- | Run a REPL action with a fresh environment. runREPL :: Bool -> REPL a -> IO a io :: IO a -> REPL a -- | Raise an exception. raise :: REPLException -> REPL a stop :: REPL () catch :: REPL a -> (REPLException -> REPL a) -> REPL a -- | Use the configured output action to print a string with a trailing -- newline rPutStrLn :: String -> REPL () -- | Use the configured output action to print a string rPutStr :: String -> REPL () -- | Use the configured output action to print something using its Show -- instance rPrint :: Show a => a -> REPL () -- | REPL exceptions. data REPLException ParseError :: ParseError -> REPLException FileNotFound :: FilePath -> REPLException DirectoryNotFound :: FilePath -> REPLException NoPatError :: [Error] -> REPLException NoIncludeError :: [IncludeError] -> REPLException EvalError :: EvalError -> REPLException ModuleSystemError :: NameDisp -> ModuleError -> REPLException EvalPolyError :: Schema -> REPLException TypeNotTestable :: Type -> REPLException rethrowEvalError :: IO a -> IO a getFocusedEnv :: REPL (IfaceDecls, NamingEnv, NameDisp) getModuleEnv :: REPL ModuleEnv setModuleEnv :: ModuleEnv -> REPL () getDynEnv :: REPL DynamicEnv setDynEnv :: DynamicEnv -> REPL () -- | Given an existing qualified name, prefix it with a relatively-unique -- string. We make it unique by prefixing with a character # -- that is not lexically valid in a module name. uniqify :: Name -> REPL Name -- | Generate a fresh name using the given index. The name will reside -- within the "interactive" namespace. freshName :: Ident -> REPL Name getTSyns :: REPL (Map Name TySyn) getNewtypes :: REPL (Map Name Newtype) getVars :: REPL (Map Name IfaceDecl) whenDebug :: REPL () -> REPL () -- | Get visible variable names. getExprNames :: REPL [String] -- | Get visible type signature names. getTypeNames :: REPL [String] -- | Return a list of property names, sorted by position in the file. getPropertyNames :: REPL ([Name], NameDisp) data LoadedModule LoadedModule :: Maybe ModName -> FilePath -> LoadedModule -- | Focused module [lName] :: LoadedModule -> Maybe ModName -- | Focused file [lPath] :: LoadedModule -> FilePath getLoadedMod :: REPL (Maybe LoadedModule) -- | Set the name of the currently focused file, edited by :e and -- loaded via :r. setLoadedMod :: LoadedModule -> REPL () setSearchPath :: [FilePath] -> REPL () prependSearchPath :: [FilePath] -> REPL () -- | Construct the prompt for the current environment. getPrompt :: REPL String shouldContinue :: REPL Bool unlessBatch :: REPL () -> REPL () -- | Run a computation in batch mode, restoring the previous isBatch flag -- afterwards asBatch :: REPL a -> REPL a disableLet :: REPL () enableLet :: REPL () -- | Are let-bindings enabled in this REPL? getLetEnabled :: REPL Bool -- | Update the title updateREPLTitle :: REPL () -- | Set the function that will be called when updating the title setUpdateREPLTitle :: REPL () -> REPL () data EnvVal EnvString :: String -> EnvVal EnvProg :: String -> [String] -> EnvVal EnvNum :: !Int -> EnvVal EnvBool :: Bool -> EnvVal data OptionDescr OptionDescr :: String -> EnvVal -> (EnvVal -> IO (Maybe String)) -> String -> (EnvVal -> REPL ()) -> OptionDescr [optName] :: OptionDescr -> String [optDefault] :: OptionDescr -> EnvVal [optCheck] :: OptionDescr -> EnvVal -> IO (Maybe String) [optHelp] :: OptionDescr -> String [optEff] :: OptionDescr -> EnvVal -> REPL () -- | Set a user option. setUser :: String -> String -> REPL () -- | Get a user option, when it's known to exist. Fail with panic when it -- doesn't. getUser :: String -> REPL EnvVal -- | Get a user option, using Maybe for failure. tryGetUser :: String -> REPL (Maybe EnvVal) userOptions :: OptionMap getUserSatNum :: REPL SatNum getUserShowProverStats :: REPL Bool -- | Get the REPL's string-printer getPutStr :: REPL (String -> IO ()) -- | Set the REPL's string-printer setPutStr :: (String -> IO ()) -> REPL () smokeTest :: REPL [Smoke] data Smoke Z3NotFound :: Smoke instance GHC.Classes.Eq Cryptol.REPL.Monad.Smoke instance GHC.Show.Show Cryptol.REPL.Monad.Smoke instance GHC.Show.Show Cryptol.REPL.Monad.EnvVal instance GHC.Show.Show Cryptol.REPL.Monad.REPLException instance GHC.Base.Functor Cryptol.REPL.Monad.REPL instance GHC.Base.Applicative Cryptol.REPL.Monad.REPL instance GHC.Base.Monad Cryptol.REPL.Monad.REPL instance Control.Monad.IO.Class.MonadIO Cryptol.REPL.Monad.REPL instance Control.Monad.Base.MonadBase GHC.Types.IO Cryptol.REPL.Monad.REPL instance Control.Monad.Trans.Control.MonadBaseControl GHC.Types.IO Cryptol.REPL.Monad.REPL instance Cryptol.ModuleSystem.Name.FreshM Cryptol.REPL.Monad.REPL instance GHC.Exception.Exception Cryptol.REPL.Monad.REPLException instance Cryptol.Utils.PP.PP Cryptol.REPL.Monad.REPLException instance Cryptol.Utils.PP.PP Cryptol.REPL.Monad.Smoke module Cryptol.REPL.Command -- | Commands. data Command -- | Successfully parsed command Command :: (REPL ()) -> Command -- | Ambiguous command, list of conflicting commands Ambiguous :: String -> [String] -> Command -- | The unknown command Unknown :: String -> Command -- | Command builder. data CommandDescr CommandDescr :: [String] -> CommandBody -> String -> CommandDescr [cNames] :: CommandDescr -> [String] [cBody] :: CommandDescr -> CommandBody [cHelp] :: CommandDescr -> String data CommandBody ExprArg :: (String -> REPL ()) -> CommandBody FileExprArg :: (FilePath -> String -> REPL ()) -> CommandBody DeclsArg :: (String -> REPL ()) -> CommandBody ExprTypeArg :: (String -> REPL ()) -> CommandBody FilenameArg :: (FilePath -> REPL ()) -> CommandBody OptionArg :: (String -> REPL ()) -> CommandBody ShellArg :: (String -> REPL ()) -> CommandBody NoArg :: (REPL ()) -> CommandBody data CommandExitCode CommandOk :: CommandExitCode CommandError :: CommandExitCode -- | Parse a line as a command. parseCommand :: (String -> [CommandDescr]) -> String -> Maybe Command -- | Run a command. runCommand :: Command -> REPL CommandExitCode -- | Split at the first word boundary. splitCommand :: String -> Maybe (String, String) -- | Lookup a string in the command list. findCommand :: String -> [CommandDescr] -- | Lookup a string in the command list, returning an exact match even if -- it's the prefix of another command. findCommandExact :: String -> [CommandDescr] -- | Lookup a string in the notebook-safe command list. findNbCommand :: Bool -> String -> [CommandDescr] moduleCmd :: String -> REPL () loadCmd :: FilePath -> REPL () loadPrelude :: REPL () setOptionCmd :: String -> REPL () interactiveConfig :: Config replParseExpr :: String -> REPL (Expr PName) replEvalExpr :: Expr PName -> REPL (Value, Type) replCheckExpr :: Expr PName -> REPL (Expr Name, Expr, Schema) -- | Randomly test a property, or exhaustively check it if the number of -- values in the type under test is smaller than the tests -- environment variable, or we specify exhaustive testing. qcCmd :: QCMode -> String -> REPL [TestReport] data QCMode QCRandom :: QCMode QCExhaust :: QCMode satCmd :: String -> REPL () proveCmd :: String -> REPL () onlineProveSat :: Bool -> String -> Maybe FilePath -> REPL (Maybe Solver, ProverResult, ProverStats) offlineProveSat :: Bool -> String -> Maybe FilePath -> REPL (Either String String) handleCtrlC :: a -> REPL a -- | Strip leading space. sanitize :: String -> String -- | Lift a parsing action into the REPL monad. replParse :: (String -> Either ParseError a) -> String -> REPL a liftModuleCmd :: ModuleCmd a -> REPL a moduleCmdResult :: ModuleRes a -> REPL a instance GHC.Show.Show Cryptol.REPL.Command.QCMode instance GHC.Classes.Eq Cryptol.REPL.Command.QCMode instance GHC.Show.Show Cryptol.REPL.Command.CommandDescr instance GHC.Classes.Eq Cryptol.REPL.Command.CommandDescr instance GHC.Classes.Ord Cryptol.REPL.Command.CommandDescr