1{-# LANGUAGE TypeSynonymInstances #-}
2{-# OPTIONS_GHC -fwarn-incomplete-patterns #-}
6import Idris.Core.Evaluate
8import Idris.Core.Binary
9import Idris.Core.CaseTree
14import Idris.Delaborate
15import qualified Idris.Docstrings as D
16import Idris.Docstrings (Docstring)
18import IRTS.System (getIdrisLibDir)
21import qualified Cheapskate.Types as CT
24import Data.Vector.Binary
26import Data.ByteString.Lazy as B hiding (length, elem, map)
27import qualified Data.Text as T
28import qualified Data.Set as S
32import Control.Monad.State.Strict hiding (get, put)
33import qualified Control.Monad.State.Strict as ST
35import System.Directory
36import Codec.Compression.Zlib (compress)
37import Util.Zlib (decompressEither)
42data IBCFile = IBCFile { ver :: Word8,
43 sourcefile :: FilePath,
45 ibc_imports :: ![(Bool, FilePath)],
46 ibc_importdirs :: ![FilePath],
47 ibc_implicits :: ![(Name, [PArg])],
48 ibc_fixes :: ![FixDecl],
49 ibc_statics :: ![(Name, [Bool])],
50 ibc_classes :: ![(Name, ClassInfo)],
51 ibc_instances :: ![(Bool, Name, Name)],
52 ibc_dsls :: ![(Name, DSL)],
53 ibc_datatypes :: ![(Name, TypeInfo)],
54 ibc_optimise :: ![(Name, OptInfo)],
55 ibc_syntax :: ![Syntax],
56 ibc_keywords :: ![String],
57 ibc_objs :: ![(Codegen, FilePath)],
58 ibc_libs :: ![(Codegen, String)],
59 ibc_cgflags :: ![(Codegen, String)],
60 ibc_dynamic_libs :: ![String],
61 ibc_hdrs :: ![(Codegen, String)],
62 ibc_access :: ![(Name, Accessibility)],
63 ibc_total :: ![(Name, Totality)],
64 ibc_totcheckfail :: ![(FC, String)],
65 ibc_flags :: ![(Name, [FnOpt])],
66 ibc_fninfo :: ![(Name, FnInfo)],
67 ibc_cg :: ![(Name, CGInfo)],
68 ibc_defs :: ![(Name, Def)],
69 ibc_docstrings :: ![(Name, (Docstring D.DocTerm, [(Name, Docstring D.DocTerm)]))],
70 ibc_moduledocs :: ![(Name, Docstring D.DocTerm)],
71 ibc_transforms :: ![(Name, (Term, Term))],
72 ibc_errRev :: ![(Term, Term)],
73 ibc_coercions :: ![Name],
74 ibc_lineapps :: ![(FilePath, Int, PTerm)],
75 ibc_namehints :: ![(Name, Name)],
76 ibc_metainformation :: ![(Name, MetaInformation)],
77 ibc_errorhandlers :: ![Name],
78 ibc_function_errorhandlers :: ![(Name, Name, Name)], -- fn, arg, handler
79 ibc_metavars :: ![(Name, (Maybe Name, Int, Bool))],
80 ibc_patdefs :: ![(Name, ([([Name], Term, Term)], [PTerm]))],
81 ibc_postulates :: ![Name],
82 ibc_externs :: ![(Name, Int)],
83 ibc_parsedSpan :: !(Maybe FC),
84 ibc_usage :: ![(Name, Int)],
85 ibc_exports :: ![Name],
86 ibc_autohints :: ![(Name, Name)]
90deriving instance Binary IBCFile
94initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Nothing [] [] []
96loadIBC :: Bool -- ^ True = reexport, False = make everything private
97 -> FilePath -> Idris ()
99 = do imps <- getImported
100 let redo = case lookup fp imps of
102 Just p -> not p && reexport
104 do iLOG $ "Loading ibc " ++ fp ++ " " ++ show reexport
105 ibcf <- runIO $ (bdecode fp :: IO IBCFile)
106 process reexport ibcf fp
107 addImported reexport fp
109-- | Load an entire package from its index file
110loadPkgIndex :: String -> Idris ()
111loadPkgIndex pkg = do ddir <- runIO $ getIdrisLibDir
112 addImportDir (ddir </> pkg)
113 fp <- findPkgIndex pkg
116bencode :: Binary a => FilePath -> a -> IO ()
117bencode f d = B.writeFile f (compress (encode d))
119bdecode :: Binary b => FilePath -> IO b
120bdecode f = do d' <- B.readFile f
122 (\(_, e) -> error $ "Invalid / corrupted zip format on " ++ show f ++ ": " ++ e)
124 (decompressEither d')
126writeIBC :: FilePath -> FilePath -> Idris ()
128 = do iLOG $ "Writing ibc " ++ show f
130-- case (Data.List.map fst (idris_metavars i)) \\ primDefs of
131-- (_:_) -> ifail "Can't write ibc when there are unsolved metavariables"
134 ibcf <- mkIBC (ibc_write i) (initIBC { sourcefile = src })
135 idrisCatch (do runIO $ createDirectoryIfMissing True (dropFileName f)
136 runIO $ bencode f ibcf
138 (\c -> do iLOG $ "Failed " ++ pshow i c)
141-- Write a package index containing all the imports in the current IState
142-- Used for ':search' of an entire package, to ensure everything is loaded.
143writePkgIndex :: FilePath -> Idris ()
146 let imps = map (\ (x, y) -> (True, x)) $ idris_imported i
147 iLOG $ "Writing package index " ++ show f ++ " including\n" ++
150 let ibcf = initIBC { ibc_imports = imps }
151 idrisCatch (do runIO $ createDirectoryIfMissing True (dropFileName f)
152 runIO $ bencode f ibcf
154 (\c -> do iLOG $ "Failed " ++ pshow i c)
157mkIBC :: [IBCWrite] -> IBCFile -> Idris IBCFile
159mkIBC (i:is) f = do ist <- getIState
160 logLvl 5 $ show i ++ " " ++ show (Data.List.length is)
164ibc :: IState -> IBCWrite -> IBCFile -> Idris IBCFile
165ibc i (IBCFix d) f = return f { ibc_fixes = d : ibc_fixes f }
166ibc i (IBCImp n) f = case lookupCtxtExact n (idris_implicits i) of
167 Just v -> return f { ibc_implicits = (n,v): ibc_implicits f }
168 _ -> ifail "IBC write failed"
170 = case lookupCtxtExact n (idris_statics i) of
171 Just v -> return f { ibc_statics = (n,v): ibc_statics f }
172 _ -> ifail "IBC write failed"
174 = case lookupCtxtExact n (idris_classes i) of
175 Just v -> return f { ibc_classes = (n,v): ibc_classes f }
176 _ -> ifail "IBC write failed"
177ibc i (IBCInstance int n ins) f
178 = return f { ibc_instances = (int,n,ins): ibc_instances f }
180 = case lookupCtxtExact n (idris_dsls i) of
181 Just v -> return f { ibc_dsls = (n,v): ibc_dsls f }
182 _ -> ifail "IBC write failed"
184 = case lookupCtxtExact n (idris_datatypes i) of
185 Just v -> return f { ibc_datatypes = (n,v): ibc_datatypes f }
186 _ -> ifail "IBC write failed"
187ibc i (IBCOpt n) f = case lookupCtxtExact n (idris_optimisation i) of
188 Just v -> return f { ibc_optimise = (n,v): ibc_optimise f }
189 _ -> ifail "IBC write failed"
190ibc i (IBCSyntax n) f = return f { ibc_syntax = n : ibc_syntax f }
191ibc i (IBCKeyword n) f = return f { ibc_keywords = n : ibc_keywords f }
192ibc i (IBCImport n) f = return f { ibc_imports = n : ibc_imports f }
193ibc i (IBCImportDir n) f = return f { ibc_importdirs = n : ibc_importdirs f }
194ibc i (IBCObj tgt n) f = return f { ibc_objs = (tgt, n) : ibc_objs f }
195ibc i (IBCLib tgt n) f = return f { ibc_libs = (tgt, n) : ibc_libs f }
196ibc i (IBCCGFlag tgt n) f = return f { ibc_cgflags = (tgt, n) : ibc_cgflags f }
197ibc i (IBCDyLib n) f = return f {ibc_dynamic_libs = n : ibc_dynamic_libs f }
198ibc i (IBCHeader tgt n) f = return f { ibc_hdrs = (tgt, n) : ibc_hdrs f }
200 = do f' <- case lookupDefExact n (tt_ctxt i) of
201 Just v -> return f { ibc_defs = (n,v) : ibc_defs f }
202 _ -> ifail "IBC write failed"
203 case lookupCtxtExact n (idris_patdefs i) of
204 Just v -> return f' { ibc_patdefs = (n,v) : ibc_patdefs f }
205 _ -> return f' -- Not a pattern definition
207ibc i (IBCDoc n) f = case lookupCtxtExact n (idris_docstrings i) of
208 Just v -> return f { ibc_docstrings = (n,v) : ibc_docstrings f }
209 _ -> ifail "IBC write failed"
210ibc i (IBCCG n) f = case lookupCtxtExact n (idris_callgraph i) of
211 Just v -> return f { ibc_cg = (n,v) : ibc_cg f }
212 _ -> ifail "IBC write failed"
213ibc i (IBCCoercion n) f = return f { ibc_coercions = n : ibc_coercions f }
214ibc i (IBCAccess n a) f = return f { ibc_access = (n,a) : ibc_access f }
215ibc i (IBCFlags n a) f = return f { ibc_flags = (n,a) : ibc_flags f }
216ibc i (IBCFnInfo n a) f = return f { ibc_fninfo = (n,a) : ibc_fninfo f }
217ibc i (IBCTotal n a) f = return f { ibc_total = (n,a) : ibc_total f }
218ibc i (IBCTrans n t) f = return f { ibc_transforms = (n, t) : ibc_transforms f }
219ibc i (IBCErrRev t) f = return f { ibc_errRev = t : ibc_errRev f }
220ibc i (IBCLineApp fp l t) f
221 = return f { ibc_lineapps = (fp,l,t) : ibc_lineapps f }
222ibc i (IBCNameHint (n, ty)) f
223 = return f { ibc_namehints = (n, ty) : ibc_namehints f }
224ibc i (IBCMetaInformation n m) f = return f { ibc_metainformation = (n,m) : ibc_metainformation f }
225ibc i (IBCErrorHandler n) f = return f { ibc_errorhandlers = n : ibc_errorhandlers f }
226ibc i (IBCFunctionErrorHandler fn a n) f =
227 return f { ibc_function_errorhandlers = (fn, a, n) : ibc_function_errorhandlers f }
228ibc i (IBCMetavar n) f =
229 case lookup n (idris_metavars i) of
231 Just t -> return f { ibc_metavars = (n, t) : ibc_metavars f }
232ibc i (IBCPostulate n) f = return f { ibc_postulates = n : ibc_postulates f }
233ibc i (IBCExtern n) f = return f { ibc_externs = n : ibc_externs f }
234ibc i (IBCTotCheckErr fc err) f = return f { ibc_totcheckfail = (fc, err) : ibc_totcheckfail f }
235ibc i (IBCParsedRegion fc) f = return f { ibc_parsedSpan = Just fc }
236ibc i (IBCModDocs n) f = case lookupCtxtExact n (idris_moduledocs i) of
237 Just v -> return f { ibc_moduledocs = (n,v) : ibc_moduledocs f }
238 _ -> ifail "IBC write failed"
239ibc i (IBCUsage n) f = return f { ibc_usage = n : ibc_usage f }
240ibc i (IBCExport n) f = return f { ibc_exports = n : ibc_exports f }
241ibc i (IBCAutoHint n h) f = return f { ibc_autohints = (n, h) : ibc_autohints f }
243process :: Bool -- ^ Reexporting
244 -> IBCFile -> FilePath -> Idris ()
246 | ver i /= ibcVersion
247 = do iLOG "ibc out of date"
248 let e = if ver i < ibcVersion then " an earlier " else " a later "
249 ifail $ "Incompatible ibc version.\nThis library was built with"
250 ++ e ++ "version of Idris.\n" ++
251 "Please clean and rebuild."
255 do srcok <- runIO $ doesFileExist (sourcefile i)
256 when srcok $ timestampOlder (sourcefile i) fn
259-- when (v && srcok && not quiet) $ iputStrLn $ "Skipping " ++ sourcefile i
260 pImportDirs $ force (ibc_importdirs i)
261 pImports $ force (ibc_imports i)
262 pImps $ force (ibc_implicits i)
263 pFixes $ force (ibc_fixes i)
264 pStatics $ force (ibc_statics i)
265 pClasses $ force (ibc_classes i)
266 pInstances $ force (ibc_instances i)
267 pDSLs $ force (ibc_dsls i)
268 pDatatypes $ force (ibc_datatypes i)
269 pOptimise $ force (ibc_optimise i)
270 pSyntax $ force (ibc_syntax i)
271 pKeywords $ force (ibc_keywords i)
272 pObjs $ force (ibc_objs i)
273 pLibs $ force (ibc_libs i)
274 pCGFlags $ force (ibc_cgflags i)
275 pDyLibs $ force (ibc_dynamic_libs i)
276 pHdrs $ force (ibc_hdrs i)
277 pDefs reexp (symbols i) $ force (ibc_defs i)
278 pPatdefs $ force (ibc_patdefs i)
279 pAccess reexp $ force (ibc_access i)
280 pFlags $ force (ibc_flags i)
281 pFnInfo $ force (ibc_fninfo i)
282 pTotal $ force (ibc_total i)
283 pTotCheckErr $ force (ibc_totcheckfail i)
284 pCG $ force (ibc_cg i)
285 pDocs $ force (ibc_docstrings i)
286 pMDocs $ force (ibc_moduledocs i)
287 pCoercions $ force (ibc_coercions i)
288 pTrans $ force (ibc_transforms i)
289 pErrRev $ force (ibc_errRev i)
290 pLineApps $ force (ibc_lineapps i)
291 pNameHints $ force (ibc_namehints i)
292 pMetaInformation $ force (ibc_metainformation i)
293 pErrorHandlers $ force (ibc_errorhandlers i)
294 pFunctionErrorHandlers $ force (ibc_function_errorhandlers i)
295 pMetavars $ force (ibc_metavars i)
296 pPostulates $ force (ibc_postulates i)
297 pExterns $ force (ibc_externs i)
298 pParsedSpan $ force (ibc_parsedSpan i)
299 pUsage $ force (ibc_usage i)
300 pExports $ force (ibc_exports i)
301 pAutoHints $ force (ibc_autohints i)
303timestampOlder :: FilePath -> FilePath -> Idris ()
304timestampOlder src ibc = do srct <- runIO $ getModificationTime src
305 ibct <- runIO $ getModificationTime ibc
307 then ifail "Needs reloading"
310pPostulates :: [Name] -> Idris ()
313 putIState i{ idris_postulates = idris_postulates i `S.union` S.fromList ns }
315pExterns :: [(Name, Int)] -> Idris ()
318 putIState i{ idris_externs = idris_externs i `S.union` S.fromList ns }
320pParsedSpan :: Maybe FC -> Idris ()
321pParsedSpan fc = do ist <- getIState
322 putIState ist { idris_parsedSpan = fc }
324pUsage :: [(Name, Int)] -> Idris ()
325pUsage ns = do ist <- getIState
326 putIState ist { idris_erasureUsed = ns ++ idris_erasureUsed ist }
328pExports :: [Name] -> Idris ()
329pExports ns = do ist <- getIState
330 putIState ist { idris_exports = ns ++ idris_exports ist }
332pAutoHints :: [(Name, Name)] -> Idris ()
333pAutoHints ns = mapM_ (\(n,h) -> addAutoHint n h) ns
335pImportDirs :: [FilePath] -> Idris ()
336pImportDirs fs = mapM_ addImportDir fs
338pImports :: [(Bool, FilePath)] -> Idris ()
340 = do mapM_ (\(re, f) ->
342 ibcsd <- valIBCSubDir i
344 fp <- findImport ids ibcsd f
345-- if (f `elem` imported i)
346-- then iLOG $ "Already read " ++ f
347 putIState (i { imported = f : imported i })
349 LIDR fn -> do iLOG $ "Failed at " ++ fn
350 ifail "Must be an ibc"
351 IDR fn -> do iLOG $ "Failed at " ++ fn
352 ifail "Must be an ibc"
353 IBC fn src -> loadIBC re fn)
356pImps :: [(Name, [PArg])] -> Idris ()
357pImps imps = mapM_ (\ (n, imp) ->
359 case lookupDefAccExact n False (tt_ctxt i) of
360 Just (n, Hidden) -> return ()
361 _ -> putIState (i { idris_implicits
362 = addDef n imp (idris_implicits i) }))
365pFixes :: [FixDecl] -> Idris ()
366pFixes f = do i <- getIState
367 putIState (i { idris_infixes = sort $ f ++ idris_infixes i })
369pStatics :: [(Name, [Bool])] -> Idris ()
370pStatics ss = mapM_ (\ (n, s) ->
372 putIState (i { idris_statics
373 = addDef n s (idris_statics i) }))
376pClasses :: [(Name, ClassInfo)] -> Idris ()
377pClasses cs = mapM_ (\ (n, c) ->
379 -- Don't lose instances from previous IBCs, which
380 -- could have loaded in any order
381 let is = case lookupCtxtExact n (idris_classes i) of
382 Just (CI _ _ _ _ _ ins _) -> ins
384 let c' = c { class_instances =
385 class_instances c ++ is }
386 putIState (i { idris_classes
387 = addDef n c' (idris_classes i) }))
390pInstances :: [(Bool, Name, Name)] -> Idris ()
391pInstances cs = mapM_ (\ (i, n, ins) -> addInstance i n ins) cs
393pDSLs :: [(Name, DSL)] -> Idris ()
394pDSLs cs = mapM_ (\ (n, c) ->
396 putIState (i { idris_dsls
397 = addDef n c (idris_dsls i) }))
400pDatatypes :: [(Name, TypeInfo)] -> Idris ()
401pDatatypes cs = mapM_ (\ (n, c) ->
403 putIState (i { idris_datatypes
404 = addDef n c (idris_datatypes i) }))
407pOptimise :: [(Name, OptInfo)] -> Idris ()
408pOptimise cs = mapM_ (\ (n, c) ->
410 putIState (i { idris_optimisation
411 = addDef n c (idris_optimisation i) }))
414pSyntax :: [Syntax] -> Idris ()
415pSyntax s = do i <- getIState
416 putIState (i { syntax_rules = updateSyntaxRules s (syntax_rules i) })
418pKeywords :: [String] -> Idris ()
419pKeywords k = do i <- getIState
420 putIState (i { syntax_keywords = k ++ syntax_keywords i })
422pObjs :: [(Codegen, FilePath)] -> Idris ()
423pObjs os = mapM_ (\ (cg, obj) -> do dirs <- allImportDirs
424 o <- runIO $ findInPath dirs obj
425 addObjectFile cg o) os
427pLibs :: [(Codegen, String)] -> Idris ()
428pLibs ls = mapM_ (uncurry addLib) ls
430pCGFlags :: [(Codegen, String)] -> Idris ()
431pCGFlags ls = mapM_ (uncurry addFlag) ls
433pDyLibs :: [String] -> Idris ()
434pDyLibs ls = do res <- mapM (addDyLib . return) ls
437 where checkLoad (Left _) = return ()
438 checkLoad (Right err) = ifail err
440pHdrs :: [(Codegen, String)] -> Idris ()
441pHdrs hs = mapM_ (uncurry addHdr) hs
443pPatdefs :: [(Name, ([([Name], Term, Term)], [PTerm]))] -> Idris ()
447 putIState (i { idris_patdefs = addDef n (force d) (idris_patdefs i) }))
450pDefs :: Bool -> [Name] -> [(Name, Def)] -> Idris ()
455 TyDecl _ _ -> return ()
456 _ -> do iLOG $ "SOLVING " ++ show n
459-- logLvl 1 $ "Added " ++ show (n, d')
460 putIState (i { tt_ctxt = addCtxtDef n d' (tt_ctxt i) })
461 if (not reexp) then do iLOG $ "Not exporting " ++ show n
462 setAccessibility n Hidden
463 else iLOG $ "Exporting " ++ show n) ds
465 updateDef (CaseOp c t args o s cd)
466 = do o' <- mapM updateOrig o
468 return $ CaseOp c t args o' s cd'
469 updateDef t = return t
471 updateOrig (Left t) = liftM Left (update t)
472 updateOrig (Right (l, r)) = do l' <- update l
474 return $ Right (l', r')
476 updateCD (CaseDefs (ts, t) (cs, c) (is, i) (rs, r))
477 = do t' <- updateSC t
481 return $ CaseDefs (ts, t') (cs, c') (is, i') (rs, r')
483 updateSC (Case t n alts) = do alts' <- mapM updateAlt alts
484 return (Case t n alts')
485 updateSC (ProjCase t alts) = do alts' <- mapM updateAlt alts
486 return (ProjCase t alts')
487 updateSC (STerm t) = do t' <- update t
489 updateSC c = return c
491 updateAlt (ConCase n i ns t) = do t' <- updateSC t
492 return (ConCase n i ns t')
493 updateAlt (FnCase n ns t) = do t' <- updateSC t
494 return (FnCase n ns t')
495 updateAlt (ConstCase c t) = do t' <- updateSC t
496 return (ConstCase c t')
497 updateAlt (SucCase n t) = do t' <- updateSC t
498 return (SucCase n t')
499 updateAlt (DefaultCase t) = do t' <- updateSC t
500 return (DefaultCase t')
502 update (P t n ty) = do n' <- getSymbol n
504 update (App f a) = liftM2 App (update f) (update a)
505 update (Bind n b sc) = do b' <- updateB b
507 return $ Bind n b' sc'
509 updateB (Let t v) = liftM2 Let (update t) (update v)
510 updateB b = do ty' <- update (binderTy b)
511 return (b { binderTy = ty' })
512 update (Proj t i) = do t' <- update t
516pDocs :: [(Name, (Docstring D.DocTerm, [(Name, Docstring D.DocTerm)]))] -> Idris ()
517pDocs ds = mapM_ (\(n, a) -> addDocStr n (fst a) (snd a)) ds
519pMDocs :: [(Name, Docstring D.DocTerm)] -> Idris ()
520pMDocs ds = mapM_ addMDocStr ds
521 where addMDocStr (n, d) = do ist <- getIState
522 putIState ist { idris_moduledocs = addDef n d (idris_moduledocs ist) }
524pAccess :: Bool -- ^ Reexporting?
525 -> [(Name, Accessibility)] -> Idris ()
527 = mapM_ (\ (n, a_in) ->
528 do let a = if reexp then a_in else Hidden
529 logLvl 3 $ "Setting " ++ show (a, n) ++ " to " ++ show a
531 putIState (i { tt_ctxt = setAccess n a (tt_ctxt i) }))
534pFlags :: [(Name, [FnOpt])] -> Idris ()
535pFlags ds = mapM_ (\ (n, a) -> setFlags n a) ds
537pFnInfo :: [(Name, FnInfo)] -> Idris ()
538pFnInfo ds = mapM_ (\ (n, a) -> setFnInfo n a) ds
540pTotal :: [(Name, Totality)] -> Idris ()
541pTotal ds = mapM_ (\ (n, a) ->
543 putIState (i { tt_ctxt = setTotal n a (tt_ctxt i) }))
546pTotCheckErr :: [(FC, String)] -> Idris ()
547pTotCheckErr es = do ist <- getIState
548 putIState ist { idris_totcheckfail = idris_totcheckfail ist ++ es }
550pCG :: [(Name, CGInfo)] -> Idris ()
551pCG ds = mapM_ (\ (n, a) -> addToCG n a) ds
553pCoercions :: [Name] -> Idris ()
554pCoercions ns = mapM_ (\ n -> addCoercion n) ns
556pTrans :: [(Name, (Term, Term))] -> Idris ()
557pTrans ts = mapM_ (\ (n, t) -> addTrans n t) ts
559pErrRev :: [(Term, Term)] -> Idris ()
560pErrRev ts = mapM_ addErrRev ts
562pLineApps :: [(FilePath, Int, PTerm)] -> Idris ()
563pLineApps ls = mapM_ (\ (f, i, t) -> addInternalApp f i t) ls
565pNameHints :: [(Name, Name)] -> Idris ()
566pNameHints ns = mapM_ (\ (n, ty) -> addNameHint n ty) ns
568pMetaInformation :: [(Name, MetaInformation)] -> Idris ()
569pMetaInformation ds = mapM_ (\ (n, m) ->
571 putIState (i { tt_ctxt = setMetaInformation n m (tt_ctxt i) }))
574pErrorHandlers :: [Name] -> Idris ()
575pErrorHandlers ns = do i <- getIState
576 putIState $ i { idris_errorhandlers = idris_errorhandlers i ++ ns }
578pFunctionErrorHandlers :: [(Name, Name, Name)] -> Idris ()
579pFunctionErrorHandlers [] = return ()
580pFunctionErrorHandlers ((fn, arg, handler):ns) = do addFunctionErrorHandlers fn arg [handler]
581 pFunctionErrorHandlers ns
583pMetavars :: [(Name, (Maybe Name, Int, Bool))] -> Idris ()
584pMetavars ns = do i <- getIState
585 putIState $ i { idris_metavars = Data.List.reverse ns
586 ++ idris_metavars i }
588----- For Cheapskate and docstrings
590instance Binary a => Binary (D.Docstring a) where
591 put (D.DocString opts lines) = do put opts ; put lines
594 return (D.DocString opts lines)
596instance Binary CT.Options where
597 put (CT.Options x1 x2 x3 x4) = do put x1 ; put x2 ; put x3 ; put x4
602 return (CT.Options x1 x2 x3 x4)
604instance Binary D.DocTerm where
605 put D.Unchecked = putWord8 0
606 put (D.Checked t) = putWord8 1 >> put t
607 put (D.Example t) = putWord8 2 >> put t
608 put (D.Failing e) = putWord8 3 >> put e
610 get = do i <- getWord8
612 0 -> return D.Unchecked
613 1 -> fmap D.Checked get
614 2 -> fmap D.Example get
615 3 -> fmap D.Failing get
616 _ -> error "Corrupted binary data for DocTerm"
618instance Binary a => Binary (D.Block a) where
619 put (D.Para lines) = do putWord8 0 ; put lines
620 put (D.Header i lines) = do putWord8 1 ; put i ; put lines
621 put (D.Blockquote bs) = do putWord8 2 ; put bs
622 put (D.List b t xs) = do putWord8 3 ; put b ; put t ; put xs
623 put (D.CodeBlock attr txt src) = do putWord8 4 ; put attr ; put txt ; put src
624 put (D.HtmlBlock txt) = do putWord8 5 ; put txt
625 put D.HRule = putWord8 6
626 get = do i <- getWord8
629 1 -> liftM2 D.Header get get
630 2 -> fmap D.Blockquote get
631 3 -> liftM3 D.List get get get
632 4 -> liftM3 D.CodeBlock get get get
633 5 -> liftM D.HtmlBlock get
635 _ -> error "Corrupted binary data for Block"
637instance Binary a => Binary (D.Inline a) where
638 put (D.Str txt) = do putWord8 0 ; put txt
639 put D.Space = putWord8 1
640 put D.SoftBreak = putWord8 2
641 put D.LineBreak = putWord8 3
642 put (D.Emph xs) = putWord8 4 >> put xs
643 put (D.Strong xs) = putWord8 5 >> put xs
644 put (D.Code xs tm) = putWord8 6 >> put xs >> put tm
645 put (D.Link a b c) = putWord8 7 >> put a >> put b >> put c
646 put (D.Image a b c) = putWord8 8 >> put a >> put b >> put c
647 put (D.Entity a) = putWord8 9 >> put a
648 put (D.RawHtml x) = putWord8 10 >> put x
649 get = do i <- getWord8
653 2 -> return D.SoftBreak
654 3 -> return D.LineBreak
655 4 -> liftM D.Emph get
656 5 -> liftM D.Strong get
657 6 -> liftM2 D.Code get get
658 7 -> liftM3 D.Link get get get
659 8 -> liftM3 D.Image get get get
660 9 -> liftM D.Entity get
661 10 -> liftM D.RawHtml get
662 _ -> error "Corrupted binary data for Inline"
664instance Binary CT.ListType where
665 put (CT.Bullet c) = putWord8 0 >> put c
666 put (CT.Numbered nw i) = putWord8 1 >> put nw >> put i
667 get = do i <- getWord8
669 0 -> liftM CT.Bullet get
670 1 -> liftM2 CT.Numbered get get
671 _ -> error "Corrupted binary data for ListType"
673instance Binary CT.CodeAttr where
674 put (CT.CodeAttr a b) = put a >> put b
675 get = liftM2 CT.CodeAttr get get
677instance Binary CT.NumWrapper where
678 put (CT.PeriodFollowing) = putWord8 0
679 put (CT.ParenFollowing) = putWord8 1
680 get = do i <- getWord8
682 0 -> return CT.PeriodFollowing
683 1 -> return CT.ParenFollowing
684 _ -> error "Corrupted binary data for NumWrapper"
686----- Generated by 'derive'
688instance Binary SizeChange where
691 Smaller -> putWord8 0
694 Unknown -> putWord8 3
702 _ -> error "Corrupted binary data for SizeChange"
704instance Binary CGInfo where
705 put (CGInfo x1 x2 x3 x4 x5)
708-- put x3 -- Already used SCG info for totality check
716 return (CGInfo x1 x2 [] x4 x5)
718instance Binary CaseType where
720 Updatable -> putWord8 0
722 get = do i <- getWord8
724 0 -> return Updatable
726 _ -> error "Corrupted binary data for CaseType"
728instance Binary SC where
731 Case x1 x2 x3 -> do putWord8 0
735 ProjCase x1 x2 -> do putWord8 1
738 STerm x1 -> do putWord8 2
740 UnmatchedCase x1 -> do putWord8 3
742 ImpossibleCase -> do putWord8 4
749 return (Case x1 x2 x3)
752 return (ProjCase x1 x2)
756 return (UnmatchedCase x1)
757 4 -> return ImpossibleCase
758 _ -> error "Corrupted binary data for SC"
761instance Binary CaseAlt where
763 = {-# SCC "putCaseAlt" #-}
765 ConCase x1 x2 x3 x4 -> do putWord8 0
770 ConstCase x1 x2 -> do putWord8 1
773 DefaultCase x1 -> do putWord8 2
775 FnCase x1 x2 x3 -> do putWord8 3
779 SucCase x1 x2 -> do putWord8 4
789 return (ConCase x1 x2 x3 x4)
792 return (ConstCase x1 x2)
794 return (DefaultCase x1)
798 return (FnCase x1 x2 x3)
801 return (SucCase x1 x2)
802 _ -> error "Corrupted binary data for CaseAlt"
804instance Binary CaseDefs where
805 put (CaseDefs x1 x2 x3 x4)
806 = do -- don't need totality checked or inlined versions
812 return (CaseDefs x2 x2 x2 x4)
814instance Binary CaseInfo where
815 put x@(CaseInfo x1 x2 x3) = do put x1
821 return (CaseInfo x1 x2 x3)
823instance Binary Def where
825 = {-# SCC "putDef" #-}
827 Function x1 x2 -> do putWord8 0
830 TyDecl x1 x2 -> do putWord8 1
833 -- all primitives just get added at the start, don't write
834 Operator x1 x2 x3 -> do return ()
835 CaseOp x1 x2 x2a x3 x3a x4 -> do putWord8 3
847 return (Function x1 x2)
850 return (TyDecl x1 x2)
851 -- Operator isn't written, don't read
856 -- x3 <- get always []
858 return (CaseOp x1 x2 x3 x4 [] x5)
859 _ -> error "Corrupted binary data for Def"
861instance Binary Accessibility where
873 _ -> error "Corrupted binary data for Accessibility"
875safeToEnum :: (Enum a, Bounded a, Integral int) => String -> int -> a
876safeToEnum label x' = result
880 | x < fromEnum (minBound `asTypeOf` result)
881 || x > fromEnum (maxBound `asTypeOf` result)
882 = error $ label ++ ": corrupted binary representation in IBC"
883 | otherwise = toEnum x
885instance Binary PReason where
888 Other x1 -> do putWord8 0
891 NotCovering -> putWord8 2
892 NotPositive -> putWord8 3
893 Mutual x1 -> do putWord8 4
895 NotProductive -> putWord8 5
896 BelieveMe -> putWord8 6
897 UseUndef x1 -> do putWord8 7
899 ExternalIO -> putWord8 8
906 2 -> return NotCovering
907 3 -> return NotPositive
910 5 -> return NotProductive
911 6 -> return BelieveMe
914 8 -> return ExternalIO
915 _ -> error "Corrupted binary data for PReason"
917instance Binary Totality where
920 Total x1 -> do putWord8 0
922 Partial x1 -> do putWord8 1
924 Unchecked -> do putWord8 2
925 Productive -> do putWord8 3
933 2 -> return Unchecked
934 3 -> return Productive
935 _ -> error "Corrupted binary data for Totality"
937instance Binary MetaInformation where
940 EmptyMI -> do putWord8 0
941 DataMI x1 -> do putWord8 1
943 get = do i <- getWord8
948 _ -> error "Corrupted binary data for MetaInformation"
950instance Binary IBCFile where
951 put x@(IBCFile x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29 x30 x31 x32 x33 x34 x35 x36 x37 x38 x39 x40 x41 x42 x43 x44 x45)
952 = {-# SCC "putIBCFile" #-}
1001 if x1 == ibcVersion then
1046 return (IBCFile x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29 x30 x31 x32 x33 x34 x35 x36 x37 x38 x39 x40 x41 x42 x43 x44 x45)
1047 else return (initIBC { ver = x1 })
1049instance Binary DataOpt where
1051 Codata -> putWord8 0
1052 DefaultEliminator -> putWord8 1
1053 DataErrRev -> putWord8 2
1054 DefaultCaseFun -> putWord8 3
1055 get = do i <- getWord8
1058 1 -> return DefaultEliminator
1059 2 -> return DataErrRev
1060 3 -> return DefaultCaseFun
1061 _ -> error "Corrupted binary data for DataOpt"
1063instance Binary FnOpt where
1066 Inlinable -> putWord8 0
1067 TotalFn -> putWord8 1
1068 Dictionary -> putWord8 2
1069 AssertTotal -> putWord8 3
1070 Specialise x -> do putWord8 4
1072 Coinductive -> putWord8 5
1073 PartialFn -> putWord8 6
1074 Implicit -> putWord8 7
1075 Reflection -> putWord8 8
1076 ErrorHandler -> putWord8 9
1077 ErrorReverse -> putWord8 10
1078 CoveringFn -> putWord8 11
1079 NoImplicit -> putWord8 12
1080 Constructor -> putWord8 13
1081 CExport x1 -> do putWord8 14
1083 AutoHint -> putWord8 15
1087 0 -> return Inlinable
1089 2 -> return Dictionary
1090 3 -> return AssertTotal
1092 return (Specialise x)
1093 5 -> return Coinductive
1094 6 -> return PartialFn
1095 7 -> return Implicit
1096 8 -> return Reflection
1097 9 -> return ErrorHandler
1098 10 -> return ErrorReverse
1099 11 -> return CoveringFn
1100 12 -> return NoImplicit
1101 13 -> return Constructor
1104 15 -> return AutoHint
1105 _ -> error "Corrupted binary data for FnOpt"
1107instance Binary Fixity where
1110 Infixl x1 -> do putWord8 0
1112 Infixr x1 -> do putWord8 1
1114 InfixN x1 -> do putWord8 2
1116 PrefixN x1 -> do putWord8 3
1129 _ -> error "Corrupted binary data for Fixity"
1132instance Binary FixDecl where
1142instance Binary ArgOpt where
1145 HideDisplay -> putWord8 0
1146 InaccessibleArg -> putWord8 1
1147 AlwaysShow -> putWord8 2
1151 0 -> return HideDisplay
1152 1 -> return InaccessibleArg
1153 2 -> return AlwaysShow
1154 _ -> error "Corrupted binary data for Static"
1156instance Binary Static where
1159 Static -> putWord8 0
1160 Dynamic -> putWord8 1
1166 _ -> error "Corrupted binary data for Static"
1169instance Binary Plicity where
1199 return (Imp x1 x2 x3 x4)
1203 return (Exp x1 x2 x3)
1206 return (Constraint x1 x2)
1210 return (TacImp x1 x2 x3)
1211 _ -> error "Corrupted binary data for Plicity"
1214instance (Binary t) => Binary (PDecl' t) where
1217 PFix x1 x2 x3 -> do putWord8 0
1221 PTy x1 x2 x3 x4 x5 x6 x7
1230 PClauses x1 x2 x3 x4 -> do putWord8 2
1235 PData x1 x2 x3 x4 x5 x6 ->
1243 PParams x1 x2 x3 -> do putWord8 4
1247 PNamespace x1 x2 -> do putWord8 5
1250 PRecord x1 x2 x3 x4 x5 x6 x7 x8 x9 ->
1261 PClass x1 x2 x3 x4 x5 x6 x7 x8 x9
1272 PInstance x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 ->
1284 PDSL x1 x2 -> do putWord8 9
1287 PCAF x1 x2 x3 -> do putWord8 10
1291 PMutual x1 x2 -> do putWord8 11
1294 PPostulate x1 x2 x3 x4 x5 x6 x7
1303 PSyntax x1 x2 -> do putWord8 13
1306 PDirective x1 -> error "Cannot serialize PDirective"
1307 PProvider x1 x2 x3 x4 x5 ->
1314 PTransform x1 x2 x3 x4 -> do putWord8 16
1325 return (PFix x1 x2 x3)
1333 return (PTy x1 x2 x3 x4 x5 x6 x7)
1338 return (PClauses x1 x2 x3 x4)
1345 return (PData x1 x2 x3 x4 x5 x6)
1349 return (PParams x1 x2 x3)
1352 return (PNamespace x1 x2)
1362 return (PRecord x1 x2 x3 x4 x5 x6 x7 x8 x9)
1372 return (PClass x1 x2 x3 x4 x5 x6 x7 x8 x9)
1383 return (PInstance x1 x2 x3 x4 x5 x6 x7 x8 x9 x10)
1390 return (PCAF x1 x2 x3)
1393 return (PMutual x1 x2)
1401 return (PPostulate x1 x2 x3 x4 x5 x6 x7)
1404 return (PSyntax x1 x2)
1405 14 -> do error "Cannot deserialize PDirective"
1411 return (PProvider x1 x2 x3 x4 x5)
1416 return (PTransform x1 x2 x3 x4)
1417 _ -> error "Corrupted binary data for PDecl'"
1419instance Binary t => Binary (ProvideWhat' t) where
1420 put (ProvTerm x1 x2) = do putWord8 0
1423 put (ProvPostulate x1) = do putWord8 1
1425 get = do y <- getWord8
1429 return (ProvTerm x1 x2)
1431 return (ProvPostulate x1)
1432 _ -> error "Corrupted binary data for ProvideWhat"
1434instance Binary Using where
1435 put (UImplicit x1 x2) = do putWord8 0; put x1; put x2
1436 put (UConstraint x1 x2) = do putWord8 1; put x1; put x2
1438 get = do i <- getWord8
1440 0 -> do x1 <- get; x2 <- get; return (UImplicit x1 x2)
1441 1 -> do x1 <- get; x2 <- get; return (UConstraint x1 x2)
1442 _ -> error "Corrupted binary data for Using"
1444instance Binary SyntaxInfo where
1445 put (Syn x1 x2 x3 x4 _ _ x5 x6 _ _ x7 _)
1461 return (Syn x1 x2 x3 x4 [] id x5 x6 Nothing 0 x7 0)
1463instance (Binary t) => Binary (PClause' t) where
1466 PClause x1 x2 x3 x4 x5 x6 -> do putWord8 0
1473 PWith x1 x2 x3 x4 x5 x6 x7 -> do putWord8 1
1481 PClauseR x1 x2 x3 x4 -> do putWord8 2
1486 PWithR x1 x2 x3 x4 x5 -> do putWord8 3
1501 return (PClause x1 x2 x3 x4 x5 x6)
1509 return (PWith x1 x2 x3 x4 x5 x6 x7)
1514 return (PClauseR x1 x2 x3 x4)
1520 return (PWithR x1 x2 x3 x4 x5)
1521 _ -> error "Corrupted binary data for PClause'"
1523instance (Binary t) => Binary (PData' t) where
1526 PDatadecl x1 x2 x3 -> do putWord8 0
1530 PLaterdecl x1 x2 -> do putWord8 1
1539 return (PDatadecl x1 x2 x3)
1542 return (PLaterdecl x1 x2)
1543 _ -> error "Corrupted binary data for PData'"
1545instance Binary PunInfo where
1548 TypeOrTerm -> putWord8 0
1549 IsType -> putWord8 1
1550 IsTerm -> putWord8 2
1554 0 -> return TypeOrTerm
1557 _ -> error "Corrupted binary data for PunInfo"
1559instance Binary PTerm where
1562 PQuote x1 -> do putWord8 0
1564 PRef x1 x2 -> do putWord8 1
1567 PInferRef x1 x2 -> do putWord8 2
1570 PPatvar x1 x2 -> do putWord8 3
1573 PLam x1 x2 x3 x4 -> do putWord8 4
1578 PPi x1 x2 x3 x4 -> do putWord8 5
1583 PLet x1 x2 x3 x4 x5 -> do putWord8 6
1589 PTyped x1 x2 -> do putWord8 7
1592 PAppImpl x1 x2 -> error "PAppImpl in final term"
1593 PApp x1 x2 x3 -> do putWord8 8
1597 PAppBind x1 x2 x3 -> do putWord8 9
1601 PMatchApp x1 x2 -> do putWord8 10
1604 PCase x1 x2 x3 -> do putWord8 11
1608 PTrue x1 x2 -> do putWord8 12
1611 PRefl x1 x2 -> do putWord8 14
1614 PResolveTC x1 -> do putWord8 15
1616 PEq x1 x2 x3 x4 x5 -> do putWord8 16
1622 PRewrite x1 x2 x3 x4 -> do putWord8 17
1627 PPair x1 x2 x3 x4 -> do putWord8 18
1632 PDPair x1 x2 x3 x4 x5 -> do putWord8 19
1638 PAlternative x1 x2 -> do putWord8 20
1641 PHidden x1 -> do putWord8 21
1643 PType -> putWord8 22
1644 PGoal x1 x2 x3 x4 -> do putWord8 23
1649 PConstant x1 -> do putWord8 24
1651 Placeholder -> putWord8 25
1652 PDoBlock x1 -> do putWord8 26
1654 PIdiom x1 x2 -> do putWord8 27
1657 PReturn x1 -> do putWord8 28
1659 PMetavar x1 -> do putWord8 29
1661 PProof x1 -> do putWord8 30
1663 PTactics x1 -> do putWord8 31
1665 PImpossible -> putWord8 33
1666 PCoerced x1 -> do putWord8 34
1668 PUnifyLog x1 -> do putWord8 35
1670 PNoImplicits x1 -> do putWord8 36
1672 PDisamb x1 x2 -> do putWord8 37
1675 PUniverse x1 -> do putWord8 38
1677 PRunTactics x1 x2 -> do putWord8 39
1680 PAs x1 x2 x3 -> do putWord8 40
1684 PElabError x1 -> do putWord8 41
1686 PQuasiquote x1 x2 -> do putWord8 42
1689 PUnquote x1 -> do putWord8 43
1703 return (PInferRef x1 x2)
1706 return (PPatvar x1 x2)
1711 return (PLam x1 x2 x3 x4)
1716 return (PPi x1 x2 x3 x4)
1722 return (PLet x1 x2 x3 x4 x5)
1725 return (PTyped x1 x2)
1729 return (PApp x1 x2 x3)
1733 return (PAppBind x1 x2 x3)
1736 return (PMatchApp x1 x2)
1740 return (PCase x1 x2 x3)
1743 return (PTrue x1 x2)
1746 return (PRefl x1 x2)
1748 return (PResolveTC x1)
1754 return (PEq x1 x2 x3 x4 x5)
1759 return (PRewrite x1 x2 x3 x4)
1764 return (PPair x1 x2 x3 x4)
1770 return (PDPair x1 x2 x3 x4 x5)
1773 return (PAlternative x1 x2)
1781 return (PGoal x1 x2 x3 x4)
1783 return (PConstant x1)
1784 25 -> return Placeholder
1786 return (PDoBlock x1)
1789 return (PIdiom x1 x2)
1793 return (PMetavar x1)
1797 return (PTactics x1)
1798 33 -> return PImpossible
1800 return (PCoerced x1)
1802 return (PUnifyLog x1)
1804 return (PNoImplicits x1)
1807 return (PDisamb x1 x2)
1809 return (PUniverse x1)
1812 return (PRunTactics x1 x2)
1816 return (PAs x1 x2 x3)
1818 return (PElabError x1)
1821 return (PQuasiquote x1 x2)
1823 return (PUnquote x1)
1824 _ -> error "Corrupted binary data for PTerm"
1826instance (Binary t) => Binary (PTactic' t) where
1829 Intro x1 -> do putWord8 0
1831 Focus x1 -> do putWord8 1
1833 Refine x1 x2 -> do putWord8 2
1836 Rewrite x1 -> do putWord8 3
1838 LetTac x1 x2 -> do putWord8 4
1841 Exact x1 -> do putWord8 5
1843 Compute -> putWord8 6
1844 Trivial -> putWord8 7
1846 Attack -> putWord8 9
1847 ProofState -> putWord8 10
1848 ProofTerm -> putWord8 11
1850 Try x1 x2 -> do putWord8 13
1853 TSeq x1 x2 -> do putWord8 14
1857 ApplyTactic x1 -> do putWord8 16
1859 Reflect x1 -> do putWord8 17
1861 Fill x1 -> do putWord8 18
1863 Induction x1 -> do putWord8 19
1865 ByReflection x1 -> do putWord8 20
1867 ProofSearch x1 x2 x3 x4 x5 -> do putWord8 21
1873 DoUnify -> putWord8 22
1874 CaseTac x1 -> do putWord8 23
1876 SourceFC -> putWord8 24
1877 Intros -> putWord8 25
1878 Equiv x1 -> do putWord8 26
1880 Claim x1 x2 -> do putWord8 27
1883 Unfocus -> putWord8 28
1884 MatchRefine x1 -> do putWord8 29
1886 LetTacTy x1 x2 x3 -> do putWord8 30
1890 TCInstance -> putWord8 31
1891 GoalType x1 x2 -> do putWord8 32
1894 TCheck x1 -> do putWord8 33
1896 TEval x1 -> do putWord8 34
1898 TDocStr x1 -> do putWord8 35
1900 TSearch x1 -> do putWord8 36
1903 TFail x1 -> do putWord8 38
1905 Abandon -> putWord8 39
1915 return (Refine x1 x2)
1920 return (LetTac x1 x2)
1927 10 -> return ProofState
1928 11 -> return ProofTerm
1938 return (ApplyTactic x1)
1944 return (Induction x1)
1946 return (ByReflection x1)
1952 return (ProofSearch x1 x2 x3 x4 x5)
1953 22 -> return DoUnify
1956 24 -> return SourceFC
1962 return (Claim x1 x2)
1963 28 -> return Unfocus
1965 return (MatchRefine x1)
1969 return (LetTacTy x1 x2 x3)
1970 31 -> return TCInstance
1973 return (GoalType x1 x2)
1985 39 -> return Abandon
1986 _ -> error "Corrupted binary data for PTactic'"
1989instance (Binary t) => Binary (PDo' t) where
1992 DoExp x1 x2 -> do putWord8 0
1995 DoBind x1 x2 x3 -> do putWord8 1
1999 DoBindP x1 x2 x3 x4 -> do putWord8 2
2004 DoLet x1 x2 x3 x4 -> do putWord8 3
2009 DoLetP x1 x2 x3 -> do putWord8 4
2018 return (DoExp x1 x2)
2022 return (DoBind x1 x2 x3)
2027 return (DoBindP x1 x2 x3 x4)
2032 return (DoLet x1 x2 x3 x4)
2036 return (DoLetP x1 x2 x3)
2037 _ -> error "Corrupted binary data for PDo'"
2040instance (Binary t) => Binary (PArg' t) where
2043 PImp x1 x2 x3 x4 x5 ->
2056 PConstraint x1 x2 x3 x4 ->
2062 PTacImplicit x1 x2 x3 x4 x5 ->
2077 return (PImp x1 x2 x3 x4 x5)
2082 return (PExp x1 x2 x3 x4)
2087 return (PConstraint x1 x2 x3 x4)
2093 return (PTacImplicit x1 x2 x3 x4 x5)
2094 _ -> error "Corrupted binary data for PArg'"
2097instance Binary ClassInfo where
2098 put (CI x1 x2 x3 x4 x5 _ x6)
2112 return (CI x1 x2 x3 x4 x5 [] x6)
2114instance Binary OptInfo where
2115 put (Optimise x1 x2)
2121 return (Optimise x1 x2)
2123instance Binary FnInfo where
2130instance Binary TypeInfo where
2131 put (TI x1 x2 x3 x4 x5) = do put x1
2141 return (TI x1 x2 x3 x4 x5)
2143instance Binary SynContext where
2146 PatternSyntax -> putWord8 0
2147 TermSyntax -> putWord8 1
2148 AnySyntax -> putWord8 2
2152 0 -> return PatternSyntax
2153 1 -> return TermSyntax
2154 2 -> return AnySyntax
2155 _ -> error "Corrupted binary data for SynContext"
2158instance Binary Syntax where
2167 return (Rule x1 x2 x3)
2169instance (Binary t) => Binary (DSL' t) where
2170 put (DSL x1 x2 x3 x4 x5 x6 x7 x8 x9 x10)
2192 return (DSL x1 x2 x3 x4 x5 x6 x7 x8 x9 x10)
2194instance Binary SSymbol where
2197 Keyword x1 -> do putWord8 0
2199 Symbol x1 -> do putWord8 1
2201 Expr x1 -> do putWord8 2
2203 SimpleExpr x1 -> do putWord8 3
2205 Binding x1 -> do putWord8 4
2217 return (SimpleExpr x1)
2220 _ -> error "Corrupted binary data for SSymbol"
2222instance Binary Codegen where
2225 Via str -> do putWord8 0
2227 Bytecode -> putWord8 1
2233 1 -> return Bytecode
2234 _ -> error "Corrupted binary data for Codegen"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list