-- 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.3.0 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.Version commitHash :: String commitShortHash :: String commitBranch :: String commitDirty :: Bool version :: Version module Cryptol.Utils.Panic panic :: String -> [String] -> a instance GHC.Show.Show Cryptol.Utils.Panic.CryptolPanic instance GHC.Exception.Exception Cryptol.Utils.Panic.CryptolPanic -- | 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.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) -- | 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 -- | 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 nEq :: Maybe Nat' -> Maybe Nat' -> Bool nGt :: Maybe Nat' -> Maybe Nat' -> Bool nFin :: Maybe Nat' -> Bool 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 GHC.Generics.Constructor Cryptol.TypeCheck.Solver.InfNat.C1_1Nat' instance GHC.Generics.Constructor Cryptol.TypeCheck.Solver.InfNat.C1_0Nat' instance GHC.Generics.Datatype Cryptol.TypeCheck.Solver.InfNat.D1Nat' 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' instance Data.GenericTrie.Internal.TrieKey Cryptol.TypeCheck.Solver.InfNat.Nat' 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 interactiveName :: ModName instance GHC.Generics.Constructor Cryptol.Utils.Ident.C1_0Ident instance GHC.Generics.Datatype Cryptol.Utils.Ident.D1Ident 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 -- | 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 (<+>) :: Doc -> Doc -> Doc ($$) :: Doc -> Doc -> Doc 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 GHC.Generics.Constructor Cryptol.Utils.PP.C1_2Assoc instance GHC.Generics.Constructor Cryptol.Utils.PP.C1_1Assoc instance GHC.Generics.Constructor Cryptol.Utils.PP.C1_0Assoc instance GHC.Generics.Datatype Cryptol.Utils.PP.D1Assoc instance GHC.Generics.Constructor Cryptol.Utils.PP.C1_0Doc instance GHC.Generics.Datatype Cryptol.Utils.PP.D1Doc instance GHC.Generics.Constructor Cryptol.Utils.PP.C1_1NameDisp instance GHC.Generics.Constructor Cryptol.Utils.PP.C1_0NameDisp instance GHC.Generics.Datatype Cryptol.Utils.PP.D1NameDisp 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 GHC.Generics.Generic Cryptol.Utils.PP.Doc instance GHC.Generics.Generic Cryptol.Utils.PP.NameDisp instance GHC.Show.Show Cryptol.Utils.PP.NameFormat instance Control.DeepSeq.NFData Cryptol.Utils.PP.NameDisp 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 Control.DeepSeq.NFData Cryptol.Utils.PP.Doc instance GHC.Show.Show Cryptol.Utils.PP.Doc instance Data.String.IsString Cryptol.Utils.PP.Doc instance Control.DeepSeq.NFData Cryptol.Utils.PP.Assoc instance Cryptol.Utils.PP.PP Data.Text.Internal.Text instance Cryptol.Utils.PP.PP Cryptol.Utils.Ident.Ident 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 GHC.Generics.Selector Cryptol.Parser.Position.S1_0_1Located instance GHC.Generics.Selector Cryptol.Parser.Position.S1_0_0Located instance GHC.Generics.Constructor Cryptol.Parser.Position.C1_0Located instance GHC.Generics.Datatype Cryptol.Parser.Position.D1Located instance GHC.Generics.Selector Cryptol.Parser.Position.S1_0_2Range instance GHC.Generics.Selector Cryptol.Parser.Position.S1_0_1Range instance GHC.Generics.Selector Cryptol.Parser.Position.S1_0_0Range instance GHC.Generics.Constructor Cryptol.Parser.Position.C1_0Range instance GHC.Generics.Datatype Cryptol.Parser.Position.D1Range instance GHC.Generics.Selector Cryptol.Parser.Position.S1_0_1Position instance GHC.Generics.Selector Cryptol.Parser.Position.S1_0_0Position instance GHC.Generics.Constructor Cryptol.Parser.Position.C1_0Position instance GHC.Generics.Datatype Cryptol.Parser.Position.D1Position 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 GHC.Generics.Generic Cryptol.Parser.Position.Range instance GHC.Show.Show Cryptol.Parser.Position.Range instance GHC.Classes.Eq Cryptol.Parser.Position.Range 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 Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Cryptol.Parser.Position.Located a) instance Control.DeepSeq.NFData Cryptol.Parser.Position.Position instance Control.DeepSeq.NFData Cryptol.Parser.Position.Range 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) -- | 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 :: [String] -> String -> 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 instance GHC.Base.Functor Cryptol.Parser.Lexer.AlexLastAcc module Cryptol.Utils.Debug trace :: String -> b -> b ppTrace :: Doc -> b -> b 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.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 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 -> 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 SupplyM a runSupplyM :: Supply -> SupplyM a -> (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 GHC.Generics.Selector Cryptol.ModuleSystem.Name.S1_0_1PrimMap instance GHC.Generics.Selector Cryptol.ModuleSystem.Name.S1_0_0PrimMap instance GHC.Generics.Constructor Cryptol.ModuleSystem.Name.C1_0PrimMap instance GHC.Generics.Datatype Cryptol.ModuleSystem.Name.D1PrimMap instance GHC.Generics.Constructor Cryptol.ModuleSystem.Name.C1_0Supply instance GHC.Generics.Datatype Cryptol.ModuleSystem.Name.D1Supply instance GHC.Generics.Selector Cryptol.ModuleSystem.Name.S1_0_3Name instance GHC.Generics.Selector Cryptol.ModuleSystem.Name.S1_0_2Name instance GHC.Generics.Selector Cryptol.ModuleSystem.Name.S1_0_1Name instance GHC.Generics.Selector Cryptol.ModuleSystem.Name.S1_0_0Name instance GHC.Generics.Constructor Cryptol.ModuleSystem.Name.C1_0Name instance GHC.Generics.Datatype Cryptol.ModuleSystem.Name.D1Name instance GHC.Generics.Constructor Cryptol.ModuleSystem.Name.C1_1NameInfo instance GHC.Generics.Constructor Cryptol.ModuleSystem.Name.C1_0NameInfo instance GHC.Generics.Datatype Cryptol.ModuleSystem.Name.D1NameInfo instance GHC.Generics.Generic Cryptol.ModuleSystem.Name.PrimMap instance GHC.Show.Show Cryptol.ModuleSystem.Name.PrimMap instance Control.Monad.Fix.MonadFix Cryptol.ModuleSystem.Name.SupplyM instance GHC.Base.Monad Cryptol.ModuleSystem.Name.SupplyM instance GHC.Base.Applicative Cryptol.ModuleSystem.Name.SupplyM instance GHC.Base.Functor Cryptol.ModuleSystem.Name.SupplyM instance GHC.Generics.Generic Cryptol.ModuleSystem.Name.Supply instance GHC.Show.Show Cryptol.ModuleSystem.Name.Supply instance GHC.Generics.Generic Cryptol.ModuleSystem.Name.Name instance GHC.Show.Show Cryptol.ModuleSystem.Name.Name 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 Control.DeepSeq.NFData Cryptol.ModuleSystem.Name.NameInfo instance Control.DeepSeq.NFData 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 Cryptol.ModuleSystem.Name.FreshM Cryptol.ModuleSystem.Name.SupplyM 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) instance MonadLib.RunM Cryptol.ModuleSystem.Name.SupplyM a (Cryptol.ModuleSystem.Name.Supply -> (a, Cryptol.ModuleSystem.Name.Supply)) instance MonadLib.BaseM Cryptol.ModuleSystem.Name.SupplyM Cryptol.ModuleSystem.Name.SupplyM instance GHC.Base.Monoid a => GHC.Base.Monoid (Cryptol.ModuleSystem.Name.SupplyM a) instance Control.DeepSeq.NFData Cryptol.ModuleSystem.Name.Supply instance Control.DeepSeq.NFData Cryptol.ModuleSystem.Name.PrimMap 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.Constructor Cryptol.Parser.Name.C1_2PName instance GHC.Generics.Constructor Cryptol.Parser.Name.C1_1PName instance GHC.Generics.Constructor Cryptol.Parser.Name.C1_0PName instance GHC.Generics.Datatype Cryptol.Parser.Name.D1PName instance GHC.Generics.Constructor Cryptol.Parser.Name.C1_1Pass instance GHC.Generics.Constructor Cryptol.Parser.Name.C1_0Pass instance GHC.Generics.Datatype Cryptol.Parser.Name.D1Pass 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) tfunNames :: Map PName TFun instance GHC.Generics.Constructor Cryptol.Prims.Syntax.C1_10TFun instance GHC.Generics.Constructor Cryptol.Prims.Syntax.C1_9TFun instance GHC.Generics.Constructor Cryptol.Prims.Syntax.C1_8TFun instance GHC.Generics.Constructor Cryptol.Prims.Syntax.C1_7TFun instance GHC.Generics.Constructor Cryptol.Prims.Syntax.C1_6TFun instance GHC.Generics.Constructor Cryptol.Prims.Syntax.C1_5TFun instance GHC.Generics.Constructor Cryptol.Prims.Syntax.C1_4TFun instance GHC.Generics.Constructor Cryptol.Prims.Syntax.C1_3TFun instance GHC.Generics.Constructor Cryptol.Prims.Syntax.C1_2TFun instance GHC.Generics.Constructor Cryptol.Prims.Syntax.C1_1TFun instance GHC.Generics.Constructor Cryptol.Prims.Syntax.C1_0TFun instance GHC.Generics.Datatype Cryptol.Prims.Syntax.D1TFun 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 Control.DeepSeq.NFData Cryptol.Prims.Syntax.TFun instance Cryptol.Utils.PP.PP Cryptol.Prims.Syntax.TFun 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 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.Generics.Selector Cryptol.Parser.AST.S1_0_2Module instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_1Module instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_0Module instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_0Module instance GHC.Generics.Datatype Cryptol.Parser.AST.D1Module instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_2TopDecl instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_1TopDecl instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_0TopDecl instance GHC.Generics.Datatype Cryptol.Parser.AST.D1TopDecl instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_1BindDef instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_0BindDef instance GHC.Generics.Datatype Cryptol.Parser.AST.D1BindDef instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_8Bind instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_7Bind instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_6Bind instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_5Bind instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_4Bind instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_3Bind instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_2Bind instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_1Bind instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_0Bind instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_0Bind instance GHC.Generics.Datatype Cryptol.Parser.AST.D1Bind instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_1Match instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_0Match instance GHC.Generics.Datatype Cryptol.Parser.AST.D1Match instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_18Expr instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_17Expr instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_16Expr instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_15Expr instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_14Expr instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_13Expr instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_12Expr instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_11Expr instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_10Expr instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_9Expr instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_8Expr instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_7Expr instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_6Expr instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_5Expr instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_4Expr instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_3Expr instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_2Expr instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_1Expr instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_0Expr instance GHC.Generics.Datatype Cryptol.Parser.AST.D1Expr instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_6Decl instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_5Decl instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_4Decl instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_3Decl instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_2Decl instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_1Decl instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_0Decl instance GHC.Generics.Datatype Cryptol.Parser.AST.D1Decl instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_0Schema instance GHC.Generics.Datatype Cryptol.Parser.AST.D1Schema instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_6Prop instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_5Prop instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_4Prop instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_3Prop instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_2Prop instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_1Prop instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_0Prop instance GHC.Generics.Datatype Cryptol.Parser.AST.D1Prop instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_0TySyn instance GHC.Generics.Datatype Cryptol.Parser.AST.D1TySyn instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_2Newtype instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_1Newtype instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_0Newtype instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_0Newtype instance GHC.Generics.Datatype Cryptol.Parser.AST.D1Newtype instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_1TypeInst instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_0TypeInst instance GHC.Generics.Datatype Cryptol.Parser.AST.D1TypeInst instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_7Pattern instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_6Pattern instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_5Pattern instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_4Pattern instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_3Pattern instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_2Pattern instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_1Pattern instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_0Pattern instance GHC.Generics.Datatype Cryptol.Parser.AST.D1Pattern instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_13Type instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_12Type instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_11Type instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_10Type instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_9Type instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_8Type instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_7Type instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_6Type instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_5Type instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_4Type instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_3Type instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_2Type instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_1Type instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_0Type instance GHC.Generics.Datatype Cryptol.Parser.AST.D1Type instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_2TParam instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_1TParam instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_0TParam instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_0TParam instance GHC.Generics.Datatype Cryptol.Parser.AST.D1TParam instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_1Kind instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_0Kind instance GHC.Generics.Datatype Cryptol.Parser.AST.D1Kind instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_1Named instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_0Named instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_0Named instance GHC.Generics.Datatype Cryptol.Parser.AST.D1Named instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_2Selector instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_1Selector instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_0Selector instance GHC.Generics.Datatype Cryptol.Parser.AST.D1Selector instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_1Literal instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_0Literal instance GHC.Generics.Datatype Cryptol.Parser.AST.D1Literal instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_5NumInfo instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_4NumInfo instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_3NumInfo instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_2NumInfo instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_1NumInfo instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_0NumInfo instance GHC.Generics.Datatype Cryptol.Parser.AST.D1NumInfo instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_1ExportSpec instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_0ExportSpec instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_0ExportSpec instance GHC.Generics.Datatype Cryptol.Parser.AST.D1ExportSpec instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_2TopLevel instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_1TopLevel instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_0TopLevel instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_0TopLevel instance GHC.Generics.Datatype Cryptol.Parser.AST.D1TopLevel instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_1ExportType instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_0ExportType instance GHC.Generics.Datatype Cryptol.Parser.AST.D1ExportType instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_1Pragma instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_0Pragma instance GHC.Generics.Datatype Cryptol.Parser.AST.D1Pragma instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_1Fixity instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_0Fixity instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_0Fixity instance GHC.Generics.Datatype Cryptol.Parser.AST.D1Fixity instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_2Import instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_1Import instance GHC.Generics.Selector Cryptol.Parser.AST.S1_0_0Import instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_0Import instance GHC.Generics.Datatype Cryptol.Parser.AST.D1Import instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_1ImportSpec instance GHC.Generics.Constructor Cryptol.Parser.AST.C1_0ImportSpec instance GHC.Generics.Datatype Cryptol.Parser.AST.D1ImportSpec instance GHC.Show.Show name => GHC.Show.Show (Cryptol.Parser.AST.Program name) instance GHC.Generics.Generic (Cryptol.Parser.AST.Module name) instance GHC.Show.Show name => GHC.Show.Show (Cryptol.Parser.AST.Module 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 GHC.Generics.Generic Cryptol.Parser.AST.Literal instance GHC.Show.Show Cryptol.Parser.AST.Literal instance GHC.Classes.Eq Cryptol.Parser.AST.Literal 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 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 GHC.Generics.Generic (Cryptol.Parser.AST.TopLevel a) instance GHC.Show.Show a => GHC.Show.Show (Cryptol.Parser.AST.TopLevel a) 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 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 GHC.Generics.Generic Cryptol.Parser.AST.Fixity instance GHC.Show.Show Cryptol.Parser.AST.Fixity instance GHC.Classes.Eq Cryptol.Parser.AST.Fixity 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 GHC.Generics.Generic Cryptol.Parser.AST.ImportSpec instance GHC.Show.Show Cryptol.Parser.AST.ImportSpec instance GHC.Classes.Eq Cryptol.Parser.AST.ImportSpec instance Control.DeepSeq.NFData name => Control.DeepSeq.NFData (Cryptol.Parser.AST.Module name) instance Control.DeepSeq.NFData name => Control.DeepSeq.NFData (Cryptol.Parser.AST.TopDecl name) instance Control.DeepSeq.NFData name => Control.DeepSeq.NFData (Cryptol.Parser.AST.Decl name) instance Control.DeepSeq.NFData Cryptol.Parser.AST.Import instance Control.DeepSeq.NFData Cryptol.Parser.AST.ImportSpec instance Control.DeepSeq.NFData name => Control.DeepSeq.NFData (Cryptol.Parser.AST.TySyn name) instance Control.DeepSeq.NFData name => Control.DeepSeq.NFData (Cryptol.Parser.AST.Bind name) instance Control.DeepSeq.NFData name => Control.DeepSeq.NFData (Cryptol.Parser.AST.BindDef name) instance Control.DeepSeq.NFData Cryptol.Parser.AST.Fixity instance Control.DeepSeq.NFData Cryptol.Parser.AST.Pragma instance Control.DeepSeq.NFData name => Control.DeepSeq.NFData (Cryptol.Parser.AST.Newtype name) instance Control.DeepSeq.NFData Cryptol.Parser.AST.ExportType instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Cryptol.Parser.AST.TopLevel a) instance Control.DeepSeq.NFData name => Control.DeepSeq.NFData (Cryptol.Parser.AST.ExportSpec name) instance GHC.Classes.Ord name => GHC.Base.Monoid (Cryptol.Parser.AST.ExportSpec name) instance Control.DeepSeq.NFData Cryptol.Parser.AST.NumInfo instance Control.DeepSeq.NFData Cryptol.Parser.AST.Literal instance Control.DeepSeq.NFData name => Control.DeepSeq.NFData (Cryptol.Parser.AST.Expr name) instance Control.DeepSeq.NFData name => Control.DeepSeq.NFData (Cryptol.Parser.AST.TypeInst name) instance Control.DeepSeq.NFData Cryptol.Parser.AST.Selector instance Control.DeepSeq.NFData name => Control.DeepSeq.NFData (Cryptol.Parser.AST.Match name) instance Control.DeepSeq.NFData name => Control.DeepSeq.NFData (Cryptol.Parser.AST.Pattern name) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Cryptol.Parser.AST.Named a) instance Control.DeepSeq.NFData name => Control.DeepSeq.NFData (Cryptol.Parser.AST.Schema name) instance Control.DeepSeq.NFData Cryptol.Parser.AST.Kind instance Control.DeepSeq.NFData name => Control.DeepSeq.NFData (Cryptol.Parser.AST.TParam name) instance Control.DeepSeq.NFData name => Control.DeepSeq.NFData (Cryptol.Parser.AST.Type name) instance Control.DeepSeq.NFData name => Control.DeepSeq.NFData (Cryptol.Parser.AST.Prop 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) 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] -- | 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 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)] -- | 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 tpVar :: TParam -> TVar -- | 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 -- | The type is supposed to be of kind KProp type Prop = Type -- | The type is "simple" (i.e., it contains no type functions). type SType = 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 -- | Type constants. data TCon TC :: TC -> TCon PC :: PC -> TCon TF :: TFun -> TCon -- | Built-in type constants. -- -- 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 -- | 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 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 type caches the type of the expr. EComp :: 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 -- | if e : t1, then cast e : t2 as long as we can prove that 't1 = t2'. We -- could express this in terms of a built-in constant. `cast :: {a,b} (a -- =*= b) => a -> b` -- -- Using the constant is a bit verbose though, because we end up with -- both the source and target type. So, instead we use this language -- construct, which only stores the target type, and the source type can -- be reconstructed from the expression. -- -- Another way to think of this is simply as an expression with an -- explicit type annotation. ECast :: Expr -> Type -> Expr EWhere :: Expr -> [DeclGroup] -> Expr data Match -- | do we need this type? it seems like it can be computed from the expr From :: Name -> 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 isFreeTV :: TVar -> Bool isBoundTV :: TVar -> Bool 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 pIsNumeric :: Prop -> Bool 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 -- | Make a function type. tFun :: Type -> Type -> Type -- | Eliminate outermost type synonyms. tNoUser :: Type -> Type tWidth :: Type -> Type tLenFromThen :: Type -> Type -> Type -> Type tLenFromThenTo :: Type -> Type -> Type -> Type tMax :: Type -> Type -> Type -- | Equality for numeric types. (=#=) :: Type -> Type -> Prop (=/=) :: Type -> Type -> Prop pArith :: Type -> Prop pCmp :: Type -> Prop -- | Make a greater-than-or-equal-to constraint. (>==) :: Type -> Type -> Prop -- | A Has constraint, used for tuple and record selection. pHas :: Selector -> Type -> Type -> Prop pFin :: Type -> Prop -- | Make multiplication type. (.*.) :: Type -> Type -> Type -- | Make addition type. (.+.) :: Type -> Type -> Type (.-.) :: Type -> Type -> Type (.^.) :: Type -> Type -> Type tDiv :: Type -> Type -> Type tMod :: Type -> Type -> Type -- | Make a min type. tMin :: Type -> Type -> Type newtypeTyCon :: Newtype -> TCon newtypeConType :: Newtype -> Schema -- | 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 class HasKind t kindOf :: HasKind t => t -> Kind quickApply :: Kind -> [a] -> Kind addTNames :: [TParam] -> NameMap -> NameMap ppNewtypeShort :: Newtype -> Doc 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 instance GHC.Generics.Selector Cryptol.TypeCheck.AST.S1_0_5Module instance GHC.Generics.Selector Cryptol.TypeCheck.AST.S1_0_4Module instance GHC.Generics.Selector Cryptol.TypeCheck.AST.S1_0_3Module instance GHC.Generics.Selector Cryptol.TypeCheck.AST.S1_0_2Module instance GHC.Generics.Selector Cryptol.TypeCheck.AST.S1_0_1Module instance GHC.Generics.Selector Cryptol.TypeCheck.AST.S1_0_0Module instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_0Module instance GHC.Generics.Datatype Cryptol.TypeCheck.AST.D1Module instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_1Match instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_0Match instance GHC.Generics.Datatype Cryptol.TypeCheck.AST.D1Match instance GHC.Generics.Selector Cryptol.TypeCheck.AST.S1_0_6Decl instance GHC.Generics.Selector Cryptol.TypeCheck.AST.S1_0_5Decl instance GHC.Generics.Selector Cryptol.TypeCheck.AST.S1_0_4Decl instance GHC.Generics.Selector Cryptol.TypeCheck.AST.S1_0_3Decl instance GHC.Generics.Selector Cryptol.TypeCheck.AST.S1_0_2Decl instance GHC.Generics.Selector Cryptol.TypeCheck.AST.S1_0_1Decl instance GHC.Generics.Selector Cryptol.TypeCheck.AST.S1_0_0Decl instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_0Decl instance GHC.Generics.Datatype Cryptol.TypeCheck.AST.D1Decl instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_1DeclGroup instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_0DeclGroup instance GHC.Generics.Datatype Cryptol.TypeCheck.AST.D1DeclGroup instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_14Expr instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_13Expr instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_12Expr instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_11Expr instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_10Expr instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_9Expr instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_8Expr instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_7Expr instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_6Expr instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_5Expr instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_4Expr instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_3Expr instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_2Expr instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_1Expr instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_0Expr instance GHC.Generics.Datatype Cryptol.TypeCheck.AST.D1Expr instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_1DeclDef instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_0DeclDef instance GHC.Generics.Datatype Cryptol.TypeCheck.AST.D1DeclDef instance GHC.Generics.Selector Cryptol.TypeCheck.AST.S1_0_2Schema instance GHC.Generics.Selector Cryptol.TypeCheck.AST.S1_0_1Schema instance GHC.Generics.Selector Cryptol.TypeCheck.AST.S1_0_0Schema instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_0Schema instance GHC.Generics.Datatype Cryptol.TypeCheck.AST.D1Schema instance GHC.Generics.Selector Cryptol.TypeCheck.AST.S1_0_3TySyn instance GHC.Generics.Selector Cryptol.TypeCheck.AST.S1_0_2TySyn instance GHC.Generics.Selector Cryptol.TypeCheck.AST.S1_0_1TySyn instance GHC.Generics.Selector Cryptol.TypeCheck.AST.S1_0_0TySyn instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_0TySyn instance GHC.Generics.Datatype Cryptol.TypeCheck.AST.D1TySyn instance GHC.Generics.Selector Cryptol.TypeCheck.AST.S1_0_3Newtype instance GHC.Generics.Selector Cryptol.TypeCheck.AST.S1_0_2Newtype instance GHC.Generics.Selector Cryptol.TypeCheck.AST.S1_0_1Newtype instance GHC.Generics.Selector Cryptol.TypeCheck.AST.S1_0_0Newtype instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_0Newtype instance GHC.Generics.Datatype Cryptol.TypeCheck.AST.D1Newtype instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_3Type instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_2Type instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_1Type instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_0Type instance GHC.Generics.Datatype Cryptol.TypeCheck.AST.D1Type instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_2TCon instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_1TCon instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_0TCon instance GHC.Generics.Datatype Cryptol.TypeCheck.AST.D1TCon instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_6TC instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_5TC instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_4TC instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_3TC instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_2TC instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_1TC instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_0TC instance GHC.Generics.Datatype Cryptol.TypeCheck.AST.D1TC instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_0UserTC instance GHC.Generics.Datatype Cryptol.TypeCheck.AST.D1UserTC instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_6PC instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_5PC instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_4PC instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_3PC instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_2PC instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_1PC instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_0PC instance GHC.Generics.Datatype Cryptol.TypeCheck.AST.D1PC instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_1TVar instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_0TVar instance GHC.Generics.Datatype Cryptol.TypeCheck.AST.D1TVar instance GHC.Generics.Selector Cryptol.TypeCheck.AST.S1_0_2TParam instance GHC.Generics.Selector Cryptol.TypeCheck.AST.S1_0_1TParam instance GHC.Generics.Selector Cryptol.TypeCheck.AST.S1_0_0TParam instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_0TParam instance GHC.Generics.Datatype Cryptol.TypeCheck.AST.D1TParam instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_3Kind instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_2Kind instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_1Kind instance GHC.Generics.Constructor Cryptol.TypeCheck.AST.C1_0Kind instance GHC.Generics.Datatype Cryptol.TypeCheck.AST.D1Kind instance GHC.Generics.Generic Cryptol.TypeCheck.AST.Module instance GHC.Show.Show Cryptol.TypeCheck.AST.Module instance GHC.Generics.Generic Cryptol.TypeCheck.AST.Match instance GHC.Show.Show Cryptol.TypeCheck.AST.Match instance GHC.Generics.Generic Cryptol.TypeCheck.AST.Decl instance GHC.Show.Show Cryptol.TypeCheck.AST.Decl instance GHC.Generics.Generic Cryptol.TypeCheck.AST.DeclGroup instance GHC.Show.Show Cryptol.TypeCheck.AST.DeclGroup instance GHC.Generics.Generic Cryptol.TypeCheck.AST.Expr instance GHC.Show.Show Cryptol.TypeCheck.AST.Expr instance GHC.Generics.Generic Cryptol.TypeCheck.AST.DeclDef instance GHC.Show.Show Cryptol.TypeCheck.AST.DeclDef instance GHC.Generics.Generic Cryptol.TypeCheck.AST.Schema instance GHC.Show.Show Cryptol.TypeCheck.AST.Schema instance GHC.Classes.Eq Cryptol.TypeCheck.AST.Schema instance GHC.Generics.Generic Cryptol.TypeCheck.AST.TySyn instance GHC.Show.Show Cryptol.TypeCheck.AST.TySyn instance GHC.Classes.Eq Cryptol.TypeCheck.AST.TySyn instance GHC.Generics.Generic Cryptol.TypeCheck.AST.Newtype instance GHC.Show.Show Cryptol.TypeCheck.AST.Newtype instance GHC.Generics.Generic Cryptol.TypeCheck.AST.Type instance GHC.Classes.Ord Cryptol.TypeCheck.AST.Type instance GHC.Classes.Eq Cryptol.TypeCheck.AST.Type instance GHC.Show.Show Cryptol.TypeCheck.AST.Type instance GHC.Generics.Generic Cryptol.TypeCheck.AST.TCon instance GHC.Classes.Ord Cryptol.TypeCheck.AST.TCon instance GHC.Classes.Eq Cryptol.TypeCheck.AST.TCon instance GHC.Show.Show Cryptol.TypeCheck.AST.TCon instance GHC.Generics.Generic Cryptol.TypeCheck.AST.TC instance GHC.Classes.Ord Cryptol.TypeCheck.AST.TC instance GHC.Classes.Eq Cryptol.TypeCheck.AST.TC instance GHC.Show.Show Cryptol.TypeCheck.AST.TC instance GHC.Generics.Generic Cryptol.TypeCheck.AST.UserTC instance GHC.Show.Show Cryptol.TypeCheck.AST.UserTC instance GHC.Generics.Generic Cryptol.TypeCheck.AST.PC instance GHC.Classes.Ord Cryptol.TypeCheck.AST.PC instance GHC.Classes.Eq Cryptol.TypeCheck.AST.PC instance GHC.Show.Show Cryptol.TypeCheck.AST.PC instance GHC.Generics.Generic Cryptol.TypeCheck.AST.TVar instance GHC.Show.Show Cryptol.TypeCheck.AST.TVar instance GHC.Generics.Generic Cryptol.TypeCheck.AST.TParam instance GHC.Show.Show Cryptol.TypeCheck.AST.TParam instance GHC.Generics.Generic Cryptol.TypeCheck.AST.Kind instance GHC.Show.Show Cryptol.TypeCheck.AST.Kind instance GHC.Classes.Eq Cryptol.TypeCheck.AST.Kind instance Control.DeepSeq.NFData Cryptol.TypeCheck.AST.Module instance Control.DeepSeq.NFData Cryptol.TypeCheck.AST.Kind instance Control.DeepSeq.NFData Cryptol.TypeCheck.AST.Schema instance Control.DeepSeq.NFData Cryptol.TypeCheck.AST.TySyn instance Control.DeepSeq.NFData Cryptol.TypeCheck.AST.Newtype instance Control.DeepSeq.NFData Cryptol.TypeCheck.AST.TParam instance GHC.Classes.Eq Cryptol.TypeCheck.AST.TParam instance GHC.Classes.Ord Cryptol.TypeCheck.AST.TParam instance Control.DeepSeq.NFData Cryptol.TypeCheck.AST.Type instance Control.DeepSeq.NFData Cryptol.TypeCheck.AST.TVar instance Control.DeepSeq.NFData Cryptol.TypeCheck.AST.TCon instance Control.DeepSeq.NFData Cryptol.TypeCheck.AST.PC instance Control.DeepSeq.NFData Cryptol.TypeCheck.AST.TC instance Control.DeepSeq.NFData Cryptol.TypeCheck.AST.UserTC instance GHC.Classes.Eq Cryptol.TypeCheck.AST.UserTC instance GHC.Classes.Ord Cryptol.TypeCheck.AST.UserTC instance GHC.Classes.Eq Cryptol.TypeCheck.AST.TVar instance GHC.Classes.Ord Cryptol.TypeCheck.AST.TVar instance Control.DeepSeq.NFData Cryptol.TypeCheck.AST.Expr instance Control.DeepSeq.NFData Cryptol.TypeCheck.AST.Match instance Control.DeepSeq.NFData Cryptol.TypeCheck.AST.DeclGroup instance Control.DeepSeq.NFData Cryptol.TypeCheck.AST.Decl instance Control.DeepSeq.NFData Cryptol.TypeCheck.AST.DeclDef instance Cryptol.TypeCheck.AST.HasKind Cryptol.TypeCheck.AST.TVar instance Cryptol.TypeCheck.AST.HasKind Cryptol.TypeCheck.AST.TCon instance Cryptol.TypeCheck.AST.HasKind Cryptol.TypeCheck.AST.UserTC instance Cryptol.TypeCheck.AST.HasKind Cryptol.TypeCheck.AST.TC instance Cryptol.TypeCheck.AST.HasKind Cryptol.TypeCheck.AST.PC instance Cryptol.TypeCheck.AST.HasKind Cryptol.Prims.Syntax.TFun instance Cryptol.TypeCheck.AST.HasKind Cryptol.TypeCheck.AST.Type instance Cryptol.TypeCheck.AST.HasKind Cryptol.TypeCheck.AST.TySyn instance Cryptol.TypeCheck.AST.HasKind Cryptol.TypeCheck.AST.Newtype instance Cryptol.TypeCheck.AST.HasKind Cryptol.TypeCheck.AST.TParam instance Cryptol.Utils.PP.PP Cryptol.TypeCheck.AST.Kind instance Cryptol.Utils.PP.PP (Cryptol.TypeCheck.PP.WithNames Cryptol.TypeCheck.AST.TVar) instance Cryptol.Utils.PP.PP Cryptol.TypeCheck.AST.TVar instance Cryptol.Utils.PP.PP Cryptol.TypeCheck.AST.TParam instance Cryptol.Utils.PP.PP (Cryptol.TypeCheck.PP.WithNames Cryptol.TypeCheck.AST.TParam) instance Cryptol.Utils.PP.PP (Cryptol.TypeCheck.PP.WithNames Cryptol.TypeCheck.AST.Type) instance Cryptol.Utils.PP.PP Cryptol.TypeCheck.AST.Schema instance Cryptol.Utils.PP.PP (Cryptol.TypeCheck.PP.WithNames Cryptol.TypeCheck.AST.Schema) instance Cryptol.Utils.PP.PP Cryptol.TypeCheck.AST.TySyn instance Cryptol.Utils.PP.PP (Cryptol.TypeCheck.PP.WithNames Cryptol.TypeCheck.AST.TySyn) instance Cryptol.Utils.PP.PP Cryptol.TypeCheck.AST.Type instance Cryptol.Utils.PP.PP Cryptol.TypeCheck.AST.TCon instance Cryptol.Utils.PP.PP Cryptol.TypeCheck.AST.PC instance Cryptol.Utils.PP.PP Cryptol.TypeCheck.AST.TC instance Cryptol.Utils.PP.PP Cryptol.TypeCheck.AST.UserTC 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) module Cryptol.Eval.Error -- | Panic from an Eval context. evalPanic :: String -> [String] -> a data EvalError InvalidIndex :: Integer -> EvalError TypeCannotBeDemoted :: Type -> EvalError DivideByZero :: EvalError WordTooWide :: Integer -> EvalError UserError :: String -> EvalError -- | A sequencing operation has gotten an invalid index. invalidIndex :: Integer -> a -- | For things like `(inf) or `(0-1) typeCannotBeDemoted :: Type -> a -- | For division by 0. divideByZero :: a -- | For when we know that a word is too wide and will exceed gmp's limits -- (though words approaching this size will probably cause the system to -- crash anyway due to lack of memory) wordTooWide :: Integer -> a -- | For error cryUserError :: String -> a instance GHC.Show.Show Cryptol.Eval.Error.EvalError instance Cryptol.Utils.PP.PP Cryptol.Eval.Error.EvalError instance GHC.Exception.Exception Cryptol.Eval.Error.EvalError module Cryptol.Eval.Value isTBit :: TValue -> Bool isTSeq :: TValue -> Maybe (TValue, TValue) isTFun :: TValue -> Maybe (TValue, TValue) isTTuple :: TValue -> Maybe (Int, [TValue]) isTRec :: TValue -> Maybe [(Ident, TValue)] tvSeq :: TValue -> TValue -> TValue numTValue :: TValue -> Nat' toNumTValue :: Nat' -> TValue finTValue :: TValue -> Integer -- | width, value Invariant: The value must be within the range 0 .. -- 2^width-1 data BV BV :: !Integer -> !Integer -> BV -- | Smart constructor for BVs that checks for the width limit mkBv :: Integer -> Integer -> BV -- | Generic value type, parameterized by bit and word types. data GenValue b w VRecord :: [(Ident, GenValue b w)] -> GenValue b w VTuple :: [GenValue b w] -> GenValue b w VBit :: b -> GenValue b w VSeq :: Bool -> [GenValue b w] -> GenValue b w VWord :: w -> GenValue b w VStream :: [GenValue b w] -> GenValue b w VFun :: (GenValue b w -> GenValue b w) -> GenValue b w VPoly :: (TValue -> GenValue b w) -> GenValue b w type Value = GenValue Bool BV -- | An evaluated type. These types do not contain type variables, type -- synonyms, or type functions. newtype TValue TValue :: Type -> TValue [tValTy] :: TValue -> Type data PPOpts PPOpts :: Bool -> Int -> Int -> PPOpts [useAscii] :: PPOpts -> Bool [useBase] :: PPOpts -> Int [useInfLength] :: PPOpts -> Int defaultPPOpts :: PPOpts ppValue :: PPOpts -> Value -> Doc asciiMode :: PPOpts -> Integer -> Bool integerToChar :: Integer -> Char data WithBase a WithBase :: PPOpts -> a -> WithBase a ppWord :: PPOpts -> BV -> Doc class BitWord b w -- | 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 -- | 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] mask :: Integer -> Integer -> Integer -- | Create a packed word of n bits. word :: Integer -> Integer -> Value lam :: (GenValue b w -> 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] -> GenValue b w toFinSeq :: 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 :: TValue -> TValue -> [GenValue b w] -> GenValue b w -- | Construct one of: * a word, when the sequence is finite and the -- elements are bits * a sequence, when the sequence is finite but the -- elements aren't bits * a stream, when the sequence is not finite -- -- NOTE: do not use this constructor in the case where the thing may be a -- finite, but recursive, sequence. toPackedSeq :: TValue -> TValue -> [Value] -> Value -- | Extract a bit value. fromVBit :: GenValue b w -> b -- | Extract a sequence. fromSeq :: BitWord b w => GenValue b w -> [GenValue b w] fromStr :: Value -> String -- | Extract a packed word. fromVWord :: BitWord b w => GenValue b w -> w vWordLen :: Value -> Maybe Integer -- | Turn a value into an integer represented by w bits. fromWord :: Value -> Integer -- | Extract a function from a value. fromVFun :: GenValue b w -> (GenValue b w -> GenValue b w) -- | Extract a polymorphic function from a value. fromVPoly :: GenValue b w -> (TValue -> GenValue b w) -- | Extract a tuple from a value. fromVTuple :: GenValue b w -> [GenValue b w] -- | Extract a record from a value. fromVRecord :: GenValue b w -> [(Ident, GenValue b w)] -- | Lookup a field in a record. lookupRecord :: Ident -> GenValue b w -> 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 -> Maybe Expr instance GHC.Generics.Constructor Cryptol.Eval.Value.C1_7GenValue instance GHC.Generics.Constructor Cryptol.Eval.Value.C1_6GenValue instance GHC.Generics.Constructor Cryptol.Eval.Value.C1_5GenValue instance GHC.Generics.Constructor Cryptol.Eval.Value.C1_4GenValue instance GHC.Generics.Constructor Cryptol.Eval.Value.C1_3GenValue instance GHC.Generics.Constructor Cryptol.Eval.Value.C1_2GenValue instance GHC.Generics.Constructor Cryptol.Eval.Value.C1_1GenValue instance GHC.Generics.Constructor Cryptol.Eval.Value.C1_0GenValue instance GHC.Generics.Datatype Cryptol.Eval.Value.D1GenValue instance GHC.Generics.Selector Cryptol.Eval.Value.S1_0_0TValue instance GHC.Generics.Constructor Cryptol.Eval.Value.C1_0TValue instance GHC.Generics.Datatype Cryptol.Eval.Value.D1TValue instance GHC.Generics.Constructor Cryptol.Eval.Value.C1_0BV instance GHC.Generics.Datatype Cryptol.Eval.Value.D1BV instance GHC.Base.Functor Cryptol.Eval.Value.WithBase instance GHC.Generics.Generic (Cryptol.Eval.Value.GenValue b w) instance GHC.Generics.Generic Cryptol.Eval.Value.TValue instance GHC.Generics.Generic Cryptol.Eval.Value.BV instance Control.DeepSeq.NFData Cryptol.Eval.Value.BV instance (Control.DeepSeq.NFData b, Control.DeepSeq.NFData w) => Control.DeepSeq.NFData (Cryptol.Eval.Value.GenValue b w) instance Control.DeepSeq.NFData Cryptol.Eval.Value.TValue instance GHC.Show.Show Cryptol.Eval.Value.TValue instance Cryptol.Utils.PP.PP (Cryptol.Eval.Value.WithBase Cryptol.Eval.Value.Value) instance Cryptol.Eval.Value.BitWord GHC.Types.Bool Cryptol.Eval.Value.BV 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. These types do not contain type variables, type -- synonyms, or type functions. data TValue numTValue :: TValue -> Nat' toNumTValue :: Nat' -> TValue finTValue :: TValue -> Integer isTBit :: TValue -> Bool isTFun :: TValue -> Maybe (TValue, TValue) isTSeq :: TValue -> Maybe (TValue, TValue) isTTuple :: TValue -> Maybe (Int, [TValue]) isTRec :: TValue -> Maybe [(Ident, TValue)] tvSeq :: TValue -> TValue -> TValue -- | Generic value type, parameterized by bit and word types. data GenValue b w VRecord :: [(Ident, GenValue b w)] -> GenValue b w VTuple :: [GenValue b w] -> GenValue b w VBit :: b -> GenValue b w VSeq :: Bool -> [GenValue b w] -> GenValue b w VWord :: w -> GenValue b w VStream :: [GenValue b w] -> GenValue b w VFun :: (GenValue b w -> GenValue b w) -> GenValue b w VPoly :: (TValue -> GenValue b w) -> GenValue b w lam :: (GenValue b w -> 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] -> GenValue b w toFinSeq :: 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 :: TValue -> TValue -> [GenValue b w] -> GenValue b w -- | Extract a bit value. fromVBit :: GenValue b w -> b -- | Extract a function from a value. fromVFun :: GenValue b w -> (GenValue b w -> GenValue b w) -- | Extract a polymorphic function from a value. fromVPoly :: GenValue b w -> (TValue -> GenValue b w) -- | Extract a tuple from a value. fromVTuple :: GenValue b w -> [GenValue b w] -- | Extract a record from a value. fromVRecord :: GenValue b w -> [(Ident, GenValue b w)] -- | Lookup a field in a record. lookupRecord :: Ident -> GenValue b w -> GenValue b w -- | Extract a sequence. fromSeq :: BitWord b w => GenValue b w -> [GenValue b w] -- | Extract a packed word. fromVWord :: BitWord b w => GenValue b w -> w evalPanic :: String -> [String] -> a iteValue :: SBool -> Value -> Value -> Value mergeValue :: Bool -> SBool -> Value -> Value -> Value instance Cryptol.Eval.Value.BitWord Cryptol.Symbolic.Value.SBool Cryptol.Symbolic.Value.SWord module Cryptol.ModuleSystem.Interface -- | 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 type IfaceTySyn = TySyn ifTySynName :: TySyn -> Name type IfaceNewtype = Newtype 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 mkIfaceDecl :: Decl -> IfaceDecl -- | Generate an Iface from a typechecked module. genIface :: Module -> Iface -- | Produce a PrimMap from an interface. -- -- NOTE: the map will expose both public and private names. ifacePrimMap :: Iface -> PrimMap instance GHC.Generics.Selector Cryptol.ModuleSystem.Interface.S1_0_2Iface instance GHC.Generics.Selector Cryptol.ModuleSystem.Interface.S1_0_1Iface instance GHC.Generics.Selector Cryptol.ModuleSystem.Interface.S1_0_0Iface instance GHC.Generics.Constructor Cryptol.ModuleSystem.Interface.C1_0Iface instance GHC.Generics.Datatype Cryptol.ModuleSystem.Interface.D1Iface instance GHC.Generics.Selector Cryptol.ModuleSystem.Interface.S1_0_2IfaceDecls instance GHC.Generics.Selector Cryptol.ModuleSystem.Interface.S1_0_1IfaceDecls instance GHC.Generics.Selector Cryptol.ModuleSystem.Interface.S1_0_0IfaceDecls instance GHC.Generics.Constructor Cryptol.ModuleSystem.Interface.C1_0IfaceDecls instance GHC.Generics.Datatype Cryptol.ModuleSystem.Interface.D1IfaceDecls instance GHC.Generics.Selector Cryptol.ModuleSystem.Interface.S1_0_5IfaceDecl instance GHC.Generics.Selector Cryptol.ModuleSystem.Interface.S1_0_4IfaceDecl instance GHC.Generics.Selector Cryptol.ModuleSystem.Interface.S1_0_3IfaceDecl instance GHC.Generics.Selector Cryptol.ModuleSystem.Interface.S1_0_2IfaceDecl instance GHC.Generics.Selector Cryptol.ModuleSystem.Interface.S1_0_1IfaceDecl instance GHC.Generics.Selector Cryptol.ModuleSystem.Interface.S1_0_0IfaceDecl instance GHC.Generics.Constructor Cryptol.ModuleSystem.Interface.C1_0IfaceDecl instance GHC.Generics.Datatype Cryptol.ModuleSystem.Interface.D1IfaceDecl instance GHC.Generics.Generic Cryptol.ModuleSystem.Interface.Iface instance GHC.Show.Show Cryptol.ModuleSystem.Interface.Iface instance GHC.Generics.Generic Cryptol.ModuleSystem.Interface.IfaceDecls instance GHC.Show.Show Cryptol.ModuleSystem.Interface.IfaceDecls instance GHC.Generics.Generic Cryptol.ModuleSystem.Interface.IfaceDecl instance GHC.Show.Show Cryptol.ModuleSystem.Interface.IfaceDecl instance Control.DeepSeq.NFData Cryptol.ModuleSystem.Interface.Iface instance Control.DeepSeq.NFData Cryptol.ModuleSystem.Interface.IfaceDecls instance GHC.Base.Monoid Cryptol.ModuleSystem.Interface.IfaceDecls instance Control.DeepSeq.NFData Cryptol.ModuleSystem.Interface.IfaceDecl module Cryptol.Eval.Env type ReadEnv = EvalEnv data EvalEnv EvalEnv :: Map Name Value -> Map TVar TValue -> EvalEnv [envVars] :: EvalEnv -> Map Name Value [envTypes] :: EvalEnv -> Map TVar TValue emptyEnv :: EvalEnv -- | Bind a variable in the evaluation environment. bindVar :: Name -> Value -> EvalEnv -> EvalEnv -- | Lookup a variable in the environment. lookupVar :: Name -> EvalEnv -> Maybe Value -- | Bind a type variable of kind *. bindType :: TVar -> TValue -> EvalEnv -> EvalEnv -- | Lookup a type variable. lookupType :: TVar -> EvalEnv -> Maybe TValue instance GHC.Generics.Selector Cryptol.Eval.Env.S1_0_1EvalEnv instance GHC.Generics.Selector Cryptol.Eval.Env.S1_0_0EvalEnv instance GHC.Generics.Constructor Cryptol.Eval.Env.C1_0EvalEnv instance GHC.Generics.Datatype Cryptol.Eval.Env.D1EvalEnv instance GHC.Generics.Generic Cryptol.Eval.Env.EvalEnv instance Control.DeepSeq.NFData Cryptol.Eval.Env.EvalEnv instance GHC.Base.Monoid Cryptol.Eval.Env.EvalEnv instance Cryptol.Utils.PP.PP (Cryptol.Eval.Value.WithBase Cryptol.Eval.Env.EvalEnv) module Cryptol.Eval.Type -- | Evaluation for types. evalType :: EvalEnv -> Type -> TValue -- | Reduce type functions, rising an exception for undefined values. evalTF :: TFun -> [TValue] -> TValue module Cryptol.TypeCheck.TypeMap data TypeMap a TM :: Map TVar a -> Map TCon (List TypeMap a) -> Map [Ident] (List TypeMap a) -> TypeMap a [tvar] :: TypeMap a -> Map TVar a [tcon] :: TypeMap a -> Map TCon (List TypeMap a) [trec] :: TypeMap a -> Map [Ident] (List TypeMap a) type TypesMap = List TypeMap class TrieMap m k | m -> k emptyTM :: TrieMap m k => m a nullTM :: TrieMap m k => m a -> Bool lookupTM :: TrieMap m k => k -> m a -> Maybe a alterTM :: TrieMap m k => k -> (Maybe a -> Maybe a) -> m a -> m a unionTM :: TrieMap m k => (a -> a -> a) -> m a -> m a -> m a toListTM :: TrieMap m k => m a -> [(k, a)] mapMaybeWithKeyTM :: TrieMap m k => (k -> a -> Maybe b) -> m a -> m b insertTM :: TrieMap m k => k -> a -> m a -> m a insertWithTM :: TrieMap m k => (a -> a -> a) -> k -> a -> m a -> m a membersTM :: TrieMap m k => m a -> [a] mapTM :: TrieMap m k => (a -> b) -> m a -> m b mapWithKeyTM :: TrieMap m k => (k -> a -> b) -> m a -> m b mapMaybeTM :: TrieMap m k => (a -> Maybe b) -> m a -> m b data List m a L :: Maybe a -> m (List m a) -> List m a [nil] :: List m a -> Maybe a [cons] :: List m a -> m (List m a) instance GHC.Base.Functor Cryptol.TypeCheck.TypeMap.TypeMap instance GHC.Base.Functor m => GHC.Base.Functor (Cryptol.TypeCheck.TypeMap.List m) instance Cryptol.TypeCheck.TypeMap.TrieMap m a => Cryptol.TypeCheck.TypeMap.TrieMap (Cryptol.TypeCheck.TypeMap.List m) [a] instance GHC.Classes.Ord a => Cryptol.TypeCheck.TypeMap.TrieMap (Data.Map.Base.Map a) a instance Cryptol.TypeCheck.TypeMap.TrieMap Cryptol.TypeCheck.TypeMap.TypeMap Cryptol.TypeCheck.AST.Type instance GHC.Show.Show a => GHC.Show.Show (Cryptol.TypeCheck.TypeMap.TypeMap a) -- | This module implements a transformation, which tries to avoid -- exponential slow down in some cases. What's the problem? Consider the -- following (common) patterns: -- -- fibs = [0,1] # [ x + y | x <- fibs, y <- drop`{1} fibs ] -- -- The type of fibs is: -- -- {a} (a >= 1, fin a) => [inf][a] -- -- Here a is the number of bits to be used in the values -- computed by fibs. When we evaluate fibs, a -- becomes a parameter to fibs, which works except that now -- fibs is a function, and we don't get any of the memoization -- we might expect! What looked like an efficient implementation has all -- of a sudden become exponential! -- -- Note that this is only a problem for polymorphic values: if -- fibs was already a function, it would not be that surprising -- that it does not get cached. -- -- So, to avoid this, we try to spot recursive polymorphic values, where -- the recursive occurrences have the exact same type parameters as the -- definition. For example, this is the case in fibs: each -- recursive call to fibs is instantiated with exactly the same -- type parameter (i.e., a). The rewrite we do is as follows: -- -- fibs : {a} (a >= 1, fin a) => [inf][a] fibs = {a} (a >= 1, -- fin a) -> fibs' where fibs' : [inf][a] fibs' = [0,1] # [ x + y | x -- <- fibs', y <- drop`{1} fibs' ] -- -- After the rewrite, the recursion is monomorphic (i.e., we are always -- using the same type). As a result, fibs' is an ordinary -- recursive value, where we get the benefit of caching. -- -- The rewrite is a bit more complex, when there are multiple mutually -- recursive functions. Here is an example: -- -- zig : {a} (a >= 2, fin a) => [inf][a] zig = [1] # zag -- -- zag : {a} (a >= 2, fin a) => [inf][a] zag = [2] # zig -- -- This gets rewritten to: -- -- newName : {a} (a >= 2, fin a) => ([inf][a], [inf][a]) newName = -- {a} (a >= 2, fin a) -> (zig', zag') where zig' : [inf][a] zig' = -- [1] # zag' -- -- zag' : [inf][a] zag' = [2] # zig' -- -- zig : {a} (a >= 2, fin a) => [inf][a] zig = {a} (a >= 2, fin -- a) -> (newName a <> <> ).1 -- -- zag : {a} (a >= 2, fin a) => [inf][a] zag = {a} (a >= 2, fin -- a) -> (newName a <> <> ).2 -- -- NOTE: We are assuming that no capture would occur with binders. For -- values, this is because we replaces things with freshly chosen -- variables. For types, this should be because there should be no -- shadowing in the types. XXX: Make sure that this really is the case -- for types!! module Cryptol.Transform.MonoValues -- | Note that this assumes that this pass will be run only once for each -- module, otherwise we will get name collisions. rewModule :: Supply -> Module -> (Module, Supply) instance Cryptol.TypeCheck.TypeMap.TrieMap Cryptol.Transform.MonoValues.RewMap' (Cryptol.ModuleSystem.Name.Name, [Cryptol.TypeCheck.AST.Type], GHC.Types.Int) module Cryptol.TypeCheck.Subst data Subst S :: Map TVar Type -> !Bool -> Subst [suMap] :: Subst -> Map TVar Type [suDefaulting] :: Subst -> !Bool emptySubst :: Subst singleSubst :: TVar -> Type -> Subst (@@) :: Subst -> Subst -> Subst defaultingSubst :: Subst -> Subst -- | Makes a substitution out of a list. WARNING: We do not validate the -- list in any way, so the caller should ensure that we end up with a -- valid (e.g., idempotent) substitution. listSubst :: [(TVar, Type)] -> Subst isEmptySubst :: Subst -> Bool substToList :: Subst -> Maybe [(TVar, Type)] class FVS t fvs :: FVS t => t -> Set TVar -- | Apply a substitution. Returns Nothing if nothing changed. apSubstMaybe :: Subst -> Type -> Maybe Type class TVars t apSubst :: TVars t => Subst -> t -> t -- | Pick types for unconstrained unification variables. defaultFreeVar :: TVar -> Type -- | Apply the substitution to the keys of a type map. apSubstTypeMapKeys :: Subst -> TypeMap a -> TypeMap a -- | WARNING: This instance assumes that the quantified variables in the -- types in the substitution will not get captured by the quantified -- variables. This is reasonable because there should be no shadowing of -- quantified variables but, just in case, we make a sanity check and -- panic if somehow capture did occur. instance GHC.Show.Show Cryptol.TypeCheck.Subst.Subst instance Cryptol.Utils.PP.PP (Cryptol.TypeCheck.PP.WithNames Cryptol.TypeCheck.Subst.Subst) instance Cryptol.Utils.PP.PP Cryptol.TypeCheck.Subst.Subst instance Cryptol.TypeCheck.Subst.FVS Cryptol.TypeCheck.AST.Type instance Cryptol.TypeCheck.Subst.FVS a => Cryptol.TypeCheck.Subst.FVS [a] instance (Cryptol.TypeCheck.Subst.FVS a, Cryptol.TypeCheck.Subst.FVS b) => Cryptol.TypeCheck.Subst.FVS (a, b) instance Cryptol.TypeCheck.Subst.FVS Cryptol.TypeCheck.AST.Schema instance Cryptol.TypeCheck.Subst.TVars t => Cryptol.TypeCheck.Subst.TVars (GHC.Base.Maybe t) instance Cryptol.TypeCheck.Subst.TVars t => Cryptol.TypeCheck.Subst.TVars [t] instance (Cryptol.TypeCheck.Subst.TVars s, Cryptol.TypeCheck.Subst.TVars t) => Cryptol.TypeCheck.Subst.TVars (s, t) instance Cryptol.TypeCheck.Subst.TVars Cryptol.TypeCheck.AST.Type instance (GHC.Base.Functor m, Cryptol.TypeCheck.Subst.TVars a) => Cryptol.TypeCheck.Subst.TVars (Cryptol.TypeCheck.TypeMap.List m a) instance Cryptol.TypeCheck.Subst.TVars a => Cryptol.TypeCheck.Subst.TVars (Cryptol.TypeCheck.TypeMap.TypeMap a) instance Cryptol.TypeCheck.Subst.TVars Cryptol.TypeCheck.AST.Schema instance Cryptol.TypeCheck.Subst.TVars Cryptol.TypeCheck.AST.Expr instance Cryptol.TypeCheck.Subst.TVars Cryptol.TypeCheck.AST.Match instance Cryptol.TypeCheck.Subst.TVars Cryptol.TypeCheck.AST.DeclGroup instance Cryptol.TypeCheck.Subst.TVars Cryptol.TypeCheck.AST.Decl instance Cryptol.TypeCheck.Subst.TVars Cryptol.TypeCheck.AST.DeclDef instance Cryptol.TypeCheck.Subst.TVars Cryptol.TypeCheck.AST.Module module Cryptol.TypeCheck.Sanity tcExpr :: Map Name Schema -> Expr -> Either Error (Schema, [ProofObligation]) tcDecls :: Map Name Schema -> [DeclGroup] -> Either Error [ProofObligation] tcModule :: Map Name Schema -> Module -> Either Error [ProofObligation] type ProofObligation = Schema data Error -- | expected, actual TypeMismatch :: Schema -> Schema -> Error -- | expected a mono type, got this ExpectedMono :: Schema -> Error TupleSelectorOutOfRange :: Int -> Int -> Error MissingField :: Ident -> [Ident] -> Error UnexpectedTupleShape :: Int -> Int -> Error UnexpectedRecordShape :: [Ident] -> [Ident] -> Error UnexpectedSequenceShape :: Int -> Type -> Error BadSelector :: Selector -> Type -> Error BadInstantiation :: Error Captured :: TVar -> Error BadProofNoAbs :: Error BadProofTyVars :: [TParam] -> Error KindMismatch :: Kind -> Kind -> Error NotEnoughArgumentsInKind :: Kind -> Error BadApplication :: Type -> Type -> Error FreeTypeVariable :: TVar -> Error BadTypeApplication :: Kind -> [Kind] -> Error RepeatedVariableInForall :: TParam -> Error BadMatch :: Type -> Error EmptyArm :: Error UndefinedTypeVaraible :: TVar -> Error UndefinedVariable :: Name -> Error same :: Same a => a -> a -> Bool instance GHC.Show.Show Cryptol.TypeCheck.Sanity.Error instance Cryptol.TypeCheck.Sanity.Same a => Cryptol.TypeCheck.Sanity.Same [a] instance Cryptol.TypeCheck.Sanity.Same Cryptol.TypeCheck.AST.Type instance Cryptol.TypeCheck.Sanity.Same Cryptol.TypeCheck.AST.Schema instance Cryptol.TypeCheck.Sanity.Same Cryptol.TypeCheck.AST.TParam instance GHC.Base.Functor Cryptol.TypeCheck.Sanity.TcM instance GHC.Base.Applicative Cryptol.TypeCheck.Sanity.TcM instance GHC.Base.Monad Cryptol.TypeCheck.Sanity.TcM module Cryptol.TypeCheck.Unify -- | The most general unifier is a substitution and a set of constraints on -- bound variables. type MGU = (Subst, [Prop]) data Result a OK :: a -> Result a Error :: UnificationError -> Result a data UnificationError UniTypeMismatch :: Type -> Type -> UnificationError UniKindMismatch :: Kind -> Kind -> UnificationError UniTypeLenMismatch :: Int -> Int -> UnificationError UniRecursive :: TVar -> Type -> UnificationError UniNonPolyDepends :: TVar -> [TVar] -> UnificationError UniNonPoly :: TVar -> Type -> UnificationError uniError :: UnificationError -> Result a emptyMGU :: MGU mgu :: Type -> Type -> Result MGU mguMany :: [Type] -> [Type] -> Result MGU bindVar :: TVar -> Type -> Result MGU instance GHC.Base.Functor Cryptol.TypeCheck.Unify.Result instance GHC.Base.Applicative Cryptol.TypeCheck.Unify.Result instance GHC.Base.Monad Cryptol.TypeCheck.Unify.Result -- | 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.Generics.Constructor Cryptol.TypeCheck.Solver.Numeric.AST.C1_10Prop instance GHC.Generics.Constructor Cryptol.TypeCheck.Solver.Numeric.AST.C1_9Prop instance GHC.Generics.Constructor Cryptol.TypeCheck.Solver.Numeric.AST.C1_8Prop instance GHC.Generics.Constructor Cryptol.TypeCheck.Solver.Numeric.AST.C1_7Prop instance GHC.Generics.Constructor Cryptol.TypeCheck.Solver.Numeric.AST.C1_6Prop instance GHC.Generics.Constructor Cryptol.TypeCheck.Solver.Numeric.AST.C1_5Prop instance GHC.Generics.Constructor Cryptol.TypeCheck.Solver.Numeric.AST.C1_4Prop instance GHC.Generics.Constructor Cryptol.TypeCheck.Solver.Numeric.AST.C1_3Prop instance GHC.Generics.Constructor Cryptol.TypeCheck.Solver.Numeric.AST.C1_2Prop instance GHC.Generics.Constructor Cryptol.TypeCheck.Solver.Numeric.AST.C1_1Prop instance GHC.Generics.Constructor Cryptol.TypeCheck.Solver.Numeric.AST.C1_0Prop instance GHC.Generics.Datatype Cryptol.TypeCheck.Solver.Numeric.AST.D1Prop instance GHC.Generics.Constructor Cryptol.TypeCheck.Solver.Numeric.AST.C1_12Expr instance GHC.Generics.Constructor Cryptol.TypeCheck.Solver.Numeric.AST.C1_11Expr instance GHC.Generics.Constructor Cryptol.TypeCheck.Solver.Numeric.AST.C1_10Expr instance GHC.Generics.Constructor Cryptol.TypeCheck.Solver.Numeric.AST.C1_9Expr instance GHC.Generics.Constructor Cryptol.TypeCheck.Solver.Numeric.AST.C1_8Expr instance GHC.Generics.Constructor Cryptol.TypeCheck.Solver.Numeric.AST.C1_7Expr instance GHC.Generics.Constructor Cryptol.TypeCheck.Solver.Numeric.AST.C1_6Expr instance GHC.Generics.Constructor Cryptol.TypeCheck.Solver.Numeric.AST.C1_5Expr instance GHC.Generics.Constructor Cryptol.TypeCheck.Solver.Numeric.AST.C1_4Expr instance GHC.Generics.Constructor Cryptol.TypeCheck.Solver.Numeric.AST.C1_3Expr instance GHC.Generics.Constructor Cryptol.TypeCheck.Solver.Numeric.AST.C1_2Expr instance GHC.Generics.Constructor Cryptol.TypeCheck.Solver.Numeric.AST.C1_1Expr instance GHC.Generics.Constructor Cryptol.TypeCheck.Solver.Numeric.AST.C1_0Expr instance GHC.Generics.Datatype Cryptol.TypeCheck.Solver.Numeric.AST.D1Expr instance GHC.Generics.Constructor Cryptol.TypeCheck.Solver.Numeric.AST.C1_1Name instance GHC.Generics.Constructor Cryptol.TypeCheck.Solver.Numeric.AST.C1_0Name instance GHC.Generics.Datatype Cryptol.TypeCheck.Solver.Numeric.AST.D1Name instance (GHC.Classes.Eq p, GHC.Classes.Eq a) => 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 -- | 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 -- | Simplification. The rules in this module are all conditional on the -- expressions being well-defined. -- -- So, for example, consider the formula P, which corresponds to -- `fin e`. P says the following: -- -- if e is well-formed, then will evaluate to a finite natural number. -- -- More concretely, consider `fin (3 - 5)`. This will be simplified to -- True, which does not mean that `3 - 5` is actually finite. module Cryptol.TypeCheck.Solver.Numeric.Simplify1 propToProp' :: Prop -> I Bool ppProp' :: I Bool -> Doc instance GHC.Classes.Eq Cryptol.TypeCheck.Solver.Numeric.Simplify1.Atom instance (GHC.Classes.Eq a, Cryptol.TypeCheck.Solver.Numeric.AST.HasVars a) => Cryptol.TypeCheck.Solver.Numeric.AST.HasVars (Cryptol.TypeCheck.Solver.Numeric.Simplify1.I a) 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 -- | 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 module Cryptol.TypeCheck.Solver.Numeric.ImportExport type ExportM = ExceptionT () Id exportProp :: Prop -> Maybe Prop exportType :: Prop -> Maybe Expr runExportM :: ExportM a -> Maybe a exportPropM :: Prop -> ExportM Prop exportTypeM :: Type -> ExportM Expr importProp :: Prop -> Maybe [Prop] importType :: Expr -> Maybe Type -- | 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 module Cryptol.TypeCheck.TypeOf -- | Given a typing environment and an expression, compute the type of the -- expression as quickly as possible, assuming that the expression is -- well formed with correct type annotations. fastTypeOf :: Map Name Schema -> Expr -> Type fastSchemaOf :: Map Name Schema -> Expr -> Schema module Cryptol.TypeCheck.Solver.Utils -- | All ways to split a type in the form: `a + t1`, where a is a -- variable. splitVarSummands :: Type -> [(TVar, Type)] -- | Check if we can express a type in the form: `a + t1`. splitVarSummand :: TVar -> Type -> Maybe Type -- | Check if we can express a type in the form: `k + t1`, where k -- is a constant > 0. This assumes that the type has been simplified -- already, so that constants are floated to the left. splitConstSummand :: Type -> Maybe (Integer, Type) -- | Check if we can express a type in the form: `k * t1`, where k -- is a constant > 1 This assumes that the type has been simplified -- already, so that constants are floated to the left. splitConstFactor :: Type -> Maybe (Integer, Type) -- | 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: -- --
-- 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.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 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 -> [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 -- | 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 -- | 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 ProverResult satProve :: ProverCommand -> ModuleCmd 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 :: Type -> Maybe Int finType :: Type -> Maybe FinType unFinType :: FinType -> Type predArgTypes :: Schema -> Either String [FinType] forallFinType :: FinType -> Symbolic Value existsFinType :: FinType -> Symbolic Value data Env Env :: Map Name Value -> Map TVar TValue -> Env [envVars] :: Env -> Map Name Value [envTypes] :: Env -> Map TVar TValue -- | Bind a variable in the evaluation environment. bindVar :: (Name, Value) -> Env -> Env -- | Lookup a variable in the environment. lookupVar :: Name -> Env -> Maybe Value -- | Bind a type variable of kind *. bindType :: TVar -> TValue -> Env -> Env -- | Lookup a type variable. lookupType :: TVar -> Env -> Maybe TValue evalExpr :: Env -> Expr -> Value evalType :: Env -> Type -> TValue evalSel :: Selector -> Value -> Value evalDecls :: Env -> [DeclGroup] -> Env evalDeclGroup :: Env -> DeclGroup -> Env evalDecl :: Env -> Decl -> (Name, Value) -- | Make a copy of the given value, building the spine based only on the -- type without forcing the value argument. This lets us avoid strictness -- problems when evaluating recursive definitions. copyBySchema :: Env -> Schema -> Value -> Value copyByType :: Env -> TValue -> Value -> Value -- | Evaluate a comprehension. evalComp :: Env -> TValue -> Expr -> [[Match]] -> Value -- | Turn a list of matches into the final environments for each iteration -- of the branch. branchEnvs :: Env -> [Match] -> [Env] -- | Turn a match into the list of environments it represents. evalMatch :: Env -> Match -> [Env] instance GHC.Show.Show Cryptol.Symbolic.QueryType instance GHC.Show.Show Cryptol.Symbolic.SatNum instance GHC.Base.Monoid Cryptol.Symbolic.Env 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. -- -- NOTE: we sort by displayed name here, but it would be just as easy to -- sort by the position in the file, using nameLoc. 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 () -> REPL () 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 -- | 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 -- | Parse a line as a command. parseCommand :: (String -> [CommandDescr]) -> String -> Maybe Command -- | Run a command. runCommand :: Command -> REPL () -- | 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 ProverResult offlineProveSat :: Bool -> String -> Maybe FilePath -> REPL (Either String String) handleCtrlC :: REPL () -- | 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